static void T_PREMIER_TRAJ() { ProgramInfo.desc = "Trajectoire facile"; ProgramInfo.groupMask = "1,*,*,*,*"; ProgramInfo.type = TP_PROGRAM; ProgramInfo.keepBlankLine = true; run("T_REPLI"); Flag flagDemandeQualite = F[1]; Flag flagTest = F[2]; flagDemandeQualite.Off(); if (flagDemandeQualite.State == ON && flagTest.State == OFF || flagTest.State == ON) { //! test goto autreLabel; } //! par Louis Gobert //! Set de UTOOL et UFRAME Uframe.set(frameOrange); Utool.set(toolPince); T_OUV_PINCE(); Pos pApproche = new Pos(1); move.joint(pApproche, 100, 50); Pos jRepli = new Pos(2); Pos pPrise = new Pos(3); PosReg pCalculer = PR[12]; pCalculer.Desc = "Point calcule"; PosReg pTemp = PR[11]; pCalculer.set(pTemp); move.joint(jRepli, 12, 100); move.linear(pPrise, 123, FINE); print("Prise de la piece"); T_FERM_PINCE(); move.linear(pApproche, 12, FINE); move.joint(jRepli, 12, FINE); print("Fin du programme."); RO pince = RO[11]; if (pince.State == ON) { goto lablTest; } else { goto autreLabel; } autreLabel: if (RO[1].State == OFF) { print("Fermer"); } if (RO[12].State == ON) { print("12 fermer"); } lablTest: print("Arrive au label"); }
/// <summary> /// Fonction qui gère de bout en bout la précompilation d'un /// "sous-programme" du programme en entier. /// </summary> /// <param name="programName"> Le nom du programme a interpréter </param> private static void ProgramInterprete(string programName) { string line = fileLine[iFL]; JumpMaker.LabelList = new List <string>(); while (!line.Contains('{')) { addLine(line); line = fileLine[++iFL]; } ++iFL; /// A amélioré --> /// Passé le BUILD_PATH une seule fois au lieux de le repasser a chaque programmes .ls addLine($"{line}\nGeneration.setup(\"{programName}\", @\"{Files.Const.BUILD_PATH}\");\n"); // On obtient tout le code programme int indexProgramEnd = Utils.GetIndexEndBlock(iFL + 1, fileLine); //int indexToPushProgramCreateProgrammeInfo = getLastProgramInfo(fileLine, iFL); for (; iFL < indexProgramEnd; iFL++) { line = fileLine[iFL].TrimStart(); // Generation déjà présent if (line.StartsWith("Generation")) { addLine(line); } // Commentaire else if (line.StartsWith("//!")) { addLine(Comment.ToString(line)); } // Ligne vide else if (line.Trim().Length == 0) { Utils.PassBlankLine(ref iFL, fileLine); } // Call else if (ProgramList.Contains(line.Trim())) { CallMaker.Call(line); } // If else if (line.StartsWith("if")) { IfElseMaker.IfMake(iFL, ref fileLine); } // Goto else if (line.StartsWith("goto")) { JumpMaker.GotoMaker(line); } // Label else if (line.Contains(':')) { JumpMaker.LabelMaker(line); } // For else if (line.StartsWith("for")) { ForMaker.Make(iFL, fileLine); } else if (line.StartsWith("UFRAME_NUM")) { addLine(Uframe.SetMake(line)); } else if (line.StartsWith("UTOOL_NUM")) { addLine(Utool.SetMake(line)); } // Autre else if (!line.Contains(PASS)) { addLine(line); } } // Fin du programme, on peux donc le créer et l'enregistré dans un .ls addLine("Generation.Save();\n}\n"); }