diff options
Diffstat (limited to 'tools/d2c/coder.c')
-rw-r--r-- | tools/d2c/coder.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/d2c/coder.c b/tools/d2c/coder.c index 5856d80..b4bf21f 100644 --- a/tools/d2c/coder.c +++ b/tools/d2c/coder.c @@ -455,6 +455,7 @@ bool dump_all_routines_using_coder(const rented_coder *coder) const string_exch *encoding; /* Type d'encodage visé */ bool exist; /* Présence du fichier visé ? */ int header_fd; /* Fichier de déclarations */ + char *uname; /* Nom en majuscule */ char *dash; /* Présence d'un tiret ? */ char *filename; /* Nom de fichier commun */ int code_fd; /* Fichier de définitions */ @@ -472,8 +473,12 @@ bool dump_all_routines_using_coder(const rented_coder *coder) if (!exist) { - dprintf(header_fd, "#ifndef %s_OPCODES_OPCODES_H\n", coder->header); - dprintf(header_fd, "#define %s_OPCODES_OPCODES_H\n", coder->header); + uname = make_string_upper(strdup(encoding->dest)); + + dprintf(header_fd, "#ifndef %s_%sOPCODES_OPCODES_H\n", coder->header, uname); + dprintf(header_fd, "#define %s_%sOPCODES_OPCODES_H\n", coder->header, uname); + + free(uname); dprintf(header_fd, "\n"); dprintf(header_fd, "\n"); @@ -506,7 +511,7 @@ bool dump_all_routines_using_coder(const rented_coder *coder) if (!exist) { - dprintf(code_fd, "#include \"opcodes.h\"\n"); + dprintf(code_fd, "#include \"%sopcodes.h\"\n", encoding->dest); dprintf(code_fd, "\n"); dprintf(code_fd, "##INCLUDES##\n"); @@ -584,7 +589,8 @@ static bool dump_all_matching_specs_in_coder(const rented_coder *coder, const st /* Désassemblage : déclaration */ dprintf(hfd, "/* Décode une instruction de type '%s'. */\n", coder->ins); - dprintf(hfd, "GArchInstruction *%s_read_instr_%s%s(uint%u_t);\n", coder->arch, keyword, coder->details, wide); + dprintf(hfd, "GArchInstruction *%s_read_%sinstr_%s%s(uint%u_t);\n", + coder->arch, encoding->dest, keyword, coder->details, wide); dprintf(hfd, "\n"); /* Désassemblage : définitions */ @@ -613,7 +619,8 @@ static bool dump_all_matching_specs_in_coder(const rented_coder *coder, const st dprintf(cfd, "\n"); - dprintf(cfd, "GArchInstruction *%s_read_instr_%s%s(uint%u_t raw)", coder->arch, keyword, coder->details, wide); + dprintf(cfd, "GArchInstruction *%s_read_%sinstr_%s%s(uint%u_t raw)", + coder->arch, encoding->dest, keyword, coder->details, wide); dprintf(cfd, "\n"); dprintf(cfd, "{"); dprintf(cfd, "\n"); @@ -631,7 +638,8 @@ static bool dump_all_matching_specs_in_coder(const rented_coder *coder, const st if (!has_encoding_spec_prefix(spec, encoding->src)) continue; - result = write_encoding_spec_disass(spec, cfd, coder->arch, coder->ins, coder->details, wide, coder->pp); + result = write_encoding_spec_disass(spec, cfd, coder->arch, encoding->dest, + coder->ins, coder->details, wide, coder->pp); } |