Add opFixArray
This commit is contained in:
parent
a51ece60ac
commit
1d3e61f346
|
@ -145,6 +145,11 @@ void FreeArray(ArrayId array_id)
|
||||||
arrays.erase(array_id);
|
arrays.erase(array_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixArray(ArrayId id)
|
||||||
|
{
|
||||||
|
temporaryArrays.erase(id);
|
||||||
|
}
|
||||||
|
|
||||||
void DeleteAllTempArrays()
|
void DeleteAllTempArrays()
|
||||||
{
|
{
|
||||||
for (auto it = temporaryArrays.begin(); it != temporaryArrays.end(); ++it) {
|
for (auto it = temporaryArrays.begin(); it != temporaryArrays.end(); ++it) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ int LenArray(ArrayId array_id);
|
||||||
ProgramValue GetArray(ArrayId array_id, const SFallScriptValue& key);
|
ProgramValue GetArray(ArrayId array_id, const SFallScriptValue& key);
|
||||||
void SetArray(ArrayId array_id, const SFallScriptValue& key, const SFallScriptValue& val, bool allowUnset);
|
void SetArray(ArrayId array_id, const SFallScriptValue& key, const SFallScriptValue& val, bool allowUnset);
|
||||||
void FreeArray(ArrayId array_id);
|
void FreeArray(ArrayId array_id);
|
||||||
|
void FixArray(ArrayId id);
|
||||||
void DeleteAllTempArrays();
|
void DeleteAllTempArrays();
|
||||||
}
|
}
|
||||||
#endif /* SFALL_ARRAYS */
|
#endif /* SFALL_ARRAYS */
|
|
@ -317,6 +317,13 @@ static void opTempArray(Program* program)
|
||||||
programStackPushInteger(program, array_id);
|
programStackPushInteger(program, array_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fix_array
|
||||||
|
static void opFixArray(Program* program)
|
||||||
|
{
|
||||||
|
auto array_id = programStackPopInteger(program);
|
||||||
|
FixArray(array_id);
|
||||||
|
}
|
||||||
|
|
||||||
// set_array
|
// set_array
|
||||||
static void opSetArray(Program* program)
|
static void opSetArray(Program* program)
|
||||||
{
|
{
|
||||||
|
@ -410,6 +417,7 @@ void sfallOpcodesInit()
|
||||||
interpreterRegisterOpcode(0x8230, opFreeArray);
|
interpreterRegisterOpcode(0x8230, opFreeArray);
|
||||||
interpreterRegisterOpcode(0x8231, opLenArray);
|
interpreterRegisterOpcode(0x8231, opLenArray);
|
||||||
interpreterRegisterOpcode(0x8233, opTempArray);
|
interpreterRegisterOpcode(0x8233, opTempArray);
|
||||||
|
interpreterRegisterOpcode(0x8233, opFixArray);
|
||||||
interpreterRegisterOpcode(0x8237, opParseInt);
|
interpreterRegisterOpcode(0x8237, opParseInt);
|
||||||
interpreterRegisterOpcode(0x824F, opGetStringLength);
|
interpreterRegisterOpcode(0x824F, opGetStringLength);
|
||||||
interpreterRegisterOpcode(0x8256, opGetArrayKey);
|
interpreterRegisterOpcode(0x8256, opGetArrayKey);
|
||||||
|
|
Loading…
Reference in New Issue