summaryrefslogtreecommitdiff
path: root/tools/d2c/qckcall.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-04-24 18:43:54 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-04-24 18:43:54 (GMT)
commit9d04b66153bd0b354c0fb5c097b9face61a649db (patch)
tree54a507c720287597e7a70808e64ad36b37ed41b8 /tools/d2c/qckcall.c
parenta5758a42acdfaf0ac20c4cfb9cf162a9b4440e39 (diff)
Handled hooks and rules in Dalvik opcodes definitions.
Diffstat (limited to 'tools/d2c/qckcall.c')
-rw-r--r--tools/d2c/qckcall.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/tools/d2c/qckcall.c b/tools/d2c/qckcall.c
index e2e87d2..aa066c4 100644
--- a/tools/d2c/qckcall.c
+++ b/tools/d2c/qckcall.c
@@ -101,7 +101,8 @@ static char *build_cast_if_needed(const char *callee)
/******************************************************************************
* *
-* Paramètres : callee = fonction appelée à nommer. *
+* Paramètres : top = indique si l'écriture se fait au plus haut niveau. *
+* callee = fonction appelée à nommer. *
* args = précise si la conversion est la dernière. *
* fd = descripteur d'un flux ouvert en écriture. *
* bits = gestionnaire des bits d'encodage. *
@@ -116,7 +117,7 @@ static char *build_cast_if_needed(const char *callee)
* *
******************************************************************************/
-bool call_instr_func(const char *callee, const arg_list_t *args, int fd, const coding_bits *bits, const conv_list *list, const pre_processor *pp)
+bool call_instr_func(bool top, const char *callee, const arg_list_t *args, int fd, const coding_bits *bits, const conv_list *list, const pre_processor *pp)
{
bool result; /* Bilan à remonter */
char *cast; /* Macro de transtypage */
@@ -124,12 +125,21 @@ bool call_instr_func(const char *callee, const arg_list_t *args, int fd, const c
cast = build_cast_if_needed(callee);
if (cast == NULL)
- dprintf(fd, "\t\t%s(instr, ", callee);
+ {
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\t%s(%s, ", callee, top ? "result" : "instr");
+ }
else
{
- dprintf(fd, "\t\t%s(%s(instr), ", callee, cast);
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\t%s(%s(%s), ", callee, cast, top ? "result" : "instr");
free(cast);
+
}
result = define_arg_list(args, fd, bits, list);
@@ -143,7 +153,8 @@ bool call_instr_func(const char *callee, const arg_list_t *args, int fd, const c
/******************************************************************************
* *
-* Paramètres : callee = fonction appelée à nommer. *
+* Paramètres : top = indique si l'écriture se fait au plus haut niveau. *
+* callee = fonction appelée à nommer. *
* args = précise si la conversion est la dernière. *
* fd = descripteur d'un flux ouvert en écriture. *
* bits = gestionnaire des bits d'encodage. *
@@ -158,7 +169,7 @@ bool call_instr_func(const char *callee, const arg_list_t *args, int fd, const c
* *
******************************************************************************/
-bool checked_call_instr_func(const char *callee, const arg_list_t *args, int fd, const coding_bits *bits, const conv_list *list, const pre_processor *pp)
+bool checked_call_instr_func(bool top, const char *callee, const arg_list_t *args, int fd, const coding_bits *bits, const conv_list *list, const pre_processor *pp)
{
bool result; /* Bilan à remonter */
char *cast; /* Macro de transtypage */
@@ -166,12 +177,21 @@ bool checked_call_instr_func(const char *callee, const arg_list_t *args, int fd,
cast = build_cast_if_needed(callee);
if (cast == NULL)
- dprintf(fd, "\t\tif (!%s(instr, ", callee);
+ {
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\tif (!%s(%s, ", callee, top ? "result" : "instr");
+ }
else
{
- dprintf(fd, "\t\tif (!%s(%s(instr), ", callee, cast);
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\tif (!%s(%s(%s), ", callee, cast, top ? "result" : "instr");
free(cast);
+
}
result = define_arg_list(args, fd, bits, list);