#include "WfRuntime.h"
#include <math.h>
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
namespace
{
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
reflection
;
using
namespace
reflection
::
description
;
::
(
*
,
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
*
,
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
*
,
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
::
(
reflection
::
description
::
*
)
{
;
breakPoint
.
=
;
breakPoint
.
=
;
return
breakPoint
;
}
bool
::
::
(
const
&
,
bool
)
{
if
(
!=
.
)
return
>
.
;
if
(
!=
.
)
return
true
;
if
(
!=
.
)
return
>
.
;
auto
= (
?
->
:
->
);
auto
&
=
debugInfo
];
auto
&
=
debugInfo
.
];
if
(
range1
.
!=
range2
.
)
return
true
;
if
(
range1
.
.
!=
range2
.
.
)
return
true
;
return
false
;
}
bool
::
::
(
const
&
,
bool
)
{
if
(
!=
.
)
return
true
;
if
(
!=
.
)
return
true
;
if
(
!=
.
)
return
true
;
auto
= (
?
->
:
->
);
auto
&
=
debugInfo
];
auto
&
=
debugInfo
.
];
if
(
range1
.
!=
range2
.
)
return
true
;
if
(
range1
.
.
!=
range2
.
.
)
return
true
;
return
false
;
}
void
::
()
{
}
void
::
()
{
}
void
::
()
{
}
::
::
MakeCurrentInstructionLocation
()
{
auto
=
.
() -
1
];
;
il
.
=
.
() -
1
;
il
.
=
context
->
.
();
il
.
=
context
->
.
() -
1
;
il
.
=
context
->
context
->
.
() -
1
].
;
return
il
;
}
template
<
typename
>
bool
::
(
const
&
,
collections
::
<
,
>&
)
{
if
(
)
{
return
false
;
}
=
true
;
bool
=
false
;
=
.
().
(
);
if
(
index
!= -
1
)
{
index
=
.
()
index
];
const
auto
&
=
index
];
if
(
breakPoint
.
&&
breakPoint
.
)
{
if
(
breakPoint
.
)
{
activated
=
breakPoint
.
(
this
);
breakPoint
.
(
this
,
activated
);
}
else
{
activated
=
true
;
}
}
if
(
activated
)
{
=
index
;
}
}
=
false
;
return
activated
;
}
void
::
(
*
)
{
if
(
.
() ==
0
)
{
=
;
();
();
if
(
==
)
{
=
;
}
}
.
(
);
}
void
::
(
*
)
{
auto
=
.
() -
1
];
.
(
.
() -
1
);
CHECK_ERROR(context == oldContext, L"vl::workflow::runtime::WfDebugger::LeaveThreadContext(WfRuntimeThreadContext*)#EnterThreadContext and LeaveThreadContext should be called in pairs.");
do
{
if
(!(
==
oldContext
))
throw
(
L"vl::workflow::runtime::WfDebugger::LeaveThreadContext(WfRuntimeThreadContext*)#EnterThreadContext and LeaveThreadContext should be called in pairs."
);}
while
(
0
);
if
(
.
() ==
0
)
{
=
;
();
}
}
bool
::
(
*
,
)
{
if
(
!=
)
{
auto
=
MakeCurrentInstructionLocation
();
bool
=
false
;
switch
(
)
{
case
:
needToBreak
=
.
(
il
,
);
break
;
case
:
needToBreak
=
.
(
il
,
);
break
;
default
:;
}
if
(
needToBreak
)
{
il
;
=
::
;
return
true
;
}
}
switch
(
)
{
case
:
case
:
=
::
;
return
true
;
default
:;
}
(
,
);
return
(
key
,
);
}
bool
::
(
*
,
)
{
(
,
);
return
(
key
,
);
}
bool
::
(
*
,
)
{
(
,
);
return
(
key
,
);
}
bool
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
(
,
);
(
nullptr
,
);
return
(
key1
,
) ||
(
key2
,
);
}
bool
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
(
,
);
(
nullptr
,
);
return
(
key1
,
) ||
(
key2
,
);
}
bool
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
(
,
);
(
nullptr
,
);
return
(
key1
,
) ||
(
key2
,
);
}
bool
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
(
,
);
(
nullptr
,
);
return
(
key1
,
) ||
(
key2
,
);
}
bool
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
(
,
);
(
nullptr
,
);
return
(
key1
,
) ||
(
key2
,
);
}
bool
::
(
reflection
::
*
,
reflection
::
description
::
*
)
{
(
,
);
(
nullptr
,
);
return
(
key1
,
) ||
(
key2
,
);
}
bool
::
(
reflection
::
description
::
*
)
{
return
(
,
);
}
bool
::
(
<
>
)
{
if
(
)
{
=
;
return
true
;
}
else
{
return
false
;
}
}
bool
::
()
{
if
(
==
)
{
return
false
;
}
=
>=
0
?
:
;
while
(
==
||
==
)
{
();
}
if
(
==
)
{
=
;
}
return
true
;
}
#define TEST(AVAILABLE, KEY, MAP) if (AVAILABLE && available == MAP.Keys().Contains(KEY)) return false;
#define SET(KEY, MAP) if (available) MAP.Add(KEY, index); else MAP.Remove(KEY);
#define SETC(AVAILABLE, KEY, MAP) if (AVAILABLE) {if (available) MAP.Add(KEY, index); else MAP.Remove(KEY);}
bool
::
(
const
&
,
bool
,
)
{
switch
(
.
)
{
case
::
:
{
(
.
,
.
);
TEST(true, key, insBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
SET(key, insBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
break
;
case
::
:
{
(
.
,
.
);
TEST(true, key, getGlobalVarBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
SET(key, getGlobalVarBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
break
;
case
::
:
{
(
.
,
.
);
TEST(true, key, setGlobalVarBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
SET(key, setGlobalVarBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
break
;
case
::
:
{
(
.
,
.
);
(
.
,
.
->
());
TEST(true, key1, getPropertyBreakPoints);
if
(
true
&&
==
.
().
(
key1
))
return
false
;;
TEST(key2.f1, key2, invokeMethodBreakPoints);
if
(
key2
.f1 &&
==
.
().
(
key2
))
return
false
;;
SET(key1, getPropertyBreakPoints);
if
(
)
.
(
key1
,
);
else
.
(
key1
);;
SETC(key2.f1, key2, invokeMethodBreakPoints);
if
(
key2
.f1) {
if
(
)
.
(
key2
,
);
else
.
(
key2
);};
}
break
;
case
::
:
{
(
.
,
.
);
(
.
,
.
->
());
TEST(true, key1, setPropertyBreakPoints);
if
(
true
&&
==
.
().
(
key1
))
return
false
;;
TEST(key2.f1, key2, invokeMethodBreakPoints);
if
(
key2
.f1 &&
==
.
().
(
key2
))
return
false
;;
SET(key1, setPropertyBreakPoints);
if
(
)
.
(
key1
,
);
else
.
(
key1
);;
SETC(key2.f1, key2, invokeMethodBreakPoints);
if
(
key2
.f1) {
if
(
)
.
(
key2
,
);
else
.
(
key2
);};
}
break
;
case
::
:
{
(
.
,
.
);
TEST(true, key, attachEventBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
SET(key, attachEventBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
break
;
case
::
:
{
(
.
,
.
);
TEST(true, key, detachEventBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
SET(key, detachEventBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
break
;
case
::
:
{
(
.
,
.
);
TEST(true, key, invokeEventBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
SET(key, invokeEventBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
break
;
case
::
:
{
(
.
,
.
);
TEST(true, key, invokeMethodBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
SET(key, invokeMethodBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
break
;
case
::
:
{
auto
=
.
->
();
=
group
?
group
->
() :
0
;
TEST(true, breakPoint.typeDescriptor, createObjectBreakPoints);
if
(
true
&&
==
.
().
(
.
))
return
false
;;
for
(
=
0
;
i
<
count
;
i
++)
{
(
nullptr
,
group
->
(
i
));
TEST(true, key, invokeMethodBreakPoints);
if
(
true
&&
==
.
().
(
key
))
return
false
;;
}
SET(breakPoint.typeDescriptor, createObjectBreakPoints);
if
(
)
.
(
.
,
);
else
.
(
.
);;
for
(
=
0
;
i
<
count
;
i
++)
{
(
nullptr
,
group
->
(
i
));
SET(key, invokeMethodBreakPoints);
if
(
)
.
(
key
,
);
else
.
(
key
);;
}
}
break
;
default
:
return
false
;
}
return
true
;
}
#undef TEST
#undef SET
#undef SETC
::
()
{
}
::
()
{
}
::
(
const
&
)
{
=
.
();
if
(
.
() >
0
)
{
index
=
.
() -
1
];
}
if
(!
(
,
true
,
index
))
{
return
-
1
;
}
if
(
index
==
.
())
{
.
(
);
}
else
{
.
(
.
() -
1
);
index
]
;
}
index
].
=
index
;
index
].
=
true
;
index
].
=
true
;
index
].
nullptr
;
return
index
;
}
::
(
*
,
,
,
bool
)
{
auto
&
= (
?
->
:
->
)
;
<
,
>
(
,
);
=
codeInsMap
.
().
(
key
);
if
(
index
== -
1
)
{
return
-
1
;
}
=
codeInsMap
.
(
index
)
0
];
return
(
::
(
,
ins
));
}
bool
::
(
)
{
return
0
<=
&&
<
.
() && !
.
(
);
}
::
()
{
return
.
();
}
const
&
::
(
)
{
return
];
}
bool
::
(
)
{
if
(
<
0
||
>=
.
())
{
return
false
;
}
auto
&
=
];
if
(!
breakPoint
.
|| !
(
breakPoint
,
false
, -
1
))
{
return
false
;
}
breakPoint
.
=
false
;
.
(
);
return
true
;
}
bool
::
(
,
bool
)
{
if
(
0
<=
&&
<=
.
())
{
auto
&
=
];
if
(
breakPoint
.
)
{
breakPoint
.
=
;
return
true
;
}
}
return
false
;
}
bool
::
()
{
return
;
}
void
::
(
bool
)
{
=
;
}
bool
::
()
{
if
(
!=
&&
!=
)
{
return
false
;
}
=
;
=
;
return
true
;
}
bool
::
()
{
if
(
!=
&&
!=
)
{
return
false
;
}
=
;
return
true
;
}
bool
::
()
{
if
(
!=
&&
!=
&&
!=
)
{
return
false
;
}
=
;
return
true
;
}
bool
::
(
bool
)
{
if
(
!=
&&
!=
&&
!=
)
{
return
false
;
}
if
(
!=
)
{
=
;
MakeCurrentInstructionLocation
();
}
=
;
=
;
return
true
;
}
bool
::
(
bool
)
{
if
(
!=
&&
!=
&&
!=
)
{
return
false
;
}
if
(
!=
)
{
=
;
MakeCurrentInstructionLocation
();
}
=
;
=
;
=
;
return
true
;
}
::
::
()
{
return
;
}
::
::
()
{
return
;
}
::
GetLastActivatedBreakPoint
()
{
return
;
}
const
::
&
::
()
{
return
;
}
*
::
()
{
if
(
.
() ==
0
)
{
return
nullptr
;
}
return
.
() -
1
];
}
const
parsing
::
&
::(
bool
,
* ,
)
{
if
(!
)
{
=
();
}
if
(
== -
1
)
{
=
->
.
() -
1
;
}
auto
& =
->
];
auto
=
stackFrame
.
;
auto
= (
?
->
:
->
);
return
debugInfo
ins
];
}
reflection
::
description
::
::
(
const
&
,
*
,
)
{
if
(!
)
{
=
();
}
if
(
== -
1
)
{
=
->
.
() -
1
;
}
auto
&
=
->
];
auto
=
->
stackFrame
.
];
=
function
.
(
);
if
(
index
!= -
1
)
{
return
->
stackFrame
.
+
index
];
}
index
=
function
.
(
);
if
(
index
!= -
1
)
{
return
->
stackFrame
.
+
function
.
() +
index
];
}
index
=
function
.
(
);
if
(
index
!= -
1
)
{
return
stackFrame
.
index
];
}
index
=
->
.
(
);
if
(
index
!= -
1
)
{
return
->
index
];
}
return
();
}
<
<
>>
;
*
()
{
return
(
GetDebuggerForCurrentThread
().
());
}
*
(
*
)
{
return
;
}
<
>
GetDebuggerForCurrentThread
()
{
return
threadDebugger
.
() ?
threadDebugger
.
() :
nullptr
;
}
void
SetDebuggerForCurrentThread
(
<
>
)
{
threadDebugger
.
(
);
}
}
}
}
#endif