canceled Code

This commit is contained in:
Tommy Öman
2015-11-03 23:26:02 +01:00
parent 42c16b48da
commit cf6bc34631
2 changed files with 252 additions and 262 deletions

View File

@ -59,6 +59,8 @@
this.chkBackupVars = new System.Windows.Forms.CheckBox();
this.btnRerun = new System.Windows.Forms.Button();
this.grpProduce = new System.Windows.Forms.GroupBox();
this.btnMoveFromAttr = new System.Windows.Forms.Button();
this.btnXmlKopAttr = new System.Windows.Forms.Button();
this.btnFrXMLTo = new System.Windows.Forms.Button();
this.chkAttribs = new System.Windows.Forms.CheckBox();
this.chkNewArea = new System.Windows.Forms.CheckBox();
@ -71,8 +73,6 @@
this.grpSettings = new System.Windows.Forms.GroupBox();
this.btnSaveArea = new System.Windows.Forms.Button();
this.btnShowWorkFiles = new System.Windows.Forms.Button();
this.btnXmlKopAttr = new System.Windows.Forms.Button();
this.btnMoveFromAttr = new System.Windows.Forms.Button();
this.grpProduce.SuspendLayout();
this.grpSettings.SuspendLayout();
this.SuspendLayout();
@ -403,6 +403,26 @@
this.grpProduce.TabStop = false;
this.grpProduce.Text = "Producera";
//
// btnMoveFromAttr
//
this.btnMoveFromAttr.Location = new System.Drawing.Point(290, 36);
this.btnMoveFromAttr.Name = "btnMoveFromAttr";
this.btnMoveFromAttr.Size = new System.Drawing.Size(92, 22);
this.btnMoveFromAttr.TabIndex = 45;
this.btnMoveFromAttr.Text = "G. Mov. Fr.+Attr";
this.btnMoveFromAttr.UseVisualStyleBackColor = true;
this.btnMoveFromAttr.Click += new System.EventHandler(this.btnMoveFromAttr_Click);
//
// btnXmlKopAttr
//
this.btnXmlKopAttr.Location = new System.Drawing.Point(290, 82);
this.btnXmlKopAttr.Name = "btnXmlKopAttr";
this.btnXmlKopAttr.Size = new System.Drawing.Size(92, 22);
this.btnXmlKopAttr.TabIndex = 44;
this.btnXmlKopAttr.Text = "Kop XML+Attr";
this.btnXmlKopAttr.UseVisualStyleBackColor = true;
this.btnXmlKopAttr.Click += new System.EventHandler(this.btnXmlKopAttr_Click);
//
// btnFrXMLTo
//
this.btnFrXMLTo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -425,7 +445,6 @@
this.chkAttribs.Text = "Move Attribs";
this.chkAttribs.UseVisualStyleBackColor = true;
this.chkAttribs.Visible = false;
this.chkAttribs.CheckedChanged += new System.EventHandler(this.chkAttribs_CheckedChanged);
//
// chkNewArea
//
@ -438,7 +457,6 @@
this.chkNewArea.Text = "Till Area";
this.chkNewArea.UseVisualStyleBackColor = true;
this.chkNewArea.Visible = false;
this.chkNewArea.CheckedChanged += new System.EventHandler(this.chkNewArea_CheckedChanged);
//
// chkMvToDisp
//
@ -552,26 +570,6 @@
this.btnShowWorkFiles.UseVisualStyleBackColor = true;
this.btnShowWorkFiles.Click += new System.EventHandler(this.btnShowWorkFiles_Click);
//
// btnXmlKopAttr
//
this.btnXmlKopAttr.Location = new System.Drawing.Point(290, 82);
this.btnXmlKopAttr.Name = "btnXmlKopAttr";
this.btnXmlKopAttr.Size = new System.Drawing.Size(92, 22);
this.btnXmlKopAttr.TabIndex = 44;
this.btnXmlKopAttr.Text = "Kop XML+Attr";
this.btnXmlKopAttr.UseVisualStyleBackColor = true;
this.btnXmlKopAttr.Click += new System.EventHandler(this.btnXmlKopAttr_Click);
//
// btnMoveFromAttr
//
this.btnMoveFromAttr.Location = new System.Drawing.Point(290, 36);
this.btnMoveFromAttr.Name = "btnMoveFromAttr";
this.btnMoveFromAttr.Size = new System.Drawing.Size(92, 22);
this.btnMoveFromAttr.TabIndex = 45;
this.btnMoveFromAttr.Text = "G. Mov. Fr.+Attr";
this.btnMoveFromAttr.UseVisualStyleBackColor = true;
this.btnMoveFromAttr.Click += new System.EventHandler(this.btnMoveFromAttr_Click);
//
// GenCobCode
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -1230,13 +1230,13 @@ namespace CobXmlSupport
private void GenerateFromCode(bool inclAttr)
{
if (chkNewArea.Checked)
{
CreateMoveDataFromTo();
fromToMoves.Show();
}
else
{
//if (chkNewArea.Checked)
//{
// CreateMoveDataFromTo();
// fromToMoves.Show();
//}
//else
//{
if (!chkDisplays.Checked)
{
savedFile SF = new savedFile();
@ -1251,7 +1251,7 @@ namespace CobXmlSupport
CreateMoveFromData();
fromMoves.Show();
}
}
//}
}
private string adjustIf(bool ifTrue)
@ -1940,258 +1940,255 @@ namespace CobXmlSupport
return resStr;
}
//******************************************************************************************
// Ny branch newXmlMove created ****************************
//******************************************************************************************
////******************************************************************************************
//// Ny branch newXmlMove created ****************************
////******************************************************************************************
private void CreateMoveDataFromTo()
{
Dictionary<string, string> indexNames = new Dictionary<string, string>();
string IndVarText = " *------------------- From - To --------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
string aktIndList = "", slask = "", slask2 = "", slask3 = "", slask4 = "";
string occParIndRows = "";
IndexState Is = new IndexState(indexNames, rowList, false);
fromToMoves = new ShowCode();
fromToMoves.FormParent = this;
fromToMoves.Labeltext = "Creating \"move From - To\" Code";
//private void CreateMoveDataFromTo()
//{
// Dictionary<string, string> indexNames = new Dictionary<string, string>();
// string IndVarText = " *------------------- From - To --------------------*\r\n * Extra indexvariabler för occurs-taggar --------*\r\n *--------------------------------------------------*";
// string aktIndList = "", slask = "", slask2 = "", slask3 = "", slask4 = "";
// string occParIndRows = "";
// IndexState Is = new IndexState(indexNames, rowList, false);
// fromToMoves = new ShowCode();
// fromToMoves.FormParent = this;
// fromToMoves.Labeltext = "Creating \"move From - To\" Code";
savedFile SF = new savedFile();
SF.idConnect = "0A975654-75C6-4A8C-8534-AA16F46BC740";
SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
fromToMoves.SavedFile = SF;
// savedFile SF = new savedFile();
// SF.idConnect = "0A975654-75C6-4A8C-8534-AA16F46BC740";
// SF.usageName = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer";
// SF.fNameSaved = S.ettingActualFile.Substring(0, S.ettingActualFile.LastIndexOf(".")) + "_Transfer.cbl";
// fromToMoves.SavedFile = SF;
bool adj = false;
bool valueSwitch = false;
// bool adj = false;
// bool valueSwitch = false;
foreach (CobRow cr in rowList)
{
// foreach (CobRow cr in rowList)
// {
string occParRows = "";
if (cr.CobLevel < 2)
{
string inFile = cmbLastFile.Text.Substring(cmbLastFile.Text.LastIndexOf("\\") + 1);
CreateComment(fromToMoves.CodeShower, "Moves from " + cr.FieldName, S.ettingUserName, S.ettingCompany, inFile);
}
if (okToCode(cr))
{
if (cr.CountIn.Length > 0 || chkAttribs.Checked && cr.isAttribute)
{
adj = true;
string fejkRow = "";
CobRow crChk = cr;
indTemp = "";
aktIndList = "";
//Debug.WriteLine(cr.FieldName);
while (crChk.LevelParent != null)
{
fejkRow += "\r\n OF " + crChk.FieldName;
fejkRow = checkForOccurs(indexNames, crChk, fromToMoves.CodeShower.Text, ref occParRows, ref aktIndList);
crChk = crChk.LevelParent;
}
// Here a test giving header for new iter-group would be created
slask4 = Is.PresentStrings(aktIndList);
// string occParRows = "";
// if (cr.CobLevel < 2)
// {
// string inFile = cmbLastFile.Text.Substring(cmbLastFile.Text.LastIndexOf("\\") + 1);
// CreateComment(fromToMoves.CodeShower, "Moves from " + cr.FieldName, S.ettingUserName, S.ettingCompany, inFile);
// }
// if (okToCode(cr))
// {
// if (cr.CountIn.Length > 0 || chkAttribs.Checked && cr.isAttribute)
// {
// adj = true;
// string fejkRow = "";
// CobRow crChk = cr;
// indTemp = "";
// aktIndList = "";
// //Debug.WriteLine(cr.FieldName);
// while (crChk.LevelParent != null)
// {
// fejkRow += "\r\n OF " + crChk.FieldName;
// fejkRow = checkForOccurs(indexNames, crChk, fromToMoves.CodeShower.Text, ref occParRows, ref aktIndList);
// crChk = crChk.LevelParent;
// }
// // Here a test giving header for new iter-group would be created
// slask4 = Is.PresentStrings(aktIndList);
if (slask4.Contains("END-P") && slask4.Contains("VARYING"))
{
fromToMoves.CodeShower.Text += slask4.Substring(0, slask4.IndexOf("\r\n", 2));
slask4 = slask4.Substring(slask4.IndexOf("\r\n", 2));
}
// if (slask4.Contains("END-P") && slask4.Contains("VARYING"))
// {
// fromToMoves.CodeShower.Text += slask4.Substring(0, slask4.IndexOf("\r\n", 2));
// slask4 = slask4.Substring(slask4.IndexOf("\r\n", 2));
// }
if ((slask4.Length > 0) && (slask4.Contains("VARYING")))
{
// Is.ExtraParam innehåller här aktuell count-variabel med correcta index variabler
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "MOVE " + Is.ExtraParam;
slask3 = Is.ExtraParam;
int prefixPos = slask3.IndexOf(S.ettingPrefix);
slask3 = slask3.Substring(0, prefixPos) + S.ettingExpPrefix + slask3.Substring(prefixPos + S.ettingPrefix.Length);
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO " + slask3;
}
// if ((slask4.Length > 0) && (slask4.Contains("VARYING")))
// {
// // Is.ExtraParam innehåller här aktuell count-variabel med correcta index variabler
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "MOVE " + Is.ExtraParam;
// slask3 = Is.ExtraParam;
// int prefixPos = slask3.IndexOf(S.ettingPrefix);
// slask3 = slask3.Substring(0, prefixPos) + S.ettingExpPrefix + slask3.Substring(prefixPos + S.ettingPrefix.Length);
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO " + slask3;
// }
fromToMoves.CodeShower.Text += slask4;
// aktIndList = reduceIndList(aktIndList, indTemp); nödvändig ?
// Until here---
// fromToMoves.CodeShower.Text += slask4;
// // aktIndList = reduceIndList(aktIndList, indTemp); nödvändig ?
// // Until here---
valueSwitch = cr.FieldName.Contains("_Valu") || cr.isOccurs;
if (!valueSwitch)
{
fromToMoves.CodeShower.Text += "\r\n IF " + cr.CountIn;
occParIndRows = cr.isOccurs && occParRows.Contains(",") ? occParRows.Substring(0, occParRows.LastIndexOf(",")) : occParRows;
// valueSwitch = cr.FieldName.Contains("_Valu") || cr.isOccurs;
// if (!valueSwitch)
// {
// fromToMoves.CodeShower.Text += "\r\n IF " + cr.CountIn;
// occParIndRows = cr.isOccurs && occParRows.Contains(",") ? occParRows.Substring(0, occParRows.LastIndexOf(",")) : occParRows;
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
}
// if (occParIndRows.Length > 0)
// {
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
// }
fromToMoves.CodeShower.Text += "\r\n > 0";
}
occParRows = "";
// fromToMoves.CodeShower.Text += "\r\n > 0";
// }
// occParRows = "";
}
//
// Start move <from> -----------------------------------------------------------
//
CobRow crTmp = cr;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "MOVE " + cr.FieldName;
// }
// //
// // Start move <from> -----------------------------------------------------------
// //
// CobRow crTmp = cr;
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "MOVE " + cr.FieldName;
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
cr,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask,
false,
adj);
// fromToMoves.CodeShower.Text = checkForOccurs(
// indexNames,
// cr,
// fromToMoves.CodeShower.Text,
// ref occParRows,
// ref slask,
// false,
// adj);
while (crTmp.LevelParent != null)
{
crTmp = crTmp.LevelParent;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + " OF " + crTmp.FieldName;
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
crTmp,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask,
false,
adj);
}
if (occParRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParRows + " )";
}
// while (crTmp.LevelParent != null)
// {
// crTmp = crTmp.LevelParent;
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + " OF " + crTmp.FieldName;
// fromToMoves.CodeShower.Text = checkForOccurs(
// indexNames,
// crTmp,
// fromToMoves.CodeShower.Text,
// ref occParRows,
// ref slask,
// false,
// adj);
// }
// if (occParRows.Length > 0)
// {
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParRows + " )";
// }
//
// Start <to> section-----------------------------------------------------------
//
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO ";
occParRows = "";
CobRow crTmpx = cr;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) +
crTmpx.FieldName.Replace(S.ettingPrefix, S.ettingExpPrefix);
// //
// // Start <to> section-----------------------------------------------------------
// //
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "TO ";
// occParRows = "";
// CobRow crTmpx = cr;
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) +
// crTmpx.FieldName.Replace(S.ettingPrefix, S.ettingExpPrefix);
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
crTmpx,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask2,
false,
adj);
// fromToMoves.CodeShower.Text = checkForOccurs(
// indexNames,
// crTmpx,
// fromToMoves.CodeShower.Text,
// ref occParRows,
// ref slask2,
// false,
// adj);
while (crTmpx.LevelParent != null)
{
crTmpx = crTmpx.LevelParent;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "OF " +
crTmpx.FieldName.Replace(S.ettingPrefix, S.ettingExpPrefix);
fromToMoves.CodeShower.Text = checkForOccurs(
indexNames,
crTmpx,
fromToMoves.CodeShower.Text,
ref occParRows,
ref slask2,
false,
adj);
}
if (occParRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParRows;
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + ")";
}
// while (crTmpx.LevelParent != null)
// {
// crTmpx = crTmpx.LevelParent;
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "OF " +
// crTmpx.FieldName.Replace(S.ettingPrefix, S.ettingExpPrefix);
// fromToMoves.CodeShower.Text = checkForOccurs(
// indexNames,
// crTmpx,
// fromToMoves.CodeShower.Text,
// ref occParRows,
// ref slask2,
// false,
// adj);
// }
// if (occParRows.Length > 0)
// {
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParRows;
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + ")";
// }
if (cr.CountIn.Length > 0)
{
if (!valueSwitch)
{
if (chkDisplays.Checked)
{
//
// Move count indicators from in-area to out-area
//
fromToMoves.CodeShower.Text += "\r\n MOVE ";
fromToMoves.CodeShower.Text += cr.CountIn;
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
}
fromToMoves.CodeShower.Text += "\r\n " + " TO "
+ cr.CountIn.Replace(S.ettingPrefix, S.ettingExpPrefix);
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
}
}
// if (cr.CountIn.Length > 0)
// {
// if (!valueSwitch)
// {
// if (chkDisplays.Checked)
// {
// //
// // Move count indicators from in-area to out-area
// //
// fromToMoves.CodeShower.Text += "\r\n MOVE ";
// fromToMoves.CodeShower.Text += cr.CountIn;
// if (occParIndRows.Length > 0)
// {
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
// }
// fromToMoves.CodeShower.Text += "\r\n " + " TO "
// + cr.CountIn.Replace(S.ettingPrefix, S.ettingExpPrefix);
// if (occParIndRows.Length > 0)
// {
// fromToMoves.CodeShower.Text += "\r\n " + adjustIf(adj) + "(" + occParIndRows + " )";
// }
// }
CobRow crtmp = cr;
while (crtmp.LevelParent != null)
{
crtmp = crtmp.LevelParent;
}
// CobRow crtmp = cr;
// while (crtmp.LevelParent != null)
// {
// crtmp = crtmp.LevelParent;
// }
fromToMoves.CodeShower.Text += "\r\n ELSE ";
fromToMoves.CodeShower.Text += "\r\n MOVE 0 TO ";
// fromToMoves.CodeShower.Text += "\r\n ELSE ";
// fromToMoves.CodeShower.Text += "\r\n MOVE 0 TO ";
fromToMoves.CodeShower.Text += cr.CountIn.Replace(S.ettingPrefix, S.ettingExpPrefix);
if (occParIndRows.Length > 0)
{
fromToMoves.CodeShower.Text += " (" + occParIndRows + " )";
}
// fromToMoves.CodeShower.Text += cr.CountIn.Replace(S.ettingPrefix, S.ettingExpPrefix);
// if (occParIndRows.Length > 0)
// {
// fromToMoves.CodeShower.Text += " (" + occParIndRows + " )";
// }
fromToMoves.CodeShower.Text += "\r\n END-IF ";
}
}
}
//ändring
fromToMoves.CodeShower.Text += Is.PresentStrings(aktIndList);
//ändring
}
// fromToMoves.CodeShower.Text += "\r\n END-IF ";
// }
// }
// }
// //ändring
// fromToMoves.CodeShower.Text += Is.PresentStrings(aktIndList);
// //ändring
// }
fromToMoves.CodeShower.Text += Is.PresentStrings("");
// fromToMoves.CodeShower.Text += Is.PresentStrings("");
fromToMoves.CodeShower.Text = " 01 MoveToNumVar PIC 9(12).\r\n" + fromToMoves.CodeShower.Text;
fromToMoves.CodeShower.Text = "\r\n 01 MoveToStringVar PIC X(500).\r\n" + fromToMoves.CodeShower.Text;
fromToMoves.CodeShower.Text = addOccursVars(indexNames, fromToMoves.CodeShower.Text, IndVarText);
// fromToMoves.CodeShower.Text = " 01 MoveToNumVar PIC 9(12).\r\n" + fromToMoves.CodeShower.Text;
// fromToMoves.CodeShower.Text = "\r\n 01 MoveToStringVar PIC X(500).\r\n" + fromToMoves.CodeShower.Text;
// fromToMoves.CodeShower.Text = addOccursVars(indexNames, fromToMoves.CodeShower.Text, IndVarText);
tmpRowList = new List<CobRow>();
foreach (string frmRow in fromToMoves.CodeShower.Lines)
{
tmpRowList.Add(new CobRow(frmRow, false));
}
fromToMoves.CodeShower.Text = "";
tmpRowList.ForEach(delegate(CobRow crtmp)
{
fromToMoves.CodeShower.Text += crtmp.wrapped() + "\r\n";
});
}
// tmpRowList = new List<CobRow>();
// foreach (string frmRow in fromToMoves.CodeShower.Lines)
// {
// tmpRowList.Add(new CobRow(frmRow, false));
// }
// fromToMoves.CodeShower.Text = "";
// tmpRowList.ForEach(delegate(CobRow crtmp)
// {
// fromToMoves.CodeShower.Text += crtmp.wrapped() + "\r\n";
// });
//}
//private bool okToCode(CobRow cr)
//{
// bool lOk = false;
// if (chkAttribs.Checked)
// lOk = !cr.SampleStr.Equals(NOMOVE);
// else
// lOk = !cr.isAttribute && !cr.SampleStr.Equals(NOMOVE);
// return lOk;
//}
private bool okToCode(CobRow cr)
{
bool lOk = false;
if (chkAttribs.Checked)
lOk = !cr.SampleStr.Equals(NOMOVE);
else
lOk = !cr.isAttribute && !cr.SampleStr.Equals(NOMOVE);
return lOk;
}
private void chkNewArea_CheckedChanged(object sender, EventArgs e)
{
Point locTemp = chkDisplays.Location;
if (chkNewArea.Checked)
{
chkDisplays.Text = "Move counts";
chkAttribs.Visible = true;
}
else
{
chkDisplays.Text = "(Displays)";
chkAttribs.Visible = false;
}
chkDisplays.Location = locTemp;
}
//private void chkNewArea_CheckedChanged(object sender, EventArgs e)
//{
// Point locTemp = chkDisplays.Location;
// if (chkNewArea.Checked)
// {
// chkDisplays.Text = "Move counts";
// chkAttribs.Visible = true;
// }
// else
// {
// chkDisplays.Text = "(Displays)";
// chkAttribs.Visible = false;
// }
// chkDisplays.Location = locTemp;
//}
private void outCob_KeyDown(object sender, KeyEventArgs e)
{
@ -2577,11 +2574,6 @@ namespace CobXmlSupport
cwi.ShowDialog();
}
private void chkAttribs_CheckedChanged(object sender, EventArgs e)
{
}
private void btnXmlKopAttr_Click(object sender, EventArgs e)
{
// kopiera xml inclusive Attribut