New model for moving from xml-area , with correct occurs handling etc

This commit is contained in:
2014-12-18 07:17:22 +01:00
parent db0a6e0a21
commit f493ccd9fa

View File

@ -917,8 +917,16 @@ namespace CobXmlSupport
} }
else else
{ {
CreateMoveFromData(); if (!chkDisplays.Checked)
fromMoves.Show(); {
createXMLMoveCode(true);
}
else
{
CreateMoveFromData();
fromMoves.Show();
}
} }
} }
@ -1331,7 +1339,7 @@ namespace CobXmlSupport
fromMoves.CodeShower.Text += "\r\n IF " + cr.CountIn; fromMoves.CodeShower.Text += "\r\n IF " + cr.CountIn;
if (occParRows.Length > 0) if (occParRows.Length > 0)
{ {
fromMoves.CodeShower.Text += occParRows + " )"; fromMoves.CodeShower.Text += "( "+ occParRows + " )";
} }
fromMoves.CodeShower.Text += "\r\n > 0"; fromMoves.CodeShower.Text += "\r\n > 0";
@ -1348,7 +1356,7 @@ namespace CobXmlSupport
} }
if (occParRows.Length > 0) if (occParRows.Length > 0)
{ {
fromMoves.CodeShower.Text += occParRows + " )"; fromMoves.CodeShower.Text += "( " + occParRows + " )";
} }
fromMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO "; fromMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO ";
if (cr.FieldDef.ToUpper().IndexOf("X") > -1) if (cr.FieldDef.ToUpper().IndexOf("X") > -1)
@ -1412,6 +1420,7 @@ namespace CobXmlSupport
{ {
fromMoves.CodeShower.Text += crtmp.wrapped() + "\r\n"; fromMoves.CodeShower.Text += crtmp.wrapped() + "\r\n";
}); });
} }
private string reduceIndList(string aktIndList, string indTemp) private string reduceIndList(string aktIndList, string indTemp)
@ -1498,7 +1507,7 @@ namespace CobXmlSupport
} }
fromToMoves.CodeShower.Text += slask4; fromToMoves.CodeShower.Text += slask4;
// aktIndList = reduceIndList(aktIndList, indTemp); nödvändig ? // aktIndList = reduceIndList(aktIndList, indTemp); nödvändig ?
// Until here--- // Until here---
valueSwitch = cr.FieldName.Contains("_Valu") || cr.isOccurs; valueSwitch = cr.FieldName.Contains("_Valu") || cr.isOccurs;
@ -1691,7 +1700,7 @@ namespace CobXmlSupport
} }
private void createXMLMoveCode() private void createXMLMoveCode(bool justOut = false)
{ {
bool loopTyp = false; bool loopTyp = false;
@ -1740,9 +1749,12 @@ namespace CobXmlSupport
{ {
foreach (string indTxt in indSt.NewInds) foreach (string indTxt in indSt.NewInds)
{ {
//Before perform varying, move the count-value from old structure to new if (!justOut)
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + tmpQfh.indexRedText; {
fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexRedText; //Before perform varying, move the count-value from old structure to new
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + tmpQfh.indexRedText;
fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexRedText;
}
//Perform //Perform
fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " + fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " +
indTxt + "\r\n > " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexRedText; indTxt + "\r\n > " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexRedText;
@ -1759,16 +1771,26 @@ namespace CobXmlSupport
} }
//The acutal move of present fields //The acutal move of present fields
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString(); fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString();
fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); if (!justOut)
{
if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { } fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString();
}
else else
{ {
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); fromToMoves.CodeShower.Text += " TO " + (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n";
fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); }
fromToMoves.CodeShower.Text += " ELSE\r\n";
fromToMoves.CodeShower.Text += " MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText); if (!justOut)
fromToMoves.CodeShower.Text += " END-IF\r\n"; {
if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { }
else
{
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText);
fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText);
fromToMoves.CodeShower.Text += " ELSE\r\n";
fromToMoves.CodeShower.Text += " MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + (string)(loopTyp ? tmpQfh.indexRedText : tmpQfh.indexText);
fromToMoves.CodeShower.Text += " END-IF\r\n";
}
} }
} }
@ -1802,7 +1824,8 @@ namespace CobXmlSupport
fromToMoves.Parent = this; fromToMoves.Parent = this;
fromToMoves.Labeltext = "Cobol \"reserved\" Words"; fromToMoves.Labeltext = "Cobol \"reserved\" Words";
foreach(string str in CobResWords.ToArray()) { foreach (string str in CobResWords.ToArray())
{
if (fromToMoves.CodeShower.Text == "") { } if (fromToMoves.CodeShower.Text == "") { }
else fromToMoves.CodeShower.Text += "\r\n"; else fromToMoves.CodeShower.Text += "\r\n";
fromToMoves.CodeShower.Text += str; fromToMoves.CodeShower.Text += str;
@ -1812,7 +1835,8 @@ namespace CobXmlSupport
//createXMLMoveCode(); //createXMLMoveCode();
} }
private void loadResWords(){ private void loadResWords()
{
string number = ""; string number = "";
CobResWords = new List<string>(); CobResWords = new List<string>();
for (int i = 0; i < 700; i++) for (int i = 0; i < 700; i++)