[INTERPRETER]

* BUG: Fix support for Single constants.


git-svn-id: svn://localhost/gambas/trunk@4370 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2011-12-30 20:49:54 +00:00
parent 7016a68336
commit 759aa3ba69
4 changed files with 9 additions and 1 deletions

View file

@ -64,6 +64,7 @@ typedef
union {
int type;
struct { int type; double value; } PACKED _float;
struct { int type; float value; } PACKED _single;
struct { int type; int value; } PACKED _integer;
struct { int type; int64_t value; } PACKED _long;
struct { int type; char *addr; int len; } PACKED _string;

View file

@ -138,6 +138,7 @@ typedef
union {
int _integer;
double _float;
float _single;
char *_string;
int64_t _long;
void *_pointer;

View file

@ -1074,7 +1074,10 @@ void CLASS_load_without_init(CLASS *class)
cc->_string.addr += (intptr_t)class->string;
if (NUMBER_from_string(NB_READ_FLOAT, cc->_string.addr, strlen(cc->_string.addr), &value))
THROW(E_CLASS, ClassName, "Bad constant", "");
cc->_float.value = value._float.value;
if (cc->type == T_SINGLE)
cc->_single.value = (float)value._float.value;
else
cc->_float.value = value._float.value;
break;
}
}
@ -1145,6 +1148,8 @@ void CLASS_load_without_init(CLASS *class)
desc->constant.value._float = cc->_float.value;
else if (desc->constant.type == T_LONG)
desc->constant.value._long = cc->_long.value;
else if (desc->constant.type == T_SINGLE)
desc->constant.value._single = cc->_single.value;
else
{
desc->constant.type = T_CSTRING;

View file

@ -54,6 +54,7 @@ typedef
union {
TYPE_32 type;
struct { TYPE_32 type; double value; } PACKED _float;
struct { TYPE_32 type; float value; } PACKED _single;
struct { TYPE_32 type; int value; } PACKED _integer;
struct { TYPE_32 type; int64_t value; } PACKED _long;
struct { TYPE_32 type; ptr32_t addr; int len; } PACKED _string;