summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/d2c/coder.c18
-rw-r--r--tools/d2c/coder.h3
-rw-r--r--tools/d2c/d2c.c7
3 files changed, 16 insertions, 12 deletions
diff --git a/tools/d2c/coder.c b/tools/d2c/coder.c
index 9066869..61527bf 100644
--- a/tools/d2c/coder.c
+++ b/tools/d2c/coder.c
@@ -888,7 +888,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info)
if (!has_encoding_spec_prefix(coder->specs[j], enc_name->src))
continue;
- header_fd = open_header_file(info->directory, enc_name->dest, "opcodes", &header_new);
+ header_fd = open_header_file(info->opcodes_dir, enc_name->dest, "opcodes", &header_new);
if (header_fd == -1)
{
result = false;
@@ -910,7 +910,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info)
}
- code_fd = open_code_file(coder, info->directory, enc_name->dest, &code_new);
+ code_fd = open_code_file(coder, info->opcodes_dir, enc_name->dest, &code_new);
if (code_fd == -1)
{
result = false;
@@ -965,7 +965,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info)
if (!has_encoding_spec_prefix(coder->specs[j], enc_name->src))
continue;
- header_fd = open_header_file(info->directory, enc_name->dest, "opcodes", &header_new);
+ header_fd = open_header_file(info->opcodes_dir, enc_name->dest, "opcodes", &header_new);
if (header_fd == -1)
{
result = false;
@@ -974,7 +974,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info)
assert(!header_new);
- code_fd = open_code_file(coder, info->directory, enc_name->dest, &code_new);
+ code_fd = open_code_file(coder, info->opcodes_dir, enc_name->dest, &code_new);
if (code_fd == -1)
{
result = false;
@@ -1513,7 +1513,7 @@ bool output_coder_identifier(const rented_coder *coder, const output_info *info)
/* Ouverture de la destination */
- fd = open_header_file(info->directory, NULL, "identifiers", &created);
+ fd = open_header_file(info->opcodes_dir, NULL, "identifiers", &created);
if (fd == -1) goto oci_exit;
if (created)
@@ -1658,7 +1658,7 @@ bool output_coder_sub_identifier(const rented_coder *coder, const output_info *i
/* Ouverture de la destination */
- fd = open_header_file(info->directory, NULL, "subidentifiers", &created);
+ fd = open_header_file(info->opcodes_dir, NULL, "subidentifiers", &created);
if (fd == -1) goto ocsi_exit;
if (created)
@@ -1823,7 +1823,7 @@ bool output_coder_keyword(const rented_coder *coder, const output_info *info)
/* Ouverture de la destination */
- fd = open_header_file(info->directory, NULL, "keywords", &created);
+ fd = open_header_file(info->opcodes_dir, NULL, "keywords", &created);
if (fd == -1) goto ock_exit;
if (created)
@@ -2017,7 +2017,7 @@ bool output_coder_hooks(const rented_coder *coder, const output_info *info)
/* Ouverture de la destination */
- fd = open_header_file(info->directory, NULL, "hooks", &created);
+ fd = open_header_file(info->opcodes_dir, NULL, "hooks", &created);
if (fd == -1) goto och_exit;
if (created)
@@ -2179,7 +2179,7 @@ bool output_coder_description(const rented_coder *coder, const output_info *info
/* Ouverture de la destination */
- fd = open_header_file(info->directory, NULL, "descriptions", &created);
+ fd = open_header_file(info->opcodes_dir, NULL, "descriptions", &created);
if (fd == -1) goto ocd_exit;
if (created)
diff --git a/tools/d2c/coder.h b/tools/d2c/coder.h
index 143b969..2164097 100644
--- a/tools/d2c/coder.h
+++ b/tools/d2c/coder.h
@@ -106,7 +106,8 @@ typedef enum _InputOutputType
/* Regroupement des informations utiles à la génération */
typedef struct _output_info
{
- const char *directory; /* Répertoire de destination */
+ char *opcodes_dir; /* Répertoire pour les opcodes */
+
InputOutputType type; /* Type des définitions (E/S) */
const char *arch; /* Architecture à traiter */
const char *arch_cn; /* Nom de code de l'archi. */
diff --git a/tools/d2c/d2c.c b/tools/d2c/d2c.c
index 9cb2df4..fddee6a 100644
--- a/tools/d2c/d2c.c
+++ b/tools/d2c/d2c.c
@@ -196,7 +196,7 @@ int main(int argc, char **argv)
break;
case 'o':
- info.directory = optarg;
+ asprintf(&info.opcodes_dir, "%sopcodes%c", optarg, optarg[strlen(optarg) - 1]);
break;
case 't':
@@ -274,7 +274,7 @@ int main(int argc, char **argv)
if (execute == ADC_NONE)
has_error = true;
- if (info.directory == NULL || info.arch == NULL || info.arch_cn == NULL || info.guard == NULL)
+ if (info.opcodes_dir == NULL || info.arch == NULL || info.arch_cn == NULL || info.guard == NULL)
has_error = true;
if (need_help || has_error || (optind + 1) != argc)
@@ -372,6 +372,9 @@ int main(int argc, char **argv)
exit:
+ if (info.opcodes_dir != NULL)
+ free(info.opcodes_dir);
+
return result;
}