Fix workflow tutorial build break

This commit is contained in:
vczh
2023-01-14 14:06:13 -08:00
parent 24250907d8
commit 0d46b6aa13
13 changed files with 51 additions and 58 deletions
@@ -3,7 +3,6 @@
using namespace vl; using namespace vl;
using namespace vl::console; using namespace vl::console;
using namespace vl::collections; using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection::description; using namespace vl::reflection::description;
using namespace vl::workflow; using namespace vl::workflow;
using namespace vl::workflow::emitter; using namespace vl::workflow::emitter;
@@ -33,13 +32,13 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode)); codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies // compile code and get assemblies
List<Ptr<ParsingError>> errors; List<glr::ParsingError> errors;
auto table = WfLoadTable(); workflow::Parser parser;
auto assembly = Compile(table, codes, errors); auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable."); CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly // initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly); auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>"); auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction(); initializeFunction();
@@ -3,7 +3,6 @@
using namespace vl; using namespace vl;
using namespace vl::console; using namespace vl::console;
using namespace vl::collections; using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection; using namespace vl::reflection;
using namespace vl::reflection::description; using namespace vl::reflection::description;
using namespace vl::workflow; using namespace vl::workflow;
@@ -91,7 +90,7 @@ int main()
// start reflection // start reflection
LoadPredefinedTypes(); LoadPredefinedTypes();
WfLoadLibraryTypes(); WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader); GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load(); GetGlobalTypeManager()->Load();
{ {
@@ -100,13 +99,13 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode)); codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies // compile code and get assemblies
List<Ptr<ParsingError>> errors; List<glr::ParsingError> errors;
auto table = WfLoadTable(); workflow::Parser parser;
auto assembly = Compile(table, codes, errors); auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable."); CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly // initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly); auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>"); auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction(); initializeFunction();
@@ -3,7 +3,6 @@
using namespace vl; using namespace vl;
using namespace vl::console; using namespace vl::console;
using namespace vl::collections; using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection; using namespace vl::reflection;
using namespace vl::reflection::description; using namespace vl::reflection::description;
using namespace vl::workflow; using namespace vl::workflow;
@@ -117,7 +116,7 @@ int main()
// start reflection // start reflection
LoadPredefinedTypes(); LoadPredefinedTypes();
WfLoadLibraryTypes(); WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader); GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load(); GetGlobalTypeManager()->Load();
{ {
@@ -126,13 +125,13 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode)); codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies // compile code and get assemblies
List<Ptr<ParsingError>> errors; List<glr::ParsingError> errors;
auto table = WfLoadTable(); workflow::Parser parser;
auto assembly = Compile(table, codes, errors); auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable."); CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly // initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly); auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>"); auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction(); initializeFunction();
@@ -3,7 +3,6 @@
using namespace vl; using namespace vl;
using namespace vl::console; using namespace vl::console;
using namespace vl::collections; using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection; using namespace vl::reflection;
using namespace vl::reflection::description; using namespace vl::reflection::description;
using namespace vl::workflow; using namespace vl::workflow;
@@ -156,7 +155,7 @@ int main()
// start reflection // start reflection
LoadPredefinedTypes(); LoadPredefinedTypes();
WfLoadLibraryTypes(); WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader); GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load(); GetGlobalTypeManager()->Load();
{ {
@@ -165,20 +164,20 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode)); codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies // compile code and get assemblies
List<Ptr<ParsingError>> errors; List<glr::ParsingError> errors;
auto table = WfLoadTable(); workflow::Parser parser;
auto assembly = Compile(table, codes, errors); auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable."); CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly // initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly); auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>"); auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction(); initializeFunction();
// call MyApp // call MyApp
auto myapp = UnboxValue<Ptr<App>>(Value::Create( auto myapp = UnboxValue<Ptr<App>>(Value::Create(
L"myscript::MyApp", L"myscript::MyApp",
(Array<Value>&)(Value_xs(), WString(L"vczh")) (Value_xs(), BoxValue(WString(L"vczh")))
)); ));
myapp->SetName(L"Vczh Libraries++"); myapp->SetName(L"Vczh Libraries++");
myapp->SetName(L"Workflow"); myapp->SetName(L"Workflow");
@@ -4,7 +4,6 @@
using namespace vl::console; using namespace vl::console;
using namespace vl::collections; using namespace vl::collections;
using namespace vl::stream; using namespace vl::stream;
using namespace vl::parsing;
using namespace vl::filesystem; using namespace vl::filesystem;
using namespace vl::reflection::description; using namespace vl::reflection::description;
using namespace vl::workflow; using namespace vl::workflow;
@@ -54,10 +53,10 @@ int wmain(int argc, const wchar_t* argv[])
// compile code // compile code
// WfLexicalScopeManager is required because we produce assembly and C++ code at the same time // WfLexicalScopeManager is required because we produce assembly and C++ code at the same time
List<Ptr<ParsingError>> errors; List<glr::ParsingError> errors;
auto table = WfLoadTable(); workflow::Parser parser;
WfLexicalScopeManager manager(table); WfLexicalScopeManager manager(parser);
auto assembly = Compile(table, &manager, codes, errors); auto assembly = Compile(&manager, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable."); CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// save the assembly to file // save the assembly to file
@@ -79,7 +78,7 @@ int wmain(int argc, const wchar_t* argv[])
cppFolder = cppFolder / L"W05_StaticRun" / L"Generated"; cppFolder = cppFolder / L"W05_StaticRun" / L"Generated";
Console::WriteLine(L"Writing C++ files to: " + cppFolder.GetFullPath()); Console::WriteLine(L"Writing C++ files to: " + cppFolder.GetFullPath());
auto cppInput = MakePtr<WfCppInput>(L"W05Script"); auto cppInput = Ptr(new WfCppInput(L"W05Script"));
cppInput->comment = L"THIS FILE IS GENERATED BY W05_COMPILE"; cppInput->comment = L"THIS FILE IS GENERATED BY W05_COMPILE";
cppInput->headerGuardPrefix = L"W05_SCRIPT_"; cppInput->headerGuardPrefix = L"W05_SCRIPT_";
cppInput->normalIncludes.Add(L"../../W05_Lib/W05_Lib.h"); cppInput->normalIncludes.Add(L"../../W05_Lib/W05_Lib.h");
@@ -2,7 +2,6 @@
#include "../W05_Lib/W05_Lib.h" #include "../W05_Lib/W05_Lib.h"
using namespace vl::stream; using namespace vl::stream;
using namespace vl::parsing;
using namespace vl::filesystem; using namespace vl::filesystem;
using namespace vl::reflection::description; using namespace vl::reflection::description;
using namespace vl::workflow::runtime; using namespace vl::workflow::runtime;
@@ -25,7 +24,7 @@ int wmain(int argc, const wchar_t* argv[])
auto assembly = WfAssembly::Deserialize(fileStream, errors); auto assembly = WfAssembly::Deserialize(fileStream, errors);
// initialize the assembly // initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly); auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>"); auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction(); initializeFunction();
@@ -72,7 +72,7 @@ namespace vl
void LoadMyApiTypes() void LoadMyApiTypes()
{ {
#ifndef VCZH_DEBUG_NO_REFLECTION #ifndef VCZH_DEBUG_NO_REFLECTION
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader); GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
#endif #endif
} }
} }
@@ -18,11 +18,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4250) #pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif #endif
#define GLOBAL_SYMBOL ::vl_workflow_global::W05Script:: #define GLOBAL_SYMBOL ::vl_workflow_global::W05Script::
@@ -90,8 +90,8 @@ namespace myscript
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(pop) #pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif #endif
@@ -16,11 +16,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4250) #pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif #endif
namespace vl_workflow_global namespace vl_workflow_global
@@ -74,10 +74,10 @@ Closures
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(pop) #pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif #endif
#endif #endif
@@ -12,11 +12,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4250) #pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif #endif
/*********************************************************************** /***********************************************************************
@@ -61,7 +61,7 @@ namespace vl
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA #ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
if (auto manager = GetGlobalTypeManager()) if (auto manager = GetGlobalTypeManager())
{ {
return manager->AddTypeLoader(MakePtr<W05ScriptTypeLoader>()); return manager->AddTypeLoader(Ptr(new W05ScriptTypeLoader));
} }
#endif #endif
return false; return false;
@@ -72,8 +72,8 @@ namespace vl
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(pop) #pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif #endif
@@ -15,11 +15,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(push) #pragma warning(push)
#pragma warning(disable:4250) #pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality" #pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif #endif
/*********************************************************************** /***********************************************************************
@@ -43,10 +43,10 @@ namespace vl
#if defined( _MSC_VER) #if defined( _MSC_VER)
#pragma warning(pop) #pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__) #elif defined(__clang__)
#pragma clang diagnostic pop #pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif #endif
#endif #endif
@@ -6,7 +6,7 @@ int main()
{ {
// VCZH_DEBUG_NO_REFLECTION is on // VCZH_DEBUG_NO_REFLECTION is on
// so we don't need, and are not allowed, to start reflection // so we don't need, and are not allowed, to start reflection
auto myapp = MakePtr<MyApp>(); auto myapp = Ptr(new MyApp);
myapp->CreateScripting()->Execute(L"Gaclib"); myapp->CreateScripting()->Execute(L"Gaclib");
// we need to call this because we use generated code from Workflow script // we need to call this because we use generated code from Workflow script
@@ -3,7 +3,6 @@
using namespace vl; using namespace vl;
using namespace vl::console; using namespace vl::console;
using namespace vl::collections; using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection; using namespace vl::reflection;
using namespace vl::reflection::description; using namespace vl::reflection::description;
using namespace vl::workflow; using namespace vl::workflow;
@@ -112,7 +111,7 @@ int main()
// start reflection // start reflection
LoadPredefinedTypes(); LoadPredefinedTypes();
WfLoadLibraryTypes(); WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader); GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load(); GetGlobalTypeManager()->Load();
{ {
@@ -121,18 +120,18 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode)); codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies // compile code and get assemblies
List<Ptr<ParsingError>> errors; List<glr::ParsingError> errors;
auto table = WfLoadTable(); workflow::Parser parser;
auto assembly = Compile(table, codes, errors); auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable."); CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly // initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly); auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>"); auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction(); initializeFunction();
// start debugging // start debugging
auto debugger = MakePtr<MyDebugger>(); auto debugger = Ptr(new MyDebugger);
SetDebuggerForCurrentThread(debugger); SetDebuggerForCurrentThread(debugger);
// break at App::Print(...);, which is at line 9 in file 0 // break at App::Print(...);, which is at line 9 in file 0