summaryrefslogtreecommitdiff
path: root/tools/d2c/encoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/d2c/encoding.c')
-rw-r--r--tools/d2c/encoding.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/tools/d2c/encoding.c b/tools/d2c/encoding.c
index 052fc04..3f0ec64 100644
--- a/tools/d2c/encoding.c
+++ b/tools/d2c/encoding.c
@@ -325,37 +325,13 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
bool openbar; /* Syntaxe unique par défaut ? */
disass_assert *dassert; /* Eventuelles conditions */
size_t i; /* Boucle de parcours */
-
-
-
-
-
-
bool op_decl; /* Suivi des déclaration #1 */
bool imm_decl; /* Suivi des déclaration #2 */
-
bool bad_exit; /* Ajout d'une sortie d'échec ?*/
bool quick_exit; /* Inclusion de sortie rapide ?*/
-
-
-
char *encoding_fc; /* Spécification d'encodage */
char *cast; /* Conversion vers le format */
-
-
- /***************
- *
- *
- * REAL ONE
- *
- *
- *
- **********************/
-
-
-
-
result = true;
/* Détermination de la forme du code */
@@ -418,6 +394,14 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
dprintf(fd, "\n");
+ /* Initialisation du resultat d'un point de vue global */
+
+ if (!openbar)
+ {
+ dprintf(fd, "\tresult = NULL;\n");
+ dprintf(fd, "\n");
+ }
+
/* Définition des champs bruts */
result = define_used_bits_fields(spec->bits, fd);
@@ -435,7 +419,10 @@ bool write_encoding_spec_raw_disass(const encoding_spec *spec, int fd, const cha
cast = build_cast_if_needed(encoding_fc);
- dprintf(fd, "\t%s(%s(result), \"%s\");\n", encoding_fc, cast, spec->prefix);
+ if (!openbar)
+ dprintf(fd, "\tif (result != NULL)\n");
+
+ dprintf(fd, "\t%s%s(%s(result), \"%s\");\n", openbar ? "" : "\t", encoding_fc, cast, spec->prefix);
free(cast);