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,10 +917,18 @@ namespace CobXmlSupport
}
else
{
if (!chkDisplays.Checked)
{
createXMLMoveCode(true);
}
else
{
CreateMoveFromData();
fromMoves.Show();
}
}
}
private string adjustIf(bool ifTrue)
{
@ -1331,7 +1339,7 @@ namespace CobXmlSupport
fromMoves.CodeShower.Text += "\r\n IF " + cr.CountIn;
if (occParRows.Length > 0)
{
fromMoves.CodeShower.Text += occParRows + " )";
fromMoves.CodeShower.Text += "( "+ occParRows + " )";
}
fromMoves.CodeShower.Text += "\r\n > 0";
@ -1348,7 +1356,7 @@ namespace CobXmlSupport
}
if (occParRows.Length > 0)
{
fromMoves.CodeShower.Text += occParRows + " )";
fromMoves.CodeShower.Text += "( " + occParRows + " )";
}
fromMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO ";
if (cr.FieldDef.ToUpper().IndexOf("X") > -1)
@ -1412,6 +1420,7 @@ namespace CobXmlSupport
{
fromMoves.CodeShower.Text += crtmp.wrapped() + "\r\n";
});
}
private string reduceIndList(string aktIndList, string indTemp)
@ -1691,7 +1700,7 @@ namespace CobXmlSupport
}
private void createXMLMoveCode()
private void createXMLMoveCode(bool justOut = false)
{
bool loopTyp = false;
@ -1739,10 +1748,13 @@ namespace CobXmlSupport
if (indSt.NewInds != null)
{
foreach (string indTxt in indSt.NewInds)
{
if (!justOut)
{
//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
fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " +
indTxt + "\r\n > " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexRedText;
@ -1759,8 +1771,17 @@ namespace CobXmlSupport
}
//The acutal move of present fields
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString();
if (!justOut)
{
fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString();
}
else
{
fromToMoves.CodeShower.Text += " TO " + (string)(tmpQfh.qualCobRow.FieldDef.ToUpper().Contains("X") ? "MoveToStringVar" : "MoveToNumVar") + "\r\n";
}
if (!justOut)
{
if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { }
else
{
@ -1771,6 +1792,7 @@ namespace CobXmlSupport
fromToMoves.CodeShower.Text += " END-IF\r\n";
}
}
}
// get optionally occuring last END-PERFORMs...
indSt.handleStatus(null);
@ -1802,7 +1824,8 @@ namespace CobXmlSupport
fromToMoves.Parent = this;
fromToMoves.Labeltext = "Cobol \"reserved\" Words";
foreach(string str in CobResWords.ToArray()) {
foreach (string str in CobResWords.ToArray())
{
if (fromToMoves.CodeShower.Text == "") { }
else fromToMoves.CodeShower.Text += "\r\n";
fromToMoves.CodeShower.Text += str;
@ -1812,7 +1835,8 @@ namespace CobXmlSupport
//createXMLMoveCode();
}
private void loadResWords(){
private void loadResWords()
{
string number = "";
CobResWords = new List<string>();
for (int i = 0; i < 700; i++)