Commit 7bedc9af authored by Benoît Minisini's avatar Benoît Minisini

Fix VarPtr() behaviour.

[INTERPRETER]
* BUG: VarPtr() on local strings are forbidden again.
* BUG: VarPtr() on variants now returns a pointer to the variant contents.
parent b8952bd3
......@@ -210,24 +210,16 @@ void SUBR_varptr(ushort code)
ptr = &val->_date.date;
break;
case T_STRING:
case T_CSTRING:
ptr = val->_string.addr + val->_string.start;
break;
case T_POINTER:
ptr = &val->_pointer.value;
break;
case T_VARIANT:
if (val->_variant.vtype == T_STRING)
ptr = val->_variant.value._string;
else
ptr = &val->_variant.value.data;
ptr = &val->_variant.value.data;
break;
default:
THROW(E_TYPE, "Number, date, pointer or string", TYPE_get_name(val->type));
THROW(E_TYPE, "Number, date, or pointer", TYPE_get_name(val->type));
}
}
else if ((op & 0xF800) == C_PUSH_DYNAMIC)
......@@ -238,11 +230,15 @@ void SUBR_varptr(ushort code)
THROW_ILLEGAL();
ptr = &OP[var->pos];
if (var->type.id == T_VARIANT)
ptr = &((VARIANT *)ptr)->value.data;
}
else if ((op & 0xF800) == C_PUSH_STATIC)
{
var = &CP->load->stat[op & 0x7FF];
ptr = (char *)CP->stat + var->pos;
if (var->type.id == T_VARIANT)
ptr = &((VARIANT *)ptr)->value.data;
}
else
THROW_ILLEGAL();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment