mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-21 04:31:33 +08:00
Update release
This commit is contained in:
@@ -5394,7 +5394,7 @@ GuiInstanceLocalizedStrings
|
||||
if (resultExpr)
|
||||
{
|
||||
auto binaryExpr = MakePtr<WfBinaryExpression>();
|
||||
binaryExpr->op = WfBinaryOperator::Union;
|
||||
binaryExpr->op = WfBinaryOperator::FlagAnd;
|
||||
binaryExpr->first = resultExpr;
|
||||
binaryExpr->second = strExpr;
|
||||
|
||||
@@ -9255,11 +9255,9 @@ GuiIqPrint
|
||||
.\INSTANCEQUERY\GUIINSTANCEQUERY_AST.CPP
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::GuiInstanceQuery_Parser.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:GuiInstanceQuery_Parser.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
@@ -9417,11 +9415,9 @@ namespace vl
|
||||
.\INSTANCEQUERY\GUIINSTANCEQUERY_PARSER.CPP
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::GuiInstanceQuery_Parser.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:GuiInstanceQuery_Parser.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
|
||||
+29
-8
@@ -325,11 +325,9 @@ namespace vl
|
||||
.\INSTANCEQUERY\GUIINSTANCEQUERY_AST.H
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::GuiInstanceQuery_Parser.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:GuiInstanceQuery_Parser.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_INSTANCEQUERY_GUIINSTANCEQUERY_PARSER_AST
|
||||
@@ -340,21 +338,36 @@ namespace vl
|
||||
{
|
||||
namespace presentation
|
||||
{
|
||||
/// <summary>Token types. Values of enum items will be used in <see cref="vl::regex::RegexToken::token"/>.</summary>
|
||||
enum class GuiIqParserTokenIndex
|
||||
{
|
||||
/// <summary>Token INDIRECT: ////</summary>
|
||||
INDIRECT = 0,
|
||||
/// <summary>Token DIRECT: //</summary>
|
||||
DIRECT = 1,
|
||||
/// <summary>Token NAME: [a-zA-Z_][a-zA-Z0-9]*</summary>
|
||||
NAME = 2,
|
||||
/// <summary>Token WILDCARD: /*</summary>
|
||||
WILDCARD = 3,
|
||||
/// <summary>Token OPEN: /(</summary>
|
||||
OPEN = 4,
|
||||
/// <summary>Token CLOSE: /)</summary>
|
||||
CLOSE = 5,
|
||||
/// <summary>Token XOR: /^</summary>
|
||||
XOR = 6,
|
||||
/// <summary>Token INTERSECT: /*</summary>
|
||||
INTERSECT = 7,
|
||||
/// <summary>Token UNION: /+</summary>
|
||||
UNION = 8,
|
||||
/// <summary>Token SUBSTRACT: -</summary>
|
||||
SUBSTRACT = 9,
|
||||
/// <summary>Token ATTRIBUTE: @</summary>
|
||||
ATTRIBUTE = 10,
|
||||
/// <summary>Token COLON: :</summary>
|
||||
COLON = 11,
|
||||
/// <summary>Token DOT: .</summary>
|
||||
DOT = 12,
|
||||
/// <summary>Discardable token SPACE: /s+</summary>
|
||||
SPACE = 13,
|
||||
};
|
||||
class GuiIqQuery;
|
||||
@@ -472,6 +485,8 @@ namespace vl
|
||||
END_INTERFACE_PROXY(vl::presentation::GuiIqQuery::IVisitor)
|
||||
|
||||
#endif
|
||||
/// <summary>Load all reflectable AST types, only available when <b>VCZH_DEBUG_NO_REFLECTION</b> is off.</summary>
|
||||
/// <returns>Returns true if this operation succeeded.</returns>
|
||||
extern bool GuiIqLoadTypes();
|
||||
}
|
||||
}
|
||||
@@ -482,11 +497,9 @@ namespace vl
|
||||
.\INSTANCEQUERY\GUIINSTANCEQUERY_PARSER.H
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::GuiInstanceQuery_Parser.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:GuiInstanceQuery_Parser.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_INSTANCEQUERY_GUIINSTANCEQUERY_PARSER_PARSER
|
||||
@@ -497,8 +510,16 @@ namespace vl
|
||||
{
|
||||
namespace presentation
|
||||
{
|
||||
/// <summary>Get the grammar definition for this parser.</summary>
|
||||
/// <returns>The grammar definition for this parser.</returns>
|
||||
extern vl::WString GuiIqGetParserTextBuffer();
|
||||
/// <summary>Convert parser result to a strong typed AST node. Usually you don't need to use this function, unless you are doing meta programming like error recovering or implementing intellisense for an editor.</summary>
|
||||
/// <returns>Returns the strong typed AST node.</returns>
|
||||
/// <param name="node">The parser result.</param>
|
||||
/// <param name="tokens">Tokens for parsing. You can get the <see cref="vl::regex::RegexLexer"/> by calling <see cref="vl::parsing::tabling::ParsingTable::GetLexer"/> from <see cref="GuiIqLoadTable"/></param>
|
||||
extern vl::Ptr<vl::parsing::ParsingTreeCustomBase> GuiIqConvertParsingTreeNode(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens);
|
||||
/// <summary>Create the parser table. You should cache the value if possible, for improving performance.</summary>
|
||||
/// <returns>The created parser table.</returns>
|
||||
extern vl::Ptr<vl::parsing::tabling::ParsingTable> GuiIqLoadTable();
|
||||
|
||||
extern vl::Ptr<vl::parsing::ParsingTreeNode> GuiIqParseAsParsingTreeNode(const vl::WString& input, vl::Ptr<vl::parsing::tabling::ParsingTable> table, vl::collections::List<vl::Ptr<vl::parsing::ParsingError>>& errors, vl::vint codeIndex = -1);
|
||||
|
||||
+68
-75
File diff suppressed because one or more lines are too long
+616
-249
File diff suppressed because it is too large
Load Diff
@@ -2265,7 +2265,7 @@ ITypeManager
|
||||
|
||||
/// <summary>Unload all types and free the type manager.</summary>
|
||||
/// <returns>Returns true if this operation succeeded.</returns>
|
||||
/// <remakrs>
|
||||
/// <remarks>
|
||||
/// After calling this function, you can no longer register new types,
|
||||
/// and calling <see cref="GetGlobalTypeManager"/> will always get null.
|
||||
/// </remarks>
|
||||
@@ -2274,7 +2274,7 @@ ITypeManager
|
||||
|
||||
/// <summary>Unload all types and reset the type manager.</summary>
|
||||
/// <returns>Returns true if this operation succeeded.</returns>
|
||||
/// <remakrs>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// This function is similar to <see cref="DestroyGlobalTypeManager"/>,
|
||||
/// but calling this function allows types to be registsred again.
|
||||
|
||||
@@ -28877,11 +28877,9 @@ Print (Module)
|
||||
.\EXPRESSION\WFEXPRESSION_AST.CPP
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::WfExpression.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:WfExpression.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
@@ -30878,11 +30876,9 @@ namespace vl
|
||||
.\EXPRESSION\WFEXPRESSION_COPY.CPP
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::WfExpression.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:WfExpression.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
@@ -33072,11 +33068,9 @@ ModuleVisitor
|
||||
.\EXPRESSION\WFEXPRESSION_EMPTY.CPP
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::WfExpression.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:WfExpression.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
@@ -33526,11 +33520,9 @@ ModuleUsingFragmentVisitor
|
||||
.\EXPRESSION\WFEXPRESSION_PARSER.CPP
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::WfExpression.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:WfExpression.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
@@ -37748,11 +37740,9 @@ Table Generation
|
||||
.\EXPRESSION\WFEXPRESSION_TRAVERSE.CPP
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
Parser::WfExpression.parser.txt
|
||||
|
||||
This file is generated by: Vczh Parser Generator
|
||||
From parser definition:WfExpression.parser.txt
|
||||
Licensed under https://github.com/vczh-libraries/License
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
|
||||
+215
-42
File diff suppressed because it is too large
Load Diff
@@ -390,13 +390,18 @@ namespace vl
|
||||
Coroutine
|
||||
***********************************************************************/
|
||||
|
||||
/// <summary>Status of a coroutine.</summary>
|
||||
enum class CoroutineStatus
|
||||
{
|
||||
/// <summary>The coroutine is waiting for resuming.</summary>
|
||||
Waiting,
|
||||
/// <summary>The coroutine is being executed.</summary>
|
||||
Executing,
|
||||
/// <summary>The coroutine has stopped.</summary>
|
||||
Stopped,
|
||||
};
|
||||
|
||||
/// <summary>An object providing input information when resuming a coroutine.</summary>
|
||||
class CoroutineResult : public virtual IDescriptable, public Description<CoroutineResult>
|
||||
{
|
||||
protected:
|
||||
@@ -404,17 +409,38 @@ Coroutine
|
||||
Ptr<IValueException> failure;
|
||||
|
||||
public:
|
||||
/// <summary>Get the object provided to the coroutine. This object is the return value for the pending async operation, like $Await.</summary>
|
||||
/// <returns>The object provided to the coroutine.</returns>
|
||||
Value GetResult();
|
||||
|
||||
/// <summary>Set the object provided to the coroutine.</summary>
|
||||
/// <param name="value">The object provided to the coroutine.</summary>
|
||||
void SetResult(const Value& value);
|
||||
|
||||
/// <summary>Get the error provided to the coroutine. When it is not nullptr, the return value of <see cref="GetResult"/> is ignored.</summary>
|
||||
/// <returns>The error provided to the coroutine.</returns>
|
||||
Ptr<IValueException> GetFailure();
|
||||
|
||||
/// <summary>Set the error provided to the coroutine.</summary>
|
||||
/// <param name="value">The error provided to the coroutine.</summary>
|
||||
void SetFailure(Ptr<IValueException> value);
|
||||
};
|
||||
|
||||
/// <summary>A coroutine. This is typically created by a Workflow script.</summary>
|
||||
class ICoroutine : public virtual IDescriptable, public Description<ICoroutine>
|
||||
{
|
||||
public:
|
||||
/// <summary>Resume the coroutine.</summary>
|
||||
/// <param name="raiseException">Set to true to raise an exception that the coroutine encountered. The same exception is accessible by <see cref="GetFailure"/>.</param>
|
||||
/// <param name="output">Input for the coroutine in this resuming.</param>
|
||||
virtual void Resume(bool raiseException, Ptr<CoroutineResult> output) = 0;
|
||||
|
||||
/// <summary>Returns the current exception.</summary>
|
||||
/// <returns>The current exception. It could cause by the Workflow script that creates this coroutine, or by calling <see cref="Resume"/> when this coroutine is in an inappropriate state.</returns>
|
||||
virtual Ptr<IValueException> GetFailure() = 0;
|
||||
|
||||
/// <summary>Returns the status of the coroutine.</summary>
|
||||
/// <returns>The status of the coroutine. <see cref="Resume"/> can be called only when this function returns <see cref="CoroutineStatus::Waiting"/>.</returns>
|
||||
virtual CoroutineStatus GetStatus() = 0;
|
||||
};
|
||||
|
||||
@@ -444,13 +470,18 @@ Coroutine (Enumerable)
|
||||
Coroutine (Async)
|
||||
***********************************************************************/
|
||||
|
||||
/// <summary>Status of am async operation.</summary>
|
||||
enum class AsyncStatus
|
||||
{
|
||||
/// <summary>The async operation is ready to execute.</summary>
|
||||
Ready,
|
||||
/// <summary>The async operation is being executed.</summary>
|
||||
Executing,
|
||||
/// <summary>The async operation has stopped.</summary>
|
||||
Stopped,
|
||||
};
|
||||
|
||||
/// <summary>A context providing communication between the caller and the async operation.</summary>
|
||||
class AsyncContext : public virtual IDescriptable, public Description<AsyncContext>
|
||||
{
|
||||
protected:
|
||||
@@ -459,51 +490,128 @@ Coroutine (Async)
|
||||
Value context;
|
||||
|
||||
public:
|
||||
/// <summary>Create a context.</summary>
|
||||
/// <param name="_context">Set the initial return value for <see cref="GetContext"/> (optional)..</param>
|
||||
AsyncContext(const Value& _context = {});
|
||||
~AsyncContext();
|
||||
|
||||
/// <summary>Test if the current async operation is expected to cancel.</summary>
|
||||
/// <returns>Returns true if the current async operation is expected to cancel.</returns>
|
||||
/// <remarks>
|
||||
/// This function is accessible by "$.IsCancelled" in an $Async coroutine.
|
||||
/// A cancelable async operation should check this value when it is able to stop properly, and stop when it is true.
|
||||
/// </remarks>
|
||||
bool IsCancelled();
|
||||
|
||||
/// <summary>Set <see cref="IsCancelled"/> to true.</summary>
|
||||
/// <returns>Returns true when this operation succeeded.</returns>
|
||||
bool Cancel();
|
||||
|
||||
/// <summary>Returns a value that is accessible in Workflow script by "$.Context" in an $Async coroutine.</summary>
|
||||
/// <returns>A value that is accessible in Workflow script by "$.Context" in an $Async coroutine.</returns>
|
||||
const description::Value& GetContext();
|
||||
|
||||
/// <summary>Set a value that is accessible F</summary>
|
||||
/// <param name="value">A value that is accessible in Workflow script by "$.Context" in an $Async coroutine.</param>
|
||||
void SetContext(const description::Value& value);
|
||||
};
|
||||
|
||||
/// <summary>An async operation.</summary>
|
||||
class IAsync : public virtual IDescriptable, public Description<IAsync>
|
||||
{
|
||||
public:
|
||||
/// <summary>Get the status of this async operation.</summary>
|
||||
/// <returns>The status of this async operation.</returns>
|
||||
virtual AsyncStatus GetStatus() = 0;
|
||||
|
||||
/// <summary>Run this async operation.</summary>
|
||||
/// <returns>Returns true when this operation succeeded. This function cannot be called twice on the same object.</returns>
|
||||
/// <param name="callback">A callback to execute when the async operation finished.</param>
|
||||
/// <param name="context">A context object that is accessible in Workflow script by "$" in an $Async coroutine (optional).</param>
|
||||
virtual bool Execute(const Func<void(Ptr<CoroutineResult>)>& callback, Ptr<AsyncContext> context = nullptr) = 0;
|
||||
|
||||
/// <summary>Create an async operation that finished after a specified moment of time.</summary>
|
||||
/// <returns>Returns the created async operation.</returns>
|
||||
/// <param name="milliseconds">The time in milliseconds to wait. It counts from when this function is called, not from when this async operation is executed.</param>
|
||||
static Ptr<IAsync> Delay(vint milliseconds);
|
||||
};
|
||||
|
||||
/// <summary>A promise object that controls a <see cref="IFuture"/> object.</summary>
|
||||
class IPromise : public virtual IDescriptable, public Description<IPromise>
|
||||
{
|
||||
public:
|
||||
/// <summary>Mark the <see cref="IFuture"/> object as finished by providing a value.</summary>
|
||||
/// <returns>Returns true when this operation succeeded. Multiple calls to <see cref="SendResult"/> and <see cref="SendFailure"/> cause a failure.</returns>
|
||||
/// <param name="result">The result of the <see cref="IFuture"/> object.</param>
|
||||
virtual bool SendResult(const Value& result) = 0;
|
||||
|
||||
/// <summary>Mark the <see cref="IFuture"/> object as finished by providing an exception.</summary>
|
||||
/// <returns>Returns true when this operation succeeded. Multiple calls to <see cref="SendResult"/> and <see cref="SendFailure"/> cause a failure.</returns>
|
||||
/// <param name="failure">The exception of the <see cref="IFuture"/> object.</param>
|
||||
virtual bool SendFailure(Ptr<IValueException> failure) = 0;
|
||||
};
|
||||
|
||||
/// <summary>An async operation in the future-promise pattern.</summary>
|
||||
class IFuture : public virtual IAsync, public Description<IFuture>
|
||||
{
|
||||
public:
|
||||
/// <summary>Get the <see cref="IPromise"/> that controls this future object.</summary>
|
||||
/// <returns>The <see cref="IPromise"/> that controls this future object.</returns>
|
||||
virtual Ptr<IPromise> GetPromise() = 0;
|
||||
|
||||
/// <summary>Create a future object.</summary>
|
||||
/// <returns>The created future object.</returns>
|
||||
static Ptr<IFuture> Create();
|
||||
};
|
||||
|
||||
/// <summary>A scheduler that controls how async operations are executed. It needs to be implemented and attached to threads that run async operations.</summary>
|
||||
/// <remarks>See <a href="/workflow/lang/coroutine_async.html">Async Coroutine</a> for more information.</remarks>
|
||||
class IAsyncScheduler : public virtual IDescriptable, public Description<IAsyncScheduler>
|
||||
{
|
||||
public:
|
||||
/// <summary>Called when a callback needs to be executed in any thread.</summary>
|
||||
/// <param name="callback">The callback to execute.</param>
|
||||
/// <remarks>
|
||||
/// You can decide which thread to execute.
|
||||
/// For GacUI, the scheduler that attached to the UI thread will execute this callback in the UI thread.
|
||||
/// </remarks>
|
||||
virtual void Execute(const Func<void()>& callback) = 0;
|
||||
|
||||
/// <summary>Called when a callback needs to be executed in another thread.</summary>
|
||||
/// <param name="callback">The callback to execute.</param>
|
||||
/// <remarks>
|
||||
/// You can decide which thread to execute except the current one.
|
||||
/// For GacUI, the scheduler that attached to any thread will execute this callback in a random background thread.
|
||||
/// </remarks>
|
||||
virtual void ExecuteInBackground(const Func<void()>& callback) = 0;
|
||||
|
||||
/// <summary>Called when a callback needs to be executed in any thread after a specified moment of time.</summary>
|
||||
/// <param name="callback">The callback to execute.</param>
|
||||
/// <param name="milliseconds">The time in milliseconds to wait.</param>
|
||||
/// <remarks>
|
||||
/// You can decide which thread to execute.
|
||||
/// For GacUI, the scheduler that attached to the UI thread will execute this callback in the UI thread.
|
||||
/// </remarks>
|
||||
virtual void DelayExecute(const Func<void()>& callback, vint milliseconds) = 0;
|
||||
|
||||
/// <summary>Attach a scheduler for all threads.</summary>
|
||||
/// <param name="scheduler">The scheduler to attach.</param>
|
||||
static void RegisterDefaultScheduler(Ptr<IAsyncScheduler> scheduler);
|
||||
|
||||
/// <summary>Attach a scheduler for the current thread.</summary>
|
||||
/// <param name="scheduler">The scheduler to attach.</param>
|
||||
static void RegisterSchedulerForCurrentThread(Ptr<IAsyncScheduler> scheduler);
|
||||
|
||||
/// <summary>Detach the scheduler for all threads.</summary>
|
||||
/// <returns>The previously attached scheduler.</returns>
|
||||
static Ptr<IAsyncScheduler> UnregisterDefaultScheduler();
|
||||
|
||||
/// <summary>Detach the scheduler for the current thread.</summary>
|
||||
/// <returns>The previously attached scheduler.</returns>
|
||||
static Ptr<IAsyncScheduler> UnregisterSchedulerForCurrentThread();
|
||||
|
||||
/// <summary>Get the attached scheduler for the current thread.</summary>
|
||||
/// <returns>The attached scheduler. If there is no scheduler that is attached to this particular thread, the default scheduler kicks in.</returns>
|
||||
static Ptr<IAsyncScheduler> GetSchedulerForCurrentThread();
|
||||
};
|
||||
|
||||
@@ -555,6 +663,7 @@ Coroutine (State Machine)
|
||||
Libraries
|
||||
***********************************************************************/
|
||||
|
||||
/// <summary>system::Sys includes a lot of utility functions for type conversion, string operations and date time operations for a Workflow script.</summary>
|
||||
class Sys : public Description<Sys>
|
||||
{
|
||||
public:
|
||||
@@ -598,6 +707,7 @@ Libraries
|
||||
static Ptr<IValueEnumerable> ReverseEnumerable(Ptr<IValueEnumerable> value);
|
||||
};
|
||||
|
||||
/// <summary>system::Math includes math functions for a Workflow script.</summary>
|
||||
class Math : public Description<Math>
|
||||
{
|
||||
public:
|
||||
@@ -637,6 +747,17 @@ Libraries
|
||||
static double Trunc(double value) { return trunc(value); }
|
||||
};
|
||||
|
||||
/// <summary>system::Math includes localization awared formatting operations for a Workflow script.</summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// There are three locales that reflect the configuration of the operating system:
|
||||
/// <ul>
|
||||
/// <li><b>Invariant</b>: An invariant locale for general languages.</li>
|
||||
/// <li><b>System</b>: Locale for the operating system, including the file system.</li>
|
||||
/// <li><b>User</b>: Locale for UI of the operating system.</li>
|
||||
/// </ul>
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
class Localization : public Description<Localization>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -2571,7 +2571,7 @@ InstructionLocation
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
WfDebugger
|
||||
WfDebugger Callback Handlers
|
||||
***********************************************************************/
|
||||
|
||||
void WfDebugger::OnBlockExecution()
|
||||
@@ -2617,7 +2617,7 @@ WfDebugger
|
||||
if (breakPoint.action)
|
||||
{
|
||||
activated = breakPoint.action->EvaluateCondition(this);
|
||||
breakPoint.action->PostAction(this);
|
||||
breakPoint.action->PostAction(this, activated);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2792,7 +2792,7 @@ WfDebugger
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
WfDebugger
|
||||
WfDebugger BreakPoints
|
||||
***********************************************************************/
|
||||
|
||||
#define TEST(AVAILABLE, KEY, MAP) if (AVAILABLE && available == MAP.Keys().Contains(KEY)) return false;
|
||||
@@ -2937,6 +2937,7 @@ WfDebugger
|
||||
breakPoints[index].id = index;
|
||||
breakPoints[index].available = true;
|
||||
breakPoints[index].enabled = true;
|
||||
breakPoints[index].action = nullptr;
|
||||
return index;
|
||||
}
|
||||
|
||||
@@ -2954,6 +2955,11 @@ WfDebugger
|
||||
return AddBreakPoint(WfBreakPoint::Ins(assembly, ins));
|
||||
}
|
||||
|
||||
bool WfDebugger::IsBreakPointAvailable(vint index)
|
||||
{
|
||||
return 0 <= index && index < breakPoints.Count() && !freeBreakPointIndices.Contains(index);
|
||||
}
|
||||
|
||||
vint WfDebugger::GetBreakPointCount()
|
||||
{
|
||||
return breakPoints.Count();
|
||||
@@ -3006,6 +3012,10 @@ WfDebugger
|
||||
breakException = value;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
WfDebugger Operations
|
||||
***********************************************************************/
|
||||
|
||||
bool WfDebugger::Run()
|
||||
{
|
||||
if (state != PauseByOperation && state != PauseByBreakPoint)
|
||||
@@ -3070,6 +3080,10 @@ WfDebugger
|
||||
return true;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
WfDebugger
|
||||
***********************************************************************/
|
||||
|
||||
WfDebugger::State WfDebugger::GetState()
|
||||
{
|
||||
return state;
|
||||
|
||||
@@ -55,7 +55,7 @@ Instruction
|
||||
Return, // : Value -> Value ; (exit function)
|
||||
CreateArray, // count : Value-count, ..., Value-1 -> <array> ; {1 2 3} -> <3 2 1>
|
||||
CreateObservableList, // count : Value-count, ..., Value-1 -> <observable-list> ; {1 2 3} -> <3 2 1>
|
||||
CreateMap, // count : Value-count, ..., Value-1 -> <map> ; {1:2 3:4} -> <3 4 1 2>
|
||||
CreateMap, // count : Value-count*2, ..., Value-1 -> <map> ; {1:2 3:4} -> <3 4 1 2>
|
||||
CreateClosureContext, // count : Value-1, ..., Value-count -> <closure-context> ;
|
||||
CreateClosure, // : <closure-context>, Value-function-index -> <closure> ;
|
||||
CreateInterface, // IMethodInfo*, count : <closure-context>, Value-count, ..., Value-1 -> <map> ; {"Get":a "Set":b} -> new TInterface(InterfaceProxy^)
|
||||
@@ -75,7 +75,7 @@ Instruction
|
||||
UpdateProperty, // IPropertyInfo* : Value-this, Value -> Value-this ;
|
||||
InvokeProxy, // count : Value-1, ..., Value-n, Value-this -> Value ;
|
||||
InvokeMethod, // IMethodInfo*, count : Value-1, ..., Value-n, Value-this -> Value ;
|
||||
InvokeEvent, // IEventInfo*, count : Value-1, ..., Value-n, Value-this -> Value ;
|
||||
InvokeEvent, // IEventInfo*, count : Value-1, ..., Value-n, Value-this -> <null> ;
|
||||
InvokeBaseCtor, // IMethodInfo*, count : Value-1, ..., Value-n, Value-this -> <null> ;
|
||||
AttachEvent, // IEventInfo* : Value-this, <function> -> <Listener> ;
|
||||
DetachEvent, // IEventInfo* : Value-this, <Listener> -> bool ;
|
||||
@@ -865,12 +865,17 @@ Assembly
|
||||
void Initialize();
|
||||
};
|
||||
|
||||
/// <summary>Representing failures during loading an assembly</summary>
|
||||
/// <summary>Representing metadata errors during loading an assembly.</summary>
|
||||
class WfAssemblyLoadErrors
|
||||
{
|
||||
public:
|
||||
/// <summary>All unresolvable types.</summary>
|
||||
collections::List<WString> unresolvedTypes;
|
||||
|
||||
/// <summary>All duplicated types. Types are shared in the process, there is no isolation between assemblies.</summary>
|
||||
collections::List<WString> duplicatedTypes;
|
||||
|
||||
/// <summary>All unresolvable members in resolved types.</summary>
|
||||
collections::List<WString> unresolvedMembers;
|
||||
};
|
||||
|
||||
@@ -1064,7 +1069,7 @@ namespace vl
|
||||
Debugger
|
||||
***********************************************************************/
|
||||
|
||||
/// <summary>Break point action.</summary>
|
||||
/// <summary>Break point action. It will </summary>
|
||||
class IWfBreakPointAction : public virtual Interface
|
||||
{
|
||||
public:
|
||||
@@ -1074,7 +1079,8 @@ Debugger
|
||||
virtual bool EvaluateCondition(WfDebugger* debugger) = 0;
|
||||
/// <summary>Called when a break point is about to activate, even <see cref="EvaluateCondition"/> returns false.</summary>
|
||||
/// <param name="debugger">The current attached debugger.</param>
|
||||
virtual void PostAction(WfDebugger* debugger) = 0;
|
||||
/// <param name="activated">The return value from <see cref="EvaluateCondition"/>.</param>
|
||||
virtual void PostAction(WfDebugger* debugger, bool activated) = 0;
|
||||
};
|
||||
|
||||
/// <summary>Break point.</summary>
|
||||
@@ -1196,6 +1202,28 @@ Debugger
|
||||
};
|
||||
|
||||
/// <summary>Workflow debugger.</summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// <see cref="SetDebuggerForCurrentThread"/> needs to be called to make a debugger works for any Workflow script that is running in the current thread.
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// <see cref="OnBlockExecution"/> needs to be overrided to make a debugger work properly.
|
||||
/// When the target Workflow script stops,
|
||||
/// this function will be called.
|
||||
/// In this function,
|
||||
/// one of <see cref="Run"/>, <see cref="Pause"/>, <see cref="Stop"/>, <see cref="StepOver"/> and <see cref="StepInto"/>
|
||||
/// must be called to make the target Workflow script continues.
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// You are allowed to run the debugger logic in another thread,
|
||||
/// for example,
|
||||
/// an GUI application is debugging a Workflow script which is running in another thread.
|
||||
/// In this case, <see cref="OnBlockExecution"/> needs to be blocked until it is ready to continue.
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// Locks are a good choice for this.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
class WfDebugger : public Object, protected virtual IWfDebuggerCallback
|
||||
{
|
||||
friend IWfDebuggerCallback* GetDebuggerCallback(WfDebugger* debugger);
|
||||
@@ -1215,15 +1243,36 @@ Debugger
|
||||
typedef collections::Dictionary<MethodKey, vint> MethodBreakPointMap;
|
||||
typedef collections::Dictionary<TypeKey, vint> TypeBreakPointMap;
|
||||
public:
|
||||
/// <summary>The state of the debugger.</summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// The state is affected by break points and the following operations:
|
||||
/// <ul>
|
||||
/// <li><b><see cref="Run"/></b>: If the Workflow script is paused, it continues the script.</li>
|
||||
/// <li><b><see cref="Pause"/></b>: If the Workflow script is running, it pauses the script, following by a call to <see cref="OnBlockExecution"/>.</li>
|
||||
/// <li><b><see cref="Stop"/></b>: If the Workflow script is not stopped, it stops the script by throwing in exception in the script.</li>
|
||||
/// <li><b><see cref="StepOver"/></b>: Stop over to the next code line and pause. It doesn't jump into the function to be called.</li>
|
||||
/// <li><b><see cref="StepInto"/></b>: Stop into the new code line and pause.</li>
|
||||
/// </ul>
|
||||
/// Operations are expected to be called in <see cref="OnBlockExecution"/>.
|
||||
/// </p>
|
||||
/// </remarks>
|
||||
enum State
|
||||
{ // Run Pause Stop StepOver StepInto
|
||||
/// <summary>The associated thread is running Workflow script.</summary>
|
||||
Running, // R *RTP *RTS
|
||||
/// <summary>The target Workflow script is paused by operations other than break points.</summary>
|
||||
PauseByOperation, // PBO *C *RTS *C *C
|
||||
/// <summary>The target Workflow script is paused by break points.</summary>
|
||||
PauseByBreakPoint, // PBB *C *RTS *C *C
|
||||
/// <summary>The associated thread has stopped running Workflow script.</summary>
|
||||
Stopped, // S *RTP * *
|
||||
/// <summary>The debugger allows the target Workflow script to continue.</summary>
|
||||
Continue, // C soon becomes Running
|
||||
RequiredToPause, // RTP soon becomes PauseByOperation
|
||||
RequiredToStop, // RTS soon becomes Stop
|
||||
/// <summary>The target Workflow script is required to pause. This value can be observed in <see cref="OnBlockExecution"/>. Operations to continue executing the Workflow script await to be called.</summary>
|
||||
RequiredToPause, // RTP soon becomes PauseByOperation (should be triggered in OnBlockExecution)
|
||||
/// <summary>The target Workflow script is required to stop. It caused to Workflow script to stop by throwing an exception saying this.</summary>
|
||||
RequiredToStop, // RTS soon becomes Stopped (should be triggered in OnBlockExecution)
|
||||
};
|
||||
|
||||
enum RunningType
|
||||
@@ -1272,6 +1321,7 @@ Debugger
|
||||
TypeBreakPointMap createObjectBreakPoints;
|
||||
|
||||
/// <summary>Called for doing something when a break point is activated. This function will be called multiple times before some one let the debugger to continue.</summary>
|
||||
/// <remarks>This function must be overrided, or the Workflow script will hang when it is paused by any reason.</remarks>
|
||||
virtual void OnBlockExecution();
|
||||
/// <summary>Called when a new Workflow program is about to run.</summary>
|
||||
virtual void OnStartExecution();
|
||||
@@ -1316,13 +1366,18 @@ Debugger
|
||||
/// <summary>Get the number of all break points.</summary>
|
||||
/// <returns>The number of all break points.</returns>
|
||||
vint GetBreakPointCount();
|
||||
/// <summary>Get a specified break point.</summary>
|
||||
/// <summary>Test if an index is an available break point.</summary>
|
||||
/// <returns>Returns true if an index is an available break point. This function returns true for all disabled break points.</returns>
|
||||
/// <param name="index">The index of the break point.</param>
|
||||
bool IsBreakPointAvailable(vint index);
|
||||
/// <summary>Get a specified break point. For unavailable break points, <see cref="WfBreakPoint::available"/> is false.</summary>
|
||||
/// <returns>The break point.</returns>
|
||||
/// <param name="index">The index of the break point.</param>
|
||||
const WfBreakPoint& GetBreakPoint(vint index);
|
||||
/// <summary>Delete a specified break point.</summary>
|
||||
/// <returns>Returns true if this operation is succeeded.</returns>
|
||||
/// <param name="index">The index of the break point.</param>
|
||||
/// <remarks>After removing a break point, the break point becomes unavailable. The index will be reused later when a new break point is added to the debugger.</remarks>
|
||||
bool RemoveBreakPoint(vint index);
|
||||
/// <summary>Enable or disable a specified break point.</summary>
|
||||
/// <returns>Returns true if this operation is succeeded.</returns>
|
||||
@@ -1421,19 +1476,23 @@ namespace vl
|
||||
RuntimeEnvironment
|
||||
***********************************************************************/
|
||||
|
||||
/// <summary>Variable storage.</summary>
|
||||
class WfRuntimeVariableContext : public Object, public reflection::Description<WfRuntimeVariableContext>
|
||||
{
|
||||
typedef collections::Array<reflection::description::Value> VariableArray;
|
||||
|
||||
public:
|
||||
/// <summary>Values of variables in runtime.</summary>
|
||||
VariableArray variables;
|
||||
};
|
||||
|
||||
/// <summary>Global context for executing a Workflow program. After the context is prepared, use [M:vl.workflow.runtime.LoadFunction] to call any functions inside the assembly. Function "<initialize>" should be the first to execute.</summary>
|
||||
/// <summary>Global context for executing a Workflow program. After the context is prepared, use [M:vl.workflow.runtime.LoadFunction`1] to call any functions inside the assembly. Function "<b><initialize></b>" should be the first to execute.</summary>
|
||||
class WfRuntimeGlobalContext : public Object, public reflection::Description<WfRuntimeGlobalContext>
|
||||
{
|
||||
public:
|
||||
/// <summary>The loaded assembly.</summary>
|
||||
Ptr<WfAssembly> assembly;
|
||||
/// <summary>Global variable storages.</summary>
|
||||
Ptr<WfRuntimeVariableContext> globalVariables;
|
||||
|
||||
/// <summary>Create a global context for executing a Workflow program.</summary>
|
||||
@@ -1617,6 +1676,23 @@ RuntimeThreadContext
|
||||
StackCorrupted,
|
||||
};
|
||||
|
||||
/// <summary>A Workflow script call stack.</summary>
|
||||
/// <remarks>
|
||||
/// <p>
|
||||
/// This object could be obtained by <see cref="WfDebugger::GetCurrentThreadContext"/>.
|
||||
/// A thread could have multiple thread contexts,
|
||||
/// a full list could be obtained by <see cref="WfDebugger::GetThreadContexts"/>.
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// You are not recommended to update the call stack using this object.
|
||||
/// </p>
|
||||
/// <p>
|
||||
/// In the current version,
|
||||
/// the debug information doesn't contain enough data,
|
||||
/// so that it could be difficult to read local variables in high-level function constructions,
|
||||
/// like lambda expression or coroutines.
|
||||
/// </p>
|
||||
/// </remakrs>
|
||||
class WfRuntimeThreadContext
|
||||
{
|
||||
typedef collections::List<reflection::description::Value> VariableList;
|
||||
@@ -1662,17 +1738,19 @@ RuntimeThreadContext
|
||||
Helper Functions
|
||||
***********************************************************************/
|
||||
|
||||
/// <summary>Load a function from a global context, raise an exception if multiple functions are found under the same name. Function ">initialize<" should be the first to execute.</summary>
|
||||
/// <summary>Load a function from a global context, raise an exception if multiple functions are found under the same name. Function "<initialize>" should be the first to execute.</summary>
|
||||
/// <returns>The loaded function.</returns>
|
||||
/// <param name="context">The context to the evaluation environment.</param>
|
||||
/// <param name="name">The function name.</param>
|
||||
/// <remarks>"<b><initialize></b>" must be the first function that is executed after an assembly is loaded. It has no argument or return value.</remarks>
|
||||
extern Ptr<reflection::description::IValueFunctionProxy> LoadFunction(Ptr<WfRuntimeGlobalContext> context, const WString& name);
|
||||
|
||||
/// <summary>Load a C++ friendly function from a global context, raise an exception if multiple functions are found under the same name. Function ">initialize<" should be the first to execute.</summary>
|
||||
/// <summary>Load a C++ friendly function from a global context, raise an exception if multiple functions are found under the same name. Function "<initialize>" should be the first to execute.</summary>
|
||||
/// <typeparam name="TFunction">Type of the function.</typeparam>
|
||||
/// <returns>The loaded C++ friendly function.</returns>
|
||||
/// <param name="context">The context to the evaluation environment.</param>
|
||||
/// <param name="name">The function name.</param>
|
||||
/// <remarks>"<b><initialize></b>" must be the first function that is executed after an assembly is loaded. Its type is <b>void()</b>.</remarks>
|
||||
template<typename TFunction>
|
||||
Func<TFunction> LoadFunction(Ptr<WfRuntimeGlobalContext> context, const WString& name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user