fix literal string assemble

This commit is contained in:
xensik 2022-03-09 11:31:17 +01:00
parent 1649203eec
commit ac2b8a65ce
10 changed files with 46 additions and 46 deletions

View File

@ -260,19 +260,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -468,7 +468,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -260,19 +260,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -468,7 +468,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -260,18 +260,18 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint16_t>(0); script_->write<std::uint16_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -467,7 +467,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -259,19 +259,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -467,7 +467,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -259,19 +259,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -467,7 +467,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -272,19 +272,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -522,7 +522,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -260,19 +260,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -468,7 +468,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -261,19 +261,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -469,7 +469,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -272,19 +272,19 @@ void assembler::assemble_instruction(const instruction::ptr& inst)
case opcode::OP_GetIString: case opcode::OP_GetIString:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::to_code(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_GetAnimation: case opcode::OP_GetAnimation:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
script_->write<std::uint32_t>(0); script_->write<std::uint32_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
stack_->write_c_string(utils::string::unquote(inst->data[1])); stack_->write_c_string(inst->data[1]);
break; break;
case opcode::OP_GetAnimTree: case opcode::OP_GetAnimTree:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
script_->write<std::uint8_t>(0); script_->write<std::uint8_t>(0);
stack_->write_c_string(utils::string::unquote(inst->data[0])); stack_->write_c_string(inst->data[0]);
break; break;
case opcode::OP_waittillmatch: case opcode::OP_waittillmatch:
script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode)); script_->write<std::uint8_t>(static_cast<std::uint8_t>(inst->opcode));
@ -522,7 +522,7 @@ void assembler::assemble_end_switch(const instruction::ptr& inst)
else else
{ {
script_->write<uint32_t>(i + 1); script_->write<uint32_t>(i + 1);
stack_->write_c_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); stack_->write_c_string(inst->data[1 + (3 * i) + 1]);
} }
index += 4; index += 4;

View File

@ -797,7 +797,7 @@ void assembler::process_instruction(const instruction::ptr& inst)
{ {
if (!utils::string::is_number(inst->data[1 + (3 * i) + 1])) if (!utils::string::is_number(inst->data[1 + (3 * i) + 1]))
{ {
process_string(utils::string::unquote(inst->data[1 + (3 * i) + 1])); process_string(inst->data[1 + (3 * i) + 1]);
} }
} }
} }