For bug let's create a simple setup in any WinCCOA project by creating two library CTRL scripts called A.ctl and B.ctl which can be described as follows:
A.ctl
Code: Select all
#uses "B"
class A
{
public A()
{}
public void print(string s)
{
DebugN(s);
}
public B giveB()
{
B ret = B();
return ret;
}
};
Code: Select all
//#uses "A"
class B
{
public B()
{}
public void print(string s)
{
DebugTN(s);
}
//public A giveA()
//{
// A ret = A();
// return ret;
//}
};
At this point we could also write some code and execute it with the help of a CTRL manager.
test.ctl
Code: Select all
#uses "A"
void main()
{
A test = A();
test.print("something");
B test2 = test.giveB();
}
When we comment in the commented out code from class B, which provides us functionality to acquire an object of the type A, we notice the following when starting the CTRL manager again.
Code: Select all
WCCOActrl (5), 2019.03.01 10:50:11.843, CTRL, WARNING, 81, Syntax error, D:\Projects\SIS_PV_1.0_RC24\FirstEmptyProject\scripts\libs\B.ctl, Line: 13
public A giveA()
^
WCCOActrl (5), 2019.03.01 10:50:11.849, CTRL, WARNING, 81, Syntax error, D:\Projects\SIS_PV_1.0_RC24\FirstEmptyProject\scripts\libs\A.ctl, Line: 3
class A
^
WCCOActrl (5), 2019.03.01 10:50:11.855, CTRL, WARNING, 81, Syntax error, test.ctl, Line: 6
void main()
^
Just in case we actually coded wrong, let's just comment out the giveA() function and it's contents while keeping the #uses statement.
Code: Select all
WCCOActrl (5), 2019.03.01 10:52:29.887, PARAM,WARNING, 7, Datapoint does not exist, CtrlDbg::init, _CtrlDebug_CTRL_5.Command
WCCOActrl5:["something"]
Code: Select all
#uses "A"
class B
{
private A myField;
public B()
{}
public void print(string s)
{
DebugTN(s);
}
//public A giveA()
//{
// A ret = A();
// return ret;
//}
};
Code: Select all
WCCOActrl (5), 2019.03.01 10:55:02.090, CTRL, WARNING, 81, Syntax error, D:\Projects\SIS_PV_1.0_RC24\FirstEmptyProject\scripts\libs\B.ctl, Line: 5
private A myField;
^
WCCOActrl (5), 2019.03.01 10:55:02.097, CTRL, WARNING, 81, Syntax error, D:\Projects\SIS_PV_1.0_RC24\FirstEmptyProject\scripts\libs\A.ctl, Line: 3
class A
^
WCCOActrl (5), 2019.03.01 10:55:02.103, CTRL, WARNING, 81, Syntax error, test.ctl, Line: 6
void main()
^
When trying to put both classes in the same file, it fails also, because forward declaration doesn't work in CTRL and you have to declare one class before the other, which prohibits the first class to use any member of a type that is defined only after itself.
I would really appreciate if CTRL++ would allow for circular dependencies in some form.
Is this by design?
Is there a way to fix this?
Will a future update address this issue?