summaryrefslogtreecommitdiff
path: root/tools/d2c/rules.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/rules.h')
-rw-r--r--tools/d2c/rules.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/tools/d2c/rules.h b/tools/d2c/rules.h
new file mode 100644
index 0000000..a4a9bb4
--- /dev/null
+++ b/tools/d2c/rules.h
@@ -0,0 +1,91 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * rules.h - prototypes pour les variations de décodage selon certaines conditions
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _TOOLS_RULES_H
+#define _TOOLS_RULES_H
+
+
+#include "bits.h"
+
+
+
+/* -------------------------- CONDITIONS DE DECLENCHEMENTS -------------------------- */
+
+
+/* Types de comparaison */
+typedef enum _CondCompType
+{
+ CCT_EQUAL, /* Egalité '==' */
+ CCT_DIFF /* Différence '!=' */
+
+} CondCompType;
+
+/* Types de combinaison d'expressions */
+typedef enum _CondOpType
+{
+ COT_AND, /* Combinaison ET ('&&') */
+ COT_OR /* Combinaison OU ('||') */
+
+} CondOpType;
+
+/* Expression d'une condition */
+typedef struct _cond_expr cond_expr;
+
+
+/* Crée une expression conditionnelle simple. */
+cond_expr *build_simple_cond_expression(char *, CondCompType, char *);
+
+/* Crée une expression conditionnelle composée. */
+cond_expr *build_composed_cond_expression(cond_expr *, CondOpType, cond_expr *);
+
+
+
+/* ------------------------- REGLES ET ACTIONS CONSEQUENTES ------------------------- */
+
+
+/* Conséquence en cas de condition remplie */
+typedef enum _CondActionType
+{
+ CAT_SEE /* Renvoi vers une instruction */
+
+} CondActionType;
+
+/* Règles de décodage supplémentaires */
+typedef struct _decoding_rules decoding_rules;
+
+
+/* Crée un nouveau rassemblement de règles de décodage. */
+decoding_rules *create_decoding_rules(void);
+
+/* Supprime de la mémoire un ensemble de règles supplémentaires. */
+void delete_decoding_rules(decoding_rules *);
+
+/* Ajoute une règle complète à la définition d'un codage. */
+void register_conditional_rule(decoding_rules *, cond_expr *, CondActionType, const char *);
+
+/* Traduit en code les éventuelles règles présentes. */
+bool write_decoding_rules(decoding_rules *, int, const coding_bits *, bool *);
+
+
+
+#endif /* _TOOLS_RULES_H */