summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/d2c/Makefile.am3
-rw-r--r--tools/d2c/qckcall.c7
-rw-r--r--tools/d2c/qckcall.h3
-rw-r--r--tools/d2c/spec.c18
4 files changed, 24 insertions, 7 deletions
diff --git a/tools/d2c/Makefile.am b/tools/d2c/Makefile.am
index d876ab1..53904be 100644
--- a/tools/d2c/Makefile.am
+++ b/tools/d2c/Makefile.am
@@ -30,6 +30,9 @@ d2c_SOURCES = \
qckcall.h qckcall.c \
spec.h spec.c
+# _GNU_SOURCE : asprintf
+d2c_CFLAGS = -D_GNU_SOURCE
+
d2c_LDADD = \
bits/libd2cbits.la \
conv/libd2cconv.la \
diff --git a/tools/d2c/qckcall.c b/tools/d2c/qckcall.c
index aa066c4..34c810e 100644
--- a/tools/d2c/qckcall.c
+++ b/tools/d2c/qckcall.c
@@ -34,11 +34,6 @@
-/* Prépare au besoin la définition d'une macro de transtypage. */
-static char *build_cast_if_needed(const char *);
-
-
-
/******************************************************************************
* *
* Paramètres : callee = fonction appelée à nommer. *
@@ -51,7 +46,7 @@ static char *build_cast_if_needed(const char *);
* *
******************************************************************************/
-static char *build_cast_if_needed(const char *callee)
+char *build_cast_if_needed(const char *callee)
{
char *result; /* Macro à retourner */
regex_t preg; /* Expression régulière */
diff --git a/tools/d2c/qckcall.h b/tools/d2c/qckcall.h
index 0b9ac29..0c8fcf6 100644
--- a/tools/d2c/qckcall.h
+++ b/tools/d2c/qckcall.h
@@ -35,6 +35,9 @@
+/* Prépare au besoin la définition d'une macro de transtypage. */
+char *build_cast_if_needed(const char *);
+
/* Réalise un appel à une fonction liée à une instruction. */
bool call_instr_func(bool, const char *, const arg_list_t *, int, const coding_bits *, const conv_list *, const pre_processor *);
diff --git a/tools/d2c/spec.c b/tools/d2c/spec.c
index 5aa7066..e6f65df 100644
--- a/tools/d2c/spec.c
+++ b/tools/d2c/spec.c
@@ -26,10 +26,12 @@
#include <malloc.h>
#include <regex.h>
+#include <stdio.h>
#include <string.h>
#include "helpers.h"
+#include "qckcall.h"
@@ -304,6 +306,8 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a
char *keyword; /* Mot clef appelable en code */
bool quick_exit; /* Inclusion de sortie rapide ?*/
const char *new_ins; /* Nouvelle définition de nom */
+ char *encoding_fc; /* Spécification d'encodage */
+ char *cast; /* Conversion vers le format */
result = true;
@@ -386,7 +390,19 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a
dprintf(fd, "\n");
}
- dprintf(fd, "\t\tg_arch_instruction_set_encoding(instr, \"%s\");\n", spec->prefix);
+ /* Encodage en dernier lieu */
+
+ asprintf(&encoding_fc, "g_%s_instruction_set_encoding", arch);
+
+ cast = build_cast_if_needed(encoding_fc);
+
+ dprintf(fd, "\t\t%s(%s(instr), \"%s\");\n", encoding_fc, cast, spec->prefix);
+
+ free(cast);
+
+ free(encoding_fc);
+
+ /* Conclusion globale */
dprintf(fd, "\n");