/// <inheritdoc /> public ProgramInstruction GetInstruction(int instructionId) { ProgramInstruction programInstruction = new ProgramInstruction(); Link.check_connection(); var command = "Prog_GIns"; Link.send_line(command); Link.send_item(this); Link.send_int(instructionId); programInstruction.Name = Link.rec_line(); programInstruction.InstructionType = (InstructionType)Link.rec_int(); programInstruction.MoveType = MoveType.Invalid; programInstruction.IsJointTarget = false; programInstruction.Target = null; programInstruction.Joints = null; if (programInstruction.InstructionType == InstructionType.Move) { programInstruction.MoveType = (MoveType)Link.rec_int(); programInstruction.IsJointTarget = Link.rec_int() > 0 ? true : false; programInstruction.Target = Link.rec_pose(); programInstruction.Joints = Link.rec_array(); } Link.check_status(); return(programInstruction); }
private void CheckToString(String mnemonic, String operandString, String expected, String message) { ProgramInstruction target = Make(mnemonic, operandString); String actual = target.ToString(); Assert.AreEqual(expected, actual, message); }
private void CheckGenerateCode(ProgramInstruction target, Word[] expectedWords, String message) { RelocatableModule relModule = new RelocatableModule(); target.GenerateCode(null, relModule); RelocatableModuleTest.CheckWords(relModule, expectedWords, message); }
internal static ProgramInstruction Make(String instructionField, String operandField) { ProgramInstruction instruction = ProgramInstructionFactory.Make(instructionField); ReadBuffer buffer = new ReadBuffer(operandField); instruction.ReadOperand(buffer); return(instruction); }
public void GenerateLiteralDc() { ProgramInstruction target = ProgramInstructionTest.Make(MnemonicDef.LD, "GR1,=1234,GR2"); LabelTable lblTable = new LabelTable(); String actual = target.GenerateLiteralDc(lblTable); String expected = ProgramLineTest.MakeGeneratedLine("LTRL0001", "DC", "1234"); Assert.AreEqual(expected, actual, "リテラルの DC 命令が生成される"); }
private void CheckMake(String mnemonic, Type expectedType, String message) { try { ProgramInstruction instruction = ProgramInstructionFactory.Make(mnemonic); Assert.IsNotNull(expectedType, message); Assert.IsInstanceOfType(instruction, expectedType, message); Assert.AreEqual(mnemonic, instruction.Mnemonic, "指定のニーモニックと命令のニーモニックが同じ"); } catch (Casl2SimulatorException) { Assert.IsNull(expectedType, message); } }
internal static void CheckReadOperand( ProgramInstruction target, String text, Boolean success, String message) { ReadBuffer buffer = new ReadBuffer(text); try { target.ReadOperand(buffer); Assert.IsTrue(success, message); } catch (Casl2SimulatorException) { Assert.IsFalse(success, message); } }
/// <inheritdoc /> public void SetInstruction(int instructionId, ProgramInstruction instruction) { Link.check_connection(); var command = "Prog_SIns"; Link.send_line(command); Link.send_item(this); Link.send_int(instructionId); Link.send_line(instruction.Name); Link.send_int((int)instruction.InstructionType); if (instruction.InstructionType == InstructionType.Move) { Link.send_int((int)instruction.MoveType); Link.send_int(instruction.IsJointTarget ? 1 : 0); Link.send_pose(instruction.Target); Link.send_array(instruction.Joints); } Link.check_status(); }
public void TestInitialize() { m_rAdrXOrR1R2_RAdrX = ProgramInstructionTest.Make(MnemonicDef.LD, "GR1,#ABCD,GR2"); m_rAdrXOrR1R2_R1R2 = ProgramInstructionTest.Make(MnemonicDef.LD, "GR3,GR4"); }