diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/d2c/d2c_gram.y | 6 | ||||
-rw-r--r-- | tools/d2c/d2c_tok.l | 3 | ||||
-rw-r--r-- | tools/d2c/spec.c | 6 |
3 files changed, 8 insertions, 7 deletions
diff --git a/tools/d2c/d2c_gram.y b/tools/d2c/d2c_gram.y index 7195e21..1c25b17 100644 --- a/tools/d2c/d2c_gram.y +++ b/tools/d2c/d2c_gram.y @@ -133,7 +133,7 @@ struct action_tmp %token INS_NAME INS_DETAILS %token ENCODING -%token THUMB ARCH NUMBER +%token TYPE NUMBER %token ENC_START ENC_END %token WORD HALF NAME SIZE BIT @@ -148,6 +148,7 @@ struct action_tmp %type <string> COPYRIGHT INS_NAME %type <cstring> INS_DETAILS +%type <string> TYPE %type <integer> NUMBER %type <string> NAME @@ -182,8 +183,7 @@ name : COPYRIGHT TITLE INS_NAME { save_notes_for_coder(coder, $1, $3 encodings : /* empty */ | encoding encodings -encoding : ENCODING THUMB NUMBER content { push_encoding_spec(coder, strdup("t"), $3); } - | ENCODING ARCH NUMBER content { push_encoding_spec(coder, strdup("a"), $3); } +encoding : ENCODING TYPE NUMBER content { push_encoding_spec(coder, $2, $3); } content : /* empty */ diff --git a/tools/d2c/d2c_tok.l b/tools/d2c/d2c_tok.l index 4d31783..e40f10d 100644 --- a/tools/d2c/d2c_tok.l +++ b/tools/d2c/d2c_tok.l @@ -65,8 +65,7 @@ void free_flex_memory(void) ; <encoding>[ ] { } <encoding>"(" { BEGIN(encoding_type); } -<encoding_type>"T" { return THUMB; } -<encoding_type>"A" { return ARCH; } +<encoding_type>[A-Za-z] { d2c_lval.string = strdup(yytext); return TYPE; } <encoding_type>[0-9] { d2c_lval.integer = atoi(yytext); return NUMBER; } <encoding_type>")" { BEGIN(encoding); } diff --git a/tools/d2c/spec.c b/tools/d2c/spec.c index a957587..675fd05 100644 --- a/tools/d2c/spec.c +++ b/tools/d2c/spec.c @@ -53,6 +53,7 @@ struct _encoding_spec { char *prefix; /* Distinction principale */ + char *lprefix; /* Distinction en minuscules */ unsigned int index; /* Distinction secondaire */ coding_bits *bits; /* Encodage des bits associƩs */ @@ -138,6 +139,7 @@ void delete_encoding_spec(encoding_spec *spec) void define_encoding_spec_code_name(encoding_spec *spec, char *prefix, unsigned int index) { spec->prefix = prefix; + spec->lprefix = make_string_lower(strdup(prefix)); spec->index = index; } @@ -269,7 +271,7 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a keyword = make_callable(ins, false); dprintf(fd, "\tGArchInstruction *%s_decode_%s%s_%s%u(uint%u_t _raw)\n", - arch, keyword, details, spec->prefix, spec->index, wide); + arch, keyword, details, spec->lprefix, spec->index, wide); dprintf(fd, "\t{\n"); @@ -338,7 +340,7 @@ bool write_encoding_spec_disass(const encoding_spec *spec, int fd, const char *a dprintf(fd, "\tif (result == NULL)\n"); dprintf(fd, "\t\tresult = %s_decode_%s%s_%s%u(raw);\n", - arch, keyword, details, spec->prefix, spec->index); + arch, keyword, details, spec->lprefix, spec->index); dprintf(fd, "\n"); |