private void EmitI(eVM_Instruction _inst, string _val) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 6)); int count = Strings.Count; Strings.Add(_val); StringPatches.Add(VMB.Buffer.Position); VMB.Buffer.WriteInteger(count); }
private void CompileConstant(GMLToken _tok) { switch (_tok.Value.Kind) { case eKind.eConstant: Error("constant token", _tok); break; case eKind.eNone: Error("None constant token", _tok); break; case eKind.eNumber: { double num = (long)_tok.Value.ValueI; if (num == _tok.Value.ValueI) { long num2 = (long)_tok.Value.ValueI; if (num2 > int.MaxValue || num2 < int.MinValue) { EmitI(eVM_Instruction.eVMI_PUSH, num2); TypeStack.Push(eVM_Type.eVMT_Long); } else if (num2 > 32767 || num2 < -32768) { EmitI(eVM_Instruction.eVMI_PUSH, (int)num2); TypeStack.Push(eVM_Type.eVMT_Int); } else { VMB.Add(VMBuffer.EncodeInstructionArg(192, 15) | (int)(num2 & 0xFFFF)); TypeStack.Push(eVM_Type.eVMT_Int); } } else { EmitI(eVM_Instruction.eVMI_PUSH, _tok.Value.ValueI); TypeStack.Push(eVM_Type.eVMT_Double); } break; } case eKind.eString: EmitI(eVM_Instruction.eVMI_PUSH, _tok.Value.ValueS); TypeStack.Push(eVM_Type.eVMT_String); break; } }
private void EmitIVar(eVM_Instruction _inst, int _var, eVM_Type _target) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, VMBuffer.EncodeArgDouble(5, (int)_target))); VMB.Buffer.WriteInteger(_var); }
private void EmitIVar(eVM_Instruction _inst, int _var) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 5)); VMB.Buffer.WriteInteger(_var); }
private void EmitI(eVM_Instruction _inst, long _val) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 3)); VMB.Buffer.WriteLong(_val); }
private void EmitI(eVM_Instruction _inst, bool _val) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 4)); VMB.Buffer.WriteBoolean(_val); }
private void EmitI(eVM_Instruction _inst, float _val) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 1)); VMB.Buffer.WriteSingle(_val); }
private void EmitI(eVM_Instruction _inst, double _val) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, 0)); VMB.Buffer.WriteDouble(_val); }
private void Emit(eVM_Instruction _inst, eVM_Type _type1, eVM_Type _type2) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, VMBuffer.EncodeArgDouble((int)_type1, (int)_type2))); }
private void Emit(eVM_Instruction _inst, eVM_Type _type1) { VMB.Add(VMBuffer.EncodeInstructionArg((int)_inst, (int)_type1)); }
private void EmitBreak(ushort _v) { VMB.Add(VMBuffer.EncodeInstructionArg(255, 15) | _v); }