diff options
Diffstat (limited to 'tools/d2c/syntax.c')
-rw-r--r-- | tools/d2c/syntax.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tools/d2c/syntax.c b/tools/d2c/syntax.c index a38fdbb..dcac28e 100644 --- a/tools/d2c/syntax.c +++ b/tools/d2c/syntax.c @@ -32,6 +32,7 @@ /* Mémorisation d'une définition de syntaxe */ struct _encoding_syntax { + instr_id *subid; /* Gestionnaire d'identifiant */ disass_assert *assertions; /* Conditions de désassemblage */ conv_list *conversions; /* Conversions des données */ asm_pattern *pattern; /* Calligraphe d'assemblage */ @@ -59,6 +60,7 @@ encoding_syntax *create_encoding_syntax(void) result = (encoding_syntax *)calloc(1, sizeof(encoding_syntax)); + result->subid = create_instruction_id(); result->assertions = create_disass_assert(); result->conversions = create_conv_list(); result->pattern = create_asm_pattern(); @@ -83,6 +85,7 @@ encoding_syntax *create_encoding_syntax(void) void delete_encoding_syntax(encoding_syntax *syntax) { + delete_instruction_id(syntax->subid); delete_disass_assert(syntax->assertions); delete_conv_list(syntax->conversions); delete_asm_pattern(syntax->pattern); @@ -97,6 +100,25 @@ void delete_encoding_syntax(encoding_syntax *syntax) * * * Paramètres : syntax = définition de syntaxe à consulter. * * * +* Description : Fournit le gestionnaire des définitions d'identifiant. * +* * +* Retour : Structure assurant la définition d'identifiant. * +* * +* Remarques : - * +* * +******************************************************************************/ + +instr_id *get_encoding_syntax_subid(const encoding_syntax *syntax) +{ + return syntax->subid; + +} + + +/****************************************************************************** +* * +* Paramètres : syntax = définition de syntaxe à consulter. * +* * * Description : Fournit la liste de conditions préalables. * * * * Retour : Structure assurant la gestion de conditions de désassemblage.* @@ -235,6 +257,9 @@ bool declare_encoding_syntax(const encoding_syntax *syntax, int fd, const coding * bits = gestionnaire des bits d'encodage. * * alone = peut-on se placer en zone principale ? * * pp = pré-processeur pour les échanges de chaînes. * +* id = identifiant unique attribué à l'instruction. * +* sid = base d'identifiant unique attribué à l'encodage. * +* index = indice de la syntaxe dans l'encodage. * * exit = exprime le besoin d'une voie de sortie. [OUT] * * * * Description : Amorce la construction des éléments d'une syntaxe. * @@ -245,7 +270,7 @@ bool declare_encoding_syntax(const encoding_syntax *syntax, int fd, const coding * * ******************************************************************************/ -bool write_encoding_syntax(const encoding_syntax *syntax, int fd, const char *arch, const coding_bits *bits, bool alone, bool *exit) +bool write_encoding_syntax(const encoding_syntax *syntax, int fd, const char *arch, const coding_bits *bits, bool alone, const char *id, const char *sid, size_t index, bool *exit) { bool result; /* Bilan à retourner */ bool conditional; /* Définition sous condition ? */ @@ -290,8 +315,10 @@ bool write_encoding_syntax(const encoding_syntax *syntax, int fd, const char *ar dprintf(fd, "\n"); } - dprintf(fd, "\t%sresult = g_%s_instruction_new(\"%s\");\n", - tab, arch, get_keyword_from_asm_pattern(syntax->pattern)); + if (alone) + dprintf(fd, "\t%sresult = g_%s_instruction_new(%s, %s);\n", tab, arch, id, sid); + else + dprintf(fd, "\t%sresult = g_%s_instruction_new(%s, %s_%zu);\n", tab, arch, id, sid, index); dprintf(fd, "\n"); |