Completed code generation new method

This commit is contained in:
2014-12-09 00:52:02 +01:00
parent 1a78dcc16d
commit e0bcb9a91a
3 changed files with 88 additions and 47 deletions

View File

@ -1682,10 +1682,12 @@ namespace CobXmlSupport
private void btnTestThings_Click(object sender, EventArgs e) private void btnTestThings_Click(object sender, EventArgs e)
{ {
bool adj = true;
fromToMoves = new ShowCode(); fromToMoves = new ShowCode();
fromToMoves.Parent = this; fromToMoves.Parent = this;
fromToMoves.Labeltext = "Testing to Creat \"move From \" Code"; fromToMoves.Labeltext = "Testing to Creat \"move From \" Code";
Dictionary<string, string> testIndexes = new Dictionary<string, string>(); Dictionary<string, string> testIndexes = new Dictionary<string, string>();
IndexState lIs = new IndexState(testIndexes,rowList); IndexState lIs = new IndexState(testIndexes,rowList);
//if (qldList == null) //if (qldList == null)
@ -1711,16 +1713,31 @@ namespace CobXmlSupport
{ {
foreach (string indTxt in indSt.NewInds) foreach (string indTxt in indSt.NewInds)
{ {
fromToMoves.CodeShower.Text += "PERFORM VARYING " + indTxt + " FROM 1 BY 1 UNTIL ??? " + "\r\n"; 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;
fromToMoves.CodeShower.Text += " PERFORM VARYING " + indTxt + " FROM 1 BY 1\r\n UNTIL " +
indTxt + " > " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexRedText;
} }
} }
//obs under development //obs under development
if (tmpQfh.qualCobRow.FieldDef != "")
{
if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { }
else fromToMoves.CodeShower.Text += " IF " + tmpQfh.qualCobRow.CountIn.ToString() + "\r\n" + tmpQfh.indexText + " > 0 \r\n";
fromToMoves.CodeShower.Text += "IF "+ tmpQfh.qualCobRow.CountIn.ToString()+ " > 0 \r\n";
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString(); fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.ToString();
fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString(); fromToMoves.CodeShower.Text += " TO " + tmpQfh.ToExpString();
if (tmpQfh.qualCobRow.FieldName.ToUpper().Contains("_VALUE")) { }
else
{
fromToMoves.CodeShower.Text += " MOVE " + tmpQfh.qualCobRow.CountIn + "\r\n" + tmpQfh.indexText;
fromToMoves.CodeShower.Text += " TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexText;
fromToMoves.CodeShower.Text += " ELSE\r\n"; fromToMoves.CodeShower.Text += " ELSE\r\n";
fromToMoves.CodeShower.Text += "MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n"; fromToMoves.CodeShower.Text += " MOVE 0 TO " + tmpQfh.qualCobRow.CountIn.ToString().Replace(S.ettingPrefix, S.ettingExpPrefix) + "\r\n" + tmpQfh.indexText;
fromToMoves.CodeShower.Text += " END-IF\r\n";
}
}
} }
indSt.handleStatus(null); indSt.handleStatus(null);

View File

