summaryrefslogtreecommitdiff
path: root/tools/d2c/rules
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/rules
parenta5758a42acdfaf0ac20c4cfb9cf162a9b4440e39 (diff)
Handled hooks and rules in Dalvik opcodes definitions.
Diffstat (limited to 'tools/d2c/rules')
-rw-r--r--tools/d2c/rules/manager.c33
-rw-r--r--tools/d2c/rules/manager.h2
2 files changed, 27 insertions, 8 deletions
diff --git a/tools/d2c/rules/manager.c b/tools/d2c/rules/manager.c
index f30559e..6c1f069 100644
--- a/tools/d2c/rules/manager.c
+++ b/tools/d2c/rules/manager.c
@@ -404,6 +404,7 @@ void register_conditional_rule(decoding_rules *rules, cond_expr *expr, const rul
/******************************************************************************
* *
* Paramètres : rules = ensemble de règles à consulter. *
+* top = indique si l'écriture se fait au plus haut niveau. *
* filter = filtre sur les règles à effectivement imprimer. *
* fd = descripteur d'un flux ouvert en écriture. *
* arch = architecture visée par l'opération. *
@@ -421,7 +422,7 @@ void register_conditional_rule(decoding_rules *rules, cond_expr *expr, const rul
* *
******************************************************************************/
-bool write_decoding_rules(decoding_rules *rules, CondActionType filter, int fd, const char *arch, const char *subarch, const coding_bits *bits, const conv_list *list, const pre_processor *pp, bool *exit)
+bool write_decoding_rules(decoding_rules *rules, bool top, CondActionType filter, int fd, const char *arch, const char *subarch, const coding_bits *bits, const conv_list *list, const pre_processor *pp, bool *exit)
{
bool result; /* Bilan à remonter */
size_t i; /* Boucle de parcours */
@@ -452,7 +453,10 @@ bool write_decoding_rules(decoding_rules *rules, CondActionType filter, int fd,
if (rule->expr != NULL)
{
- dprintf(fd, "\t\tif ");
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\tif ");
result = write_cond_expr(rule->expr, fd, bits);
if (!result) break;
@@ -460,7 +464,13 @@ bool write_decoding_rules(decoding_rules *rules, CondActionType filter, int fd,
dprintf(fd, "\n");
if (multi_lines)
- dprintf(fd, "\t\t{\n");
+ {
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\t{\n");
+
+ }
}
@@ -493,7 +503,7 @@ bool write_decoding_rules(decoding_rules *rules, CondActionType filter, int fd,
if (rule->expr != NULL)
dprintf(fd, "\t");
- result = call_instr_func(callable, rule->action.args, fd, bits, list, pp);
+ result = call_instr_func(top, callable, rule->action.args, fd, bits, list, pp);
break;
@@ -507,12 +517,15 @@ bool write_decoding_rules(decoding_rules *rules, CondActionType filter, int fd,
if (rule->expr != NULL)
dprintf(fd, "\t");
- result = checked_call_instr_func(callable, rule->action.args, fd, bits, list, pp);
+ result = checked_call_instr_func(top, callable, rule->action.args, fd, bits, list, pp);
if (rule->expr != NULL)
dprintf(fd, "\t");
- dprintf(fd, "\t\t\tgoto quick_exit;\n");
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\t\tgoto quick_exit;\n");
*exit = true;
break;
@@ -520,7 +533,13 @@ bool write_decoding_rules(decoding_rules *rules, CondActionType filter, int fd,
}
if (rule->expr != NULL && multi_lines)
- dprintf(fd, "\t\t}\n");
+ {
+ if (!top)
+ dprintf(fd, "\t");
+
+ dprintf(fd, "\t}\n");
+
+ }
dprintf(fd, "\n");
diff --git a/tools/d2c/rules/manager.h b/tools/d2c/rules/manager.h
index f8ff2d6..7106c32 100644
--- a/tools/d2c/rules/manager.h
+++ b/tools/d2c/rules/manager.h
@@ -113,7 +113,7 @@ void delete_decoding_rules(decoding_rules *);
void register_conditional_rule(decoding_rules *, cond_expr *, const rule_action *);
/* Traduit en code les éventuelles règles présentes. */
-bool write_decoding_rules(decoding_rules *, CondActionType, int, const char *, const char *, const coding_bits *, const conv_list *, const pre_processor *, bool *);
+bool write_decoding_rules(decoding_rules *, bool, CondActionType, int, const char *, const char *, const coding_bits *, const conv_list *, const pre_processor *, bool *);