43 int *
check,
int print_errors);
49 char *
c,
num[] =
"0123456789abcdefghijklmnopqrstuvwxyz";
51 fprintf (stderr,
"%5d (0x%04x): Starting to read number of base %d"
55 while (**
p && (
c = strchr (
num,
tolower ((
const unsigned char)**
p))))
59 fprintf (stderr,
"%5d (0x%04x): Digit found:%1x.\n",
stack[
sp].
line,
61 result = result * base +
i;
68 fprintf (stderr,
"%5d (0x%04x): rd_number returned %d (%04x).\n",
79 "%5d (0x%04x): Starting to read basenumber (string=%s).\n",
86 else if (print_errors)
87 printerr (1,
"unexpected end of line after `@'\n");
90 if (**
p ==
'0' || !
isalnum ((
const unsigned char)**
p))
94 else if (print_errors)
95 printerr (1,
"base must be between 1 and z\n");
100 if (
isalpha ((
const unsigned char)**
p))
111 "%5d (0x%04x): Starting to read character (string=%s).\n",
118 else if (print_errors)
119 printerr (1,
"unexpected end of line in string constant\n");
125 if (**
p >=
'0' && **
p <=
'7')
129 if ((*
p)[1] >=
'0' && (*
p)[1] <=
'7')
131 if (**
p <=
'3' && (*
p)[2] >=
'0' && (*
p)[2] <=
'7')
138 for (
b = 0;
b < num_digits;
b++)
140 int bit = (*p)[num_digits - 1 -
b] -
'0';
141 i += (1 << (
b * 3)) *
bit;
164 else if (print_errors)
165 printerr (1,
"empty literal character\n");
170 else if (print_errors)
171 printerr (1,
"unexpected end of line after "
172 "backslash in string constant\n");
183 fprintf (stderr,
"%5d (0x%04x): rd_character returned %d (%c).\n",
190 struct label **previous,
int force_skip)
196 for (
c = *
p;
isalnum ((
const unsigned char)*
c) || *
c ==
'_' || *
c ==
'.';
c++)
200 for (l = labels; l; l = l->
next)
213 if (cmp < 0 || s2 >
s)
231 "%5d (0x%04x): returning invalid label %s.\n",
256 fprintf (stderr,
"%5d (0x%04x): Starting to read label (string=%s).\n",
261 (**
p ==
'.' &&
s ==
sp) ? previous :
NULL, 0))
267 const char *old_p = *
p;
270 if (!exists && print_errors)
271 printerr (1,
"using undefined label %.*s\n", *
p - old_p, old_p);
274 fprintf (stderr,
"rd_label returns invalid value\n");
280 fprintf (stderr,
"rd_label returns valid value 0x%x\n", l->
value);
287 int sign = 1, not = 0, base,
v;
288 const char *p0, *p1, *p2;
290 fprintf (stderr,
"%5d (0x%04x): Starting to read value (string=%s).\n",
293 while (**
p && strchr (
"+-~", **
p))
369 else if (print_errors)
370 printerr (1,
"invalid character in number: \'%c\'\n", *p2);
372 return not ^ (sign *
v);
384 return not ^ (sign *
v);
397 else if (print_errors)
398 printerr (1,
"missing closing quote (%c)\n", quote);
407 return not ^ (sign * exist);
428 else if (print_errors)
429 printerr (1,
"invalid literal starting with &%c\n", **
p);
442 return not ^ (sign *
value);
453 fprintf (stderr,
"%5d (0x%04x): Starting to read factor (string=%s).\n",
457 while (**
p ==
'*' || **
p ==
'/')
478 fprintf (stderr,
"%5d (0x%04x): rd_factor returned %d (%04x).\n",
489 fprintf (stderr,
"%5d (0x%04x): Starting to read term (string=%s).\n",
493 while (**
p ==
'+' || **
p ==
'-')
509 fprintf (stderr,
"%5d (0x%04x): rd_term returned %d (%04x).\n",
520 fprintf (stderr,
"%5d (0x%04x): Starting to read shift expression "
524 while ((**
p ==
'<' || **
p ==
'>') && (*
p)[1] == **
p)
540 fprintf (stderr,
"%5d (0x%04x): rd_shift returned %d (%04x).\n",
551 fprintf (stderr,
"%5d (0x%04x): Starting to read "
556 if (**
p ==
'<' && (*
p)[1] ==
'=')
562 else if (**
p ==
'>' && (*
p)[1] ==
'=')
568 if (**
p ==
'<' && (*
p)[1] !=
'<')
574 else if (**
p ==
'>' && (*
p)[1] !=
'>')
581 fprintf (stderr,
"%5d (0x%04x): rd_shift returned %d (%04x).\n",
592 fprintf (stderr,
"%5d (0x%04x): Starting to read equality epression "
604 else if (**
p ==
'!' && (*
p)[1] ==
'=')
611 fprintf (stderr,
"%5d (0x%04x): rd_equal returned %d (%04x).\n",
622 fprintf (stderr,
"%5d (0x%04x): Starting to read and expression "
633 fprintf (stderr,
"%5d (0x%04x): rd_expr_and returned %d (%04x).\n",
644 fprintf (stderr,
"%5d (0x%04x): Starting to read xor expression "
648 fprintf (stderr,
"%5d (0x%04x): rd_expr_xor: rd_expr_and returned %d "
658 fprintf (stderr,
"%5d (0x%04x): rd_expr_xor returned %d (%04x).\n",
669 fprintf (stderr,
"%5d (0x%04x): Starting to read or expression "
673 fprintf (stderr,
"%5d (0x%04x): rd_expr_or: rd_expr_xor returned %d "
683 fprintf (stderr,
"%5d (0x%04x): rd_expr_or returned %d (%04x).\n",
696 "%5d (0x%04x): Starting to read expression "
698 delimiter ? delimiter :
' ');
700 if (!**
p || **
p == delimiter)
704 else if (print_errors)
705 printerr (1,
"expression expected (not %s)\n", *
p);
731 if (**
p && **
p != delimiter)
735 else if (print_errors)
736 printerr (1,
"junk at end of expression: %s\n", *
p);
740 fprintf (stderr,
"%5d (0x%04x): rd_expr returned %d (%04x).\n",
743 fprintf (stderr,
"%5d (0x%04x): Returning invalid result.\n",
759 printerr (0,
"expression fully enclosed in parenthesis\n");
static RzILOpEffect * cmp(cs_insn *insn, bool is_thumb)
static int rd_factor(const char **p, int *valid, int level, int *check, int print_errors)
static int rd_value(const char **p, int *valid, int level, int *check, int print_errors)
static int rd_expr_unequal(const char **p, int *valid, int level, int *check, int print_errors)
static int rd_number(const char **p, const char **endp, int base)
static int check_label(struct label *labels, const char **p, struct label **ret, struct label **previous, int force_skip)
static int rd_expr_and(const char **p, int *valid, int level, int *check, int print_errors)
static int do_rd_expr(const char **p, char delimiter, int *valid, int level, int *check, int print_errors)
static int rd_expr_or(const char **p, int *valid, int level, int *check, int print_errors)
static int rd_expr_equal(const char **p, int *valid, int level, int *check, int print_errors)
static int rd_expr_xor(const char **p, int *valid, int level, int *check, int print_errors)
static int rd_expr_shift(const char **p, int *valid, int level, int *check, int print_errors)
static int rd_expr(const char **p, char delimiter, int *valid, int level, int print_errors)
static int rd_label(const char **p, int *exists, struct label **previous, int level, int print_errors)
static int rd_otherbasenumber(const char **p, int *valid, int print_errors)
static int rd_character(const char **p, int *valid, int print_errors)
static int rd_term(const char **p, int *valid, int level, int *check, int print_errors)
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
static int compute_ref(struct reference *ref, int allow_invalid)
static const char * delspc(const char *ptr)
static void printerr(int error, const char *fmt,...)