summaryrefslogtreecommitdiff
path: root/tools/d2c/rules.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-01-24 11:19:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-01-24 11:19:32 (GMT)
commit141d2f0fbb2ce3b4ddf85383c55b891fd59dc598 (patch)
tree085fa1a20d77f86825e1a6f4215b1ffd8fd961e8 /tools/d2c/rules.h
parent3df9f6dc8548b0562312036abfbfcf9850a81041 (diff)
Introduced conditional calls in instruction definition rules.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@459 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'tools/d2c/rules.h')
-rw-r--r--tools/d2c/rules.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/tools/d2c/rules.h b/tools/d2c/rules.h
index af2cac5..6344828 100644
--- a/tools/d2c/rules.h
+++ b/tools/d2c/rules.h
@@ -25,7 +25,10 @@
#define _TOOLS_RULES_H
+#include "args.h"
#include "bits.h"
+#include "conv.h"
+#include "pproc.h"
@@ -67,10 +70,33 @@ cond_expr *build_composed_cond_expression(cond_expr *, CondOpType, cond_expr *);
typedef enum _CondActionType
{
CAT_SEE, /* Renvoi vers une instruction */
- CAT_UNPREDICTABLE /* Cas de figure improbable */
+ CAT_UNPREDICTABLE, /* Cas de figure improbable */
+ CAT_CALL /* Appel à une fonction C */
} CondActionType;
+/* Définition d'une action de règle */
+typedef struct _rule_action
+{
+ CondActionType type; /* Conséquence d'une validation*/
+
+ union
+ {
+ /* CAT_SEE */
+ char *details; /* Eventuel complément d'info. */
+
+ /* CAT_CALL */
+ struct
+ {
+ char *callee; /* Fonction appelée */
+ arg_list_t *args; /* Arguments à fournir */
+
+ };
+
+ };
+
+} rule_action;
+
/* Règles de décodage supplémentaires */
typedef struct _decoding_rules decoding_rules;
@@ -82,10 +108,10 @@ decoding_rules *create_decoding_rules(void);
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 *);
+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 *, int, const char *, const char *, const coding_bits *, bool *);
+bool write_decoding_rules(decoding_rules *, CondActionType, int, const char *, const char *, const coding_bits *, const conv_list *, const pre_processor *, bool *);