From 46e658549517e8d4f6b3c111120f907983a7870f Mon Sep 17 00:00:00 2001 From: tfoman Date: Tue, 29 Sep 2015 07:42:25 +0200 Subject: [PATCH] Better procnames (events) --- CobXmlSupport/GenCobCode.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CobXmlSupport/GenCobCode.cs b/CobXmlSupport/GenCobCode.cs index e478479..fb8cc2c 100644 --- a/CobXmlSupport/GenCobCode.cs +++ b/CobXmlSupport/GenCobCode.cs @@ -2199,6 +2199,8 @@ namespace CobXmlSupport bool loopTyp = false; string SectionNames="",BoolVars=""; qualifieldhlp locTmpQfh = null; + Stack indexStack = new Stack(); + //Create showing window fromToMoves = new ShowCode(); fromToMoves.Parent = this; @@ -2251,6 +2253,12 @@ namespace CobXmlSupport //If indexes get out of scope there will come an END-PERFORM for each for (int i = 0; i < indSt.Returns; i++) { + string xtIndex = indexStack.Pop(); + string chosenKey = testIndexes.FirstOrDefault(x => x.Value == xtIndex ).Key; // indexes = search FieldName from present FieldIndex + locTmpQfh = qldList.First(x => x.qualCobRow.FieldName == chosenKey); // Find QualifiedHelp-object for right field + + fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "LAST-in-", + xtIndex, ref SectionNames) + "\r\n"; fromToMoves.CodeShower.Text += " END-PERFORM" + "\r\n"; } @@ -2274,8 +2282,9 @@ namespace CobXmlSupport fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " + indTxt + "\r\n > " + locTmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + locTmpQfh.indexRedText; - string tmpCheckVar = ""; - fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "NXTO-", + //string tmpCheckVar = ""; + indexStack.Push(indTxt); + fromToMoves.CodeShower.Text += " PERFORM " + createAftReferenceSections(locTmpQfh.qualCobRow.TagName, "FIRST-in-", indTxt, ref SectionNames) + "\r\n"; } } @@ -2369,8 +2378,8 @@ namespace CobXmlSupport private string createAftReferenceSections(string tagName, string procPrefix, string indexVar, ref string wrkSectStr) { - string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "");; - if (!wrkSectStr.Contains(tmpProcName)) + string tmpProcName = procPrefix + tagName.Replace("\"", "").Replace(":", "")+"-x"; + if (!wrkSectStr.Contains(tmpProcName+"-x")) { wrkSectStr += "\r\n *>------------------- HANDLE SECTION --------------*" + tmpProcName; wrkSectStr += "\r\n * Den här sektionen används för att positionera ";