summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/d2c/coder.c4
-rw-r--r--tools/d2c/coder.h1
-rw-r--r--tools/d2c/d2c.c10
3 files changed, 11 insertions, 4 deletions
diff --git a/tools/d2c/coder.c b/tools/d2c/coder.c
index a8b6fa9..be68cc5 100644
--- a/tools/d2c/coder.c
+++ b/tools/d2c/coder.c
@@ -1101,7 +1101,7 @@ static bool output_coder_raw(const rented_coder *coder, const output_info *info,
/* Désassemblage : déclaration */
- if (0 /* TODO : export seulement */)
+ if (info->export)
{
dprintf(hfd, "/* Décode une forme d'instruction de type '%s'. */\n", coder->ins);
@@ -1141,7 +1141,7 @@ static bool output_coder_raw(const rented_coder *coder, const output_info *info,
dprintf(cfd, "\n");
- if (1 /* TODO : si pas exportée */)
+ if (!info->export)
dprintf(cfd, "static ");
dprintf(cfd, "GArchInstruction *");
diff --git a/tools/d2c/coder.h b/tools/d2c/coder.h
index 1b4c0c5..a17d5ad 100644
--- a/tools/d2c/coder.h
+++ b/tools/d2c/coder.h
@@ -118,6 +118,7 @@ typedef struct _output_info
const char *id_prefix; /* Préfixe pour les constantes */
int id_len; /* Largeur des identifiants */
+ bool export; /* Exportation dans les entêtes*/
size_t filename_reuse; /* Taille d'une extention */
} output_info;
diff --git a/tools/d2c/d2c.c b/tools/d2c/d2c.c
index fddee6a..fbf401e 100644
--- a/tools/d2c/d2c.c
+++ b/tools/d2c/d2c.c
@@ -93,7 +93,8 @@ static void show_usage(const char *argv0)
printf("\n");
- printf("\t--filename-reuse <length>\t\tSet the length of filename to include in identifiers (default = 0).\n");
+ printf("\t--export\t\t\tDefine if read functions have to be exported to external headers (not by default).\n");
+ printf("\t--filename-reuse <length>\tSet the length of filename to include in identifiers (default = 0).\n");
printf("\n");
@@ -153,7 +154,8 @@ int main(int argc, char **argv)
{ "id-prefix", required_argument, NULL, 0x100 },
{ "id-expected", required_argument, NULL, 0x101 },
- { "filename-reuse", required_argument, NULL, 0x200 },
+ { "export", no_argument, NULL, 0x200 },
+ { "filename-reuse", required_argument, NULL, 0x201 },
{ "op-prefix", required_argument, NULL, 0x300 },
@@ -254,6 +256,10 @@ int main(int argc, char **argv)
break;
case 0x200:
+ info.export = true;
+ break;
+
+ case 0x201:
info.filename_reuse = strtoul(optarg, NULL, 10);
break;