@ -23,24 +23,24 @@ namespace CobXmlSupport
/// <param name="new_Inds">innehåller en string array med aktuella index för den kommande variabeln</param> /// <param name="new_Inds">innehåller en string array med aktuella index för den kommande variabeln</param>
public void handleStatus(string[] new_Inds) public void handleStatus(string[] new_Inds)
{ {
Debug.WriteLine("------- present indexs -------"); //Debug.WriteLine("------- present indexs -------");
foreach (string prind in presentInds.ToArray()) //foreach (string prind in presentInds.ToArray())
{ //{
Debug.Write(prind + ", "); // Debug.Write(prind + ", ");
} //}
Debug.WriteLine(""); //Debug.WriteLine("");
Debug.WriteLine("------- new indexs -------"); //Debug.WriteLine("------- new indexs -------");
if (new_Inds != null) //if (new_Inds != null)
{ //{
foreach (string nind in new_Inds) // foreach (string nind in new_Inds)
{ // {
Debug.Write(nind + ", "); // Debug.Write(nind + ", ");
} // }
Debug.WriteLine(""); // Debug.WriteLine("");
} //}
else //else
Debug.WriteLine(" = null "); // Debug.WriteLine(" = null ");
returns = 0; returns = 0;
@ -76,21 +76,21 @@ namespace CobXmlSupport
} }
else newInds = null; else newInds = null;
Debug.WriteLine("------- returns -------"); //Debug.WriteLine("------- returns -------");
Debug.Write(returns); //Debug.Write(returns);
Debug.WriteLine(""); //Debug.WriteLine("");
Debug.WriteLine("------- tillagda Inds -------"); //Debug.WriteLine("------- tillagda Inds -------");
if (newInds != null) //if (newInds != null)
{ //{
foreach (string tlind in newInds) // foreach (string tlind in newInds)
{ // {
Debug.Write(tlind + ", "); // Debug.Write(tlind + ", ");
} // }
Debug.WriteLine(""); // Debug.WriteLine("");
} //}
else //else
Debug.WriteLine(" = null "); // Debug.WriteLine(" = null ");
} }

View File

@ -11,7 +11,7 @@ namespace CobXmlSupport
private CobRow qualifiedRow; private CobRow qualifiedRow;
private List<CobRow> qualRows; private List<CobRow> qualRows;
private Dictionary<string, string> locIndexis; private Dictionary<string, string> locIndexis;
private string qfhCode, qfhInd ; private string qfhCode, qfhInd, qfhRedInd ;
private string[] indexStrs; private string[] indexStrs;
public CobRow qualCobRow public CobRow qualCobRow
@ -27,6 +27,11 @@ namespace CobXmlSupport
get { return qfhInd; } get { return qfhInd; }
} }
public string indexRedText
{
get { return qfhRedInd; }
}
public string[] indexStrings public string[] indexStrings
{ {
get { return indexStrs; } get { return indexStrs; }
@ -91,15 +96,14 @@ namespace CobXmlSupport
private void initLocIndexTxt() private void initLocIndexTxt()
{ {
qfhInd = ""; qfhInd = "";
qfhRedInd = "";
indexStrs = null; indexStrs = null;
if (locIndexis!=null && locIndexis.Count > 0) if (locIndexis!=null && locIndexis.Count > 0)
{ {
indexStrs=new string[locIndexis.Count];
int indCnt = 0; int indCnt = 0;
foreach (KeyValuePair<string, string> tmpInd in locIndexis) indexStrs = locIndexis.Values.ToArray();
foreach (KeyValuePair<string, string> tmpInd in locIndexis.Reverse())
{ {
indexStrs[indCnt++] = tmpInd.Value;
if (qfhInd.Length == 0) if (qfhInd.Length == 0)
{ {
qfhInd = " ( " + tmpInd.Value; qfhInd = " ( " + tmpInd.Value;
@ -110,7 +114,26 @@ namespace CobXmlSupport
} }
} }
qfhInd += " )\r\n"; qfhInd += " )\r\n";
if (locIndexis.Count > 1)
{
foreach (KeyValuePair<string, string> tmpInd in locIndexis.Reverse())
{
indCnt++;
if (indCnt == locIndexis.Count) break;
if (qfhRedInd.Length == 0)
{
qfhRedInd = " ( " + tmpInd.Value;
} }
else
{
qfhRedInd += ",\r\n " + tmpInd.Value;
}
}
qfhRedInd += " )\r\n";
}
}
} }
@ -143,6 +166,7 @@ namespace CobXmlSupport
else break; else break;
} }
initLocIndexTxt(); initLocIndexTxt();
} }
public override string ToString() public override string ToString()