diff --git a/.gitignore b/.gitignore index 1e60eda0..f0e2480e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin build *~ +.vs diff --git a/thecl/ecsparse.y b/thecl/ecsparse.y index 3a1cad67..1807e1a4 100644 --- a/thecl/ecsparse.y +++ b/thecl/ecsparse.y @@ -1199,7 +1199,7 @@ instr_set_types( if (new_type != param->type && !(param->type == 'z' && (new_type == 'm' || new_type == 'x')) && - !(param->type == 'S' && new_type == 's')) { + !(param->type == 'S' && (new_type == 's' || new_type == 'U'))) { char errbuf[256]; snprintf(errbuf, 256, "instr_set_types: in sub %s: wrong argument " diff --git a/thecl/thecl10.c b/thecl/thecl10.c index e057d6c9..75c663af 100644 --- a/thecl/thecl10.c +++ b/thecl/thecl10.c @@ -527,7 +527,7 @@ static const id_format_pair_t th12_fmts[] = { { 424, "S" }, { 425, "" }, { 426, "f" }, - { 427, "SfC" }, + { 427, "SfU" }, { 428, "SSSx" }, { 429, "ffff" }, { 430, "ffffff" }, @@ -583,7 +583,7 @@ static const id_format_pair_t th12_fmts[] = { { 523, "Sff" }, { 524, "Sf" }, { 525, "Sff" }, - { 526, "fC" }, + { 526, "fU" }, { 527, "" }, { 528, "" }, { 529, "S" }, diff --git a/util/value.c b/util/value.c index e7e67c56..7ac6debd 100644 --- a/util/value.c +++ b/util/value.c @@ -80,7 +80,7 @@ value_from_data( case 'S': READ(S, sizeof(int32_t)); case 'C': - READ(C, sizeof(int32_t)); + READ(C, sizeof(uint32_t)); break; case 'z': value->val.z = malloc(data_length); @@ -196,6 +196,13 @@ value_from_text( case 'S': READ(d, value->val.S); break; + case 'C': + if (sscanf(text, "#%02hhx%02hhx%02hhx%02hhx", &value->val.C[0], &value->val.C[1], &value->val.C[2], &value->val.C[3]) != 4) { + fprintf(stderr, "%s:value_from_text: couldn't parse '%c' from \"%s\"\n", argv0, value->type, text); + return 0; + } + READ(u, value->val.C); + break; case 'z': value->val.z = strdup(text); break; @@ -299,6 +306,8 @@ value_to_data( WRITE(U, sizeof(uint32_t)); case 'S': WRITE(S, sizeof(int32_t)); + case 'C': + WRITE(C, sizeof(uint32_t)); case 'z': { size_t zlen = strlen(value->val.z); if (data_length < zlen) { @@ -344,6 +353,8 @@ value_size( return sizeof(uint32_t); case 'S': return sizeof(int32_t); + case 'C': + return sizeof(uint32_t); case 'z': return strlen(value->val.z); case 'm':