summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-12-02 21:51:13 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-12-02 21:51:13 (GMT)
commitc72f4d81bff9d6b8fa2317823a86742cb59e0544 (patch)
treedfa7dd5578eb5c347a6930c6578a5c7f27d2b2d5 /tools
parent5b5b36dc862a3c7bcfa3e0db74efcf2806988706 (diff)
Extended the compiler by allowing more than one type of Thumb.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@431 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'tools')
-rw-r--r--tools/d2c/d2c_gram.y6
-rw-r--r--tools/d2c/d2c_tok.l3
-rw-r--r--tools/d2c/spec.c6
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");