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

View File

@@ -3,7 +3,6 @@
using namespace vl;
using namespace vl::console;
using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection::description;
using namespace vl::workflow;
using namespace vl::workflow::emitter;
@@ -33,13 +32,13 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies
List<Ptr<ParsingError>> errors;
auto table = WfLoadTable();
auto assembly = Compile(table, codes, errors);
List<glr::ParsingError> errors;
workflow::Parser parser;
auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction();

View File

@@ -3,7 +3,6 @@
using namespace vl;
using namespace vl::console;
using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection;
using namespace vl::reflection::description;
using namespace vl::workflow;
@@ -91,7 +90,7 @@ int main()
// start reflection
LoadPredefinedTypes();
WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader);
GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load();
{
@@ -100,13 +99,13 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies
List<Ptr<ParsingError>> errors;
auto table = WfLoadTable();
auto assembly = Compile(table, codes, errors);
List<glr::ParsingError> errors;
workflow::Parser parser;
auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction();

View File

@@ -3,7 +3,6 @@
using namespace vl;
using namespace vl::console;
using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection;
using namespace vl::reflection::description;
using namespace vl::workflow;
@@ -117,7 +116,7 @@ int main()
// start reflection
LoadPredefinedTypes();
WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader);
GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load();
{
@@ -126,13 +125,13 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies
List<Ptr<ParsingError>> errors;
auto table = WfLoadTable();
auto assembly = Compile(table, codes, errors);
List<glr::ParsingError> errors;
workflow::Parser parser;
auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction();

View File

@@ -3,7 +3,6 @@
using namespace vl;
using namespace vl::console;
using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection;
using namespace vl::reflection::description;
using namespace vl::workflow;
@@ -156,7 +155,7 @@ int main()
// start reflection
LoadPredefinedTypes();
WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader);
GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load();
{
@@ -165,20 +164,20 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies
List<Ptr<ParsingError>> errors;
auto table = WfLoadTable();
auto assembly = Compile(table, codes, errors);
List<glr::ParsingError> errors;
workflow::Parser parser;
auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction();
// call MyApp
auto myapp = UnboxValue<Ptr<App>>(Value::Create(
L"myscript::MyApp",
(Array<Value>&)(Value_xs(), WString(L"vczh"))
(Value_xs(), BoxValue(WString(L"vczh")))
));
myapp->SetName(L"Vczh Libraries++");
myapp->SetName(L"Workflow");

View File

@@ -4,7 +4,6 @@
using namespace vl::console;
using namespace vl::collections;
using namespace vl::stream;
using namespace vl::parsing;
using namespace vl::filesystem;
using namespace vl::reflection::description;
using namespace vl::workflow;
@@ -54,10 +53,10 @@ int wmain(int argc, const wchar_t* argv[])
// compile code
// WfLexicalScopeManager is required because we produce assembly and C++ code at the same time
List<Ptr<ParsingError>> errors;
auto table = WfLoadTable();
WfLexicalScopeManager manager(table);
auto assembly = Compile(table, &manager, codes, errors);
List<glr::ParsingError> errors;
workflow::Parser parser;
WfLexicalScopeManager manager(parser);
auto assembly = Compile(&manager, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// save the assembly to file
@@ -79,7 +78,7 @@ int wmain(int argc, const wchar_t* argv[])
cppFolder = cppFolder / L"W05_StaticRun" / L"Generated";
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->headerGuardPrefix = L"W05_SCRIPT_";
cppInput->normalIncludes.Add(L"../../W05_Lib/W05_Lib.h");

View File

@@ -2,7 +2,6 @@
#include "../W05_Lib/W05_Lib.h"
using namespace vl::stream;
using namespace vl::parsing;
using namespace vl::filesystem;
using namespace vl::reflection::description;
using namespace vl::workflow::runtime;
@@ -25,7 +24,7 @@ int wmain(int argc, const wchar_t* argv[])
auto assembly = WfAssembly::Deserialize(fileStream, errors);
// initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction();

View File

@@ -72,7 +72,7 @@ namespace vl
void LoadMyApiTypes()
{
#ifndef VCZH_DEBUG_NO_REFLECTION
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader);
GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
#endif
}
}

View File

@@ -18,11 +18,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif
#define GLOBAL_SYMBOL ::vl_workflow_global::W05Script::
@@ -90,8 +90,8 @@ namespace myscript
#if defined( _MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

View File

@@ -16,11 +16,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif
namespace vl_workflow_global
@@ -74,10 +74,10 @@ Closures
#if defined( _MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif

View File

@@ -12,11 +12,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif
/***********************************************************************
@@ -61,7 +61,7 @@ namespace vl
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
if (auto manager = GetGlobalTypeManager())
{
return manager->AddTypeLoader(MakePtr<W05ScriptTypeLoader>());
return manager->AddTypeLoader(Ptr(new W05ScriptTypeLoader));
}
#endif
return false;
@@ -72,8 +72,8 @@ namespace vl
#if defined( _MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

View File

@@ -15,11 +15,11 @@ https://github.com/vczh-libraries
#if defined( _MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#elif defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wparentheses-equality"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#endif
/***********************************************************************
@@ -43,10 +43,10 @@ namespace vl
#if defined( _MSC_VER)
#pragma warning(pop)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif

View File

@@ -6,7 +6,7 @@ int main()
{
// VCZH_DEBUG_NO_REFLECTION is on
// 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");
// we need to call this because we use generated code from Workflow script

View File

@@ -3,7 +3,6 @@
using namespace vl;
using namespace vl::console;
using namespace vl::collections;
using namespace vl::parsing;
using namespace vl::reflection;
using namespace vl::reflection::description;
using namespace vl::workflow;
@@ -112,7 +111,7 @@ int main()
// start reflection
LoadPredefinedTypes();
WfLoadLibraryTypes();
GetGlobalTypeManager()->AddTypeLoader(new MyApiTypeLoader);
GetGlobalTypeManager()->AddTypeLoader(Ptr(new MyApiTypeLoader));
GetGlobalTypeManager()->Load();
{
@@ -121,18 +120,18 @@ int main()
codes.Add(WString::Unmanaged(ScriptCode));
// compile code and get assemblies
List<Ptr<ParsingError>> errors;
auto table = WfLoadTable();
auto assembly = Compile(table, codes, errors);
List<glr::ParsingError> errors;
workflow::Parser parser;
auto assembly = Compile(parser, codes, errors);
CHECK_ERROR(assembly && errors.Count() == 0, L"Please check the 'errors' variable.");
// initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
auto globalContext = Ptr(new WfRuntimeGlobalContext(assembly));
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction();
// start debugging
auto debugger = MakePtr<MyDebugger>();
auto debugger = Ptr(new MyDebugger);
SetDebuggerForCurrentThread(debugger);
// break at App::Print(...);, which is at line 9 in file 0