public override AstNode VisitArrayAssign(ArrayAssign ast) { //push array object var vi = ast.Array.VariableInfo; Field f = vi as Field; Parameter p = vi as Parameter; if (f != null) { FieldInfo fi = GetClrField(f); //load "this" m_ilgen.Emit(OpCodes.Ldarg_0); //load field m_ilgen.Emit(OpCodes.Ldfld, fi); } else if (p != null) { EmitLoadArgument(p.Index); } else { EmitLoadLocal(vi.Index); } //push index to e-stack Visit(ast.Index); //push value to e-stack Visit(ast.Value); m_ilgen.Emit(OpCodes.Stelem_I4); return(ast); }
public static bool WriteShuttlePLC(MachinesDTO communicationMachine, TaskDTO taskDTO) { var idReg = easyModbusCommunication.ConvertIntToRegisters(taskDTO.taskId); var xReg = easyModbusCommunication.ConvertIntToRegisters(taskDTO.X); var z1Reg = easyModbusCommunication.ConvertIntToRegisters(taskDTO.Z1); var z2Reg = easyModbusCommunication.ConvertIntToRegisters(taskDTO.Z2); var gReg = easyModbusCommunication.ConvertIntToRegisters(taskDTO.G); //task verisine göre plc write datası oluşturup yazılması gerekie. PlcCommunicationWritedData wd = new PlcCommunicationWritedData(); wd.MW100 = 0; //tetik wd.MW102 = idReg[0]; wd.MW103 = idReg[1]; wd.MW109 = (int)Plc_Asrs.GO; wd.MW110 = xReg[0]; wd.MW111 = xReg[1]; wd.MW112 = z1Reg[0]; wd.MW113 = z1Reg[1]; wd.MW114 = z2Reg[0]; wd.MW115 = z2Reg[1]; wd.MW116 = gReg[0]; wd.MW117 = gReg[1]; wd.MachineCode = communicationMachine.Code; wd.RecordDate = DateTime.Now; easyModbusCommunication = new EasyModbusCommunication(communicationMachine.IpAddress, 502); if (easyModbusCommunication.WriteToPLC(0, ArrayAssign.WritedDataToIntArray(wd)))//plc ye yazdıysa { writedDataAcces.InsertWritedData(wd); return(true); } else { log.Error($"ASRS Plc Write Error. TaskId : {taskDTO.taskId}"); return(false); } }
public override AstNode VisitArrayAssign(ArrayAssign ast) { var arrayVariable = ResolveVariable(ast.Array.VariableName); ast.Array.VariableInfo = arrayVariable; Visit(ast.Index); Visit(ast.Value); if (arrayVariable == null) { //resolve failed return(ast); } ArrayType arrayType = arrayVariable.Type as ArrayType; if (arrayType == null) { AddError(c_SE_NotArray, ast.Array.VariableName.Span, ast.Array.VariableName); } else if (arrayType.ElementType != PrimaryType.Int) { AddError(c_SE_NotSupported, ast.Array.VariableName.Span, "Arrays rather than int[] are not operatable"); } if (ast.Index.ExpressionType != PrimaryType.Int) { AddError(c_SE_InvalidCast, ast.Array.VariableName.Span, ast.Index.ExpressionType.Name, PrimaryType.Int.Name); } if (ast.Value.ExpressionType != PrimaryType.Int) { AddError(c_SE_InvalidCast, ast.Array.VariableName.Span, ast.Value.ExpressionType.Name, PrimaryType.Int.Name); } return(ast); }
public override AstNode VisitArrayAssign(ArrayAssign ast) { //push array object var vi = ast.Array.VariableInfo; Field f = vi as Field; Parameter p = vi as Parameter; if (f != null) { FieldInfo fi = GetClrField(f); //load "this" m_ilgen.Emit(OpCodes.Ldarg_0); //load field m_ilgen.Emit(OpCodes.Ldfld, fi); } else if (p != null) { EmitLoadArgument(p.Index); } else { EmitLoadLocal(vi.Index); } //push index to e-stack Visit(ast.Index); //push value to e-stack Visit(ast.Value); m_ilgen.Emit(OpCodes.Stelem_I4); return ast; }
public override AstNode VisitArrayAssign(ArrayAssign ast) { var arrayVariable = ResolveVariable(ast.Array.VariableName); ast.Array.VariableInfo = arrayVariable; Visit(ast.Index); Visit(ast.Value); if (arrayVariable == null) { //resolve failed return ast; } ArrayType arrayType = arrayVariable.Type as ArrayType; if (arrayType == null) { m_errorManager.AddError(c_SE_NotArray, ast.Array.VariableName.Span, ast.Array.VariableName); } else if (arrayType.ElementType != PrimaryType.Int) { m_errorManager.AddError(c_SE_NotSupported, ast.Array.VariableName.Span, "Arrays rather than int[] are not operatable"); } if (ast.Index.ExpressionType != PrimaryType.Int) { m_errorManager.AddError(c_SE_InvalidCast, ast.Array.VariableName.Span, ast.Index.ExpressionType.Name, PrimaryType.Int.Name); } if (ast.Value.ExpressionType != PrimaryType.Int) { m_errorManager.AddError(c_SE_InvalidCast, ast.Array.VariableName.Span, ast.Value.ExpressionType.Name, PrimaryType.Int.Name); } return ast; }
public virtual AstNode VisitArrayAssign(ArrayAssign ast) { return(ast); }