Skip to content

Commit 6b5c0da

Browse files
committed
Fix pipe namespaces
1 parent 99c3517 commit 6b5c0da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+559
-507
lines changed

Apps/Editor/Src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ int RunEditor(StringView projectPath)
2626
EnableModule<MIRBackendModule>();
2727
EnableModule<GraphViewModule>();
2828

29-
const int result = Editor::Editor::Get().Run(projectPath);
29+
const int result = editor::Editor::Get().Run(projectPath);
3030
p::Shutdown();
3131
return result;
3232
}

Libs/AST/Include/AST/Id.h

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace rift::ast
1111
{
12-
using namespace p;
1312
using Id = p::Id;
1413
constexpr Id NoId = p::NoId;
1514

Libs/AST/Include/AST/Statics/SLoadQueue.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace rift::ast
1313
{
1414
P_STRUCT(SLoadQueue, p::Struct)
1515

16-
TArray<Id> pendingSyncLoad;
17-
TArray<Id> pendingAsyncLoad;
16+
p::TArray<Id> pendingSyncLoad;
17+
p::TArray<Id> pendingAsyncLoad;
1818
};
1919
} // namespace rift::ast

Libs/AST/Include/AST/Statics/SStringLoad.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ namespace rift::ast
1717

1818
// This buffers are always in sync with size
1919
// They bind by array index an Id, path and loaded string
20-
TArray<p::Id> entities;
21-
TArray<p::String> paths;
22-
TArray<p::String> strings;
20+
p::TArray<p::Id> entities;
21+
p::TArray<p::String> paths;
22+
p::TArray<p::String> strings;
2323
};
2424
} // namespace rift::ast

Libs/AST/Include/AST/Statics/STypes.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
namespace rift::ast
1111
{
12-
struct STypes : public Struct
12+
struct STypes : public p::Struct
1313
{
14-
P_STRUCT(STypes, Struct)
14+
P_STRUCT(STypes, p::Struct)
1515

16-
TMap<Tag, Id> typesByName;
16+
p::TMap<p::Tag, Id> typesByName;
1717
// TODO: Use StringView to point to CFileRef component's path.
1818
// Current TMap lookup of stringviews seems unconsistent
19-
TMap<Tag, Id> typesByPath;
19+
p::TMap<p::Tag, Id> typesByPath;
2020
};
2121
} // namespace rift::ast

Libs/AST/Include/AST/Systems/LoadSystem.h

+9-7
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ namespace rift::ast::LoadSystem
3030
/**
3131
* @param paths of all currently unloaded modules
3232
*/
33-
void ScanSubmodules(Tree& ast, TArray<String>& paths);
33+
void ScanSubmodules(Tree& ast, p::TArray<p::String>& paths);
3434
/**
3535
* @param paths of all currently unloaded types
3636
*/
37-
void ScanTypes(Tree& ast, TArray<ModuleTypePaths>& pathsByModule);
37+
void ScanTypes(Tree& ast, p::TArray<ModuleTypePaths>& pathsByModule);
3838

39-
void CreateModulesFromPaths(Tree& ast, TArray<String>& paths, TArray<Id>& ids);
40-
void CreateTypesFromPaths(Tree& ast, TView<ModuleTypePaths> pathsByModule, TArray<Id>& ids);
39+
void CreateModulesFromPaths(Tree& ast, p::TArray<p::String>& paths, p::TArray<Id>& ids);
40+
void CreateTypesFromPaths(
41+
Tree& ast, p::TView<ModuleTypePaths> pathsByModule, p::TArray<Id>& ids);
4142

42-
void LoadFileStrings(TAccessRef<CFileRef> access, TView<Id> nodes, TArray<String>& strings);
43+
void LoadFileStrings(
44+
p::TAccessRef<CFileRef> access, p::TView<Id> nodes, p::TArray<p::String>& strings);
4345

44-
void DeserializeModules(Tree& ast, TView<Id> moduleIds, TView<String> strings);
45-
void DeserializeTypes(Tree& ast, TView<Id> typeIds, TView<String> strings);
46+
void DeserializeModules(Tree& ast, p::TView<Id> moduleIds, p::TView<p::String> strings);
47+
void DeserializeTypes(Tree& ast, p::TView<Id> typeIds, p::TView<p::String> strings);
4648

4749
} // namespace rift::ast::LoadSystem

Libs/AST/Include/AST/Systems/TypeSystem.h

+4-7
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ namespace rift::ast
1515

1616
namespace rift::ast::TypeSystem
1717
{
18-
using namespace p;
19-
20-
2118
void Init(Tree& ast);
2219

2320
using PropagateVariableTypesAccess =
24-
TAccessRef<CExprDeclRefId, CDeclVariable, TWrite<CExprTypeId>>;
21+
p::TAccessRef<CExprDeclRefId, CDeclVariable, p::TWrite<CExprTypeId>>;
2522
void PropagateVariableTypes(PropagateVariableTypesAccess access);
2623

27-
using PropagateExpressionTypesAccess = TAccessRef<CDeclType, CChanged, CExprInputs,
28-
CExprOutputs, TWrite<CExprTypeId>, CExprUnaryOperator, CExprBinaryOperator, CParent>;
24+
using PropagateExpressionTypesAccess = p::TAccessRef<CDeclType, CChanged, CExprInputs,
25+
CExprOutputs, p::TWrite<CExprTypeId>, CExprUnaryOperator, CExprBinaryOperator, p::CParent>;
2926
void PropagateExpressionTypes(PropagateExpressionTypesAccess access);
3027

3128
void ResolveExprTypeIds(
32-
TAccessRef<TWrite<CExprTypeId>, CExprType, CNamespace, CParent, CChild> access);
29+
p::TAccessRef<p::TWrite<CExprTypeId>, CExprType, CNamespace, p::CParent, p::CChild> access);
3330
} // namespace rift::ast::TypeSystem

Libs/AST/Include/AST/Tree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace rift::ast
5151

5252
static const p::TBroadcast<Tree&>& OnInit();
5353

54-
String DumpPools();
54+
p::String DumpPools();
5555

5656
private:
5757
void CopyFrom(const Tree& other);

Libs/AST/Include/AST/Utils/Expressions.h

+8-7
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
// NOTE: In expression graphs, the Link Id is the Input Pin Id
1414
namespace rift::ast
1515
{
16-
bool CanConnectExpr(TAccessRef<CExprInputs, CExprOutputs, CExprTypeId> access,
16+
bool CanConnectExpr(p::TAccessRef<CExprInputs, CExprOutputs, CExprTypeId> access,
1717
ExprOutput output, ExprInput input);
1818

19-
bool TryConnectExpr(TAccessRef<TWrite<CExprInputs>, CExprOutputs, CExprTypeId> access,
19+
bool TryConnectExpr(p::TAccessRef<p::TWrite<CExprInputs>, CExprOutputs, CExprTypeId> access,
2020
ExprOutput output, ExprInput input);
2121
// Disconnects a particular link. (Note: link ids are the same as input nodes)
2222
bool DisconnectExpr(Tree& ast, ExprInput input);
@@ -27,11 +27,12 @@ namespace rift::ast
2727
* @param ids
2828
* @param ignoreRoot ignore ids's inputs and outputs and only remove from children
2929
*/
30-
void DisconnectAllExprDeep(Tree& ast, TView<const Id> ids, bool ignoreRoot = false);
30+
void DisconnectAllExprDeep(Tree& ast, p::TView<const Id> ids, bool ignoreRoot = false);
3131

32-
bool RemoveExprInputPin(TAccessRef<CExprInputs, TWrite<CInvalid>> access, ExprInput id);
33-
bool RemoveExprOutputPin(TAccessRef<CExprOutputs, TWrite<CInvalid>> access, ExprOutput id);
32+
bool RemoveExprInputPin(p::TAccessRef<CExprInputs, p::TWrite<CInvalid>> access, ExprInput id);
33+
bool RemoveExprOutputPin(
34+
p::TAccessRef<CExprOutputs, p::TWrite<CInvalid>> access, ExprOutput id);
3435

35-
ExprInput GetExprInputFromPin(TAccessRef<CExprInputs, CChild> access, Id pinId);
36-
ExprOutput GetExprOutputFromPin(TAccessRef<CExprOutputs, CChild> access, Id pinId);
36+
ExprInput GetExprInputFromPin(p::TAccessRef<CExprInputs, CChild> access, Id pinId);
37+
ExprOutput GetExprOutputFromPin(p::TAccessRef<CExprOutputs, CChild> access, Id pinId);
3738
} // namespace rift::ast

Libs/AST/Include/AST/Utils/ModuleUtils.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,30 @@ namespace rift::ast
3939
}
4040
};
4141

42-
bool CreateProject(Tree& ast, StringView path);
43-
bool OpenProject(Tree& ast, StringView path);
42+
bool CreateProject(Tree& ast, p::StringView path);
43+
bool OpenProject(Tree& ast, p::StringView path);
4444
void CloseProject(Tree& ast);
4545

46-
Id CreateModule(Tree& ast, StringView path);
46+
Id CreateModule(Tree& ast, p::StringView path);
4747

4848
Id GetProjectId(p::TAccessRef<CProject> access);
4949

50-
Tag GetProjectName(p::TAccessRef<CProject, CNamespace, CFileRef> access);
50+
p::Tag GetProjectName(p::TAccessRef<CProject, CNamespace, CFileRef> access);
5151
p::StringView GetProjectPath(p::TAccessRef<CFileRef, CProject> access);
5252
CModule* GetProjectModule(p::TAccessRef<CProject, p::TWrite<CModule>> access);
5353

5454
bool HasProject(Tree& ast);
5555

5656
// Resolve a module's name
57-
Tag GetModuleName(p::TAccessRef<CNamespace, CFileRef> access, Id moduleId);
57+
p::Tag GetModuleName(p::TAccessRef<CNamespace, CFileRef> access, Id moduleId);
5858

5959
// Resolve a module's name
6060
p::StringView GetModulePath(p::TAccessRef<CFileRef> access, Id moduleId);
6161

62-
void SerializeModule(ast::Tree& ast, ast::Id id, String& data);
63-
void DeserializeModule(ast::Tree& ast, ast::Id id, const String& data);
64-
const TBroadcast<p::EntityReader&>& OnReadModulePools();
65-
const TBroadcast<p::EntityWriter&>& OnWriteModulePools();
62+
void SerializeModule(ast::Tree& ast, ast::Id id, p::String& data);
63+
void DeserializeModule(ast::Tree& ast, ast::Id id, const p::String& data);
64+
const p::TBroadcast<p::EntityReader&>& OnReadModulePools();
65+
const p::TBroadcast<p::EntityWriter&>& OnWriteModulePools();
6666

6767
void RegisterModuleBinding(ModuleBinding binding);
6868
void UnregisterModuleBinding(p::Tag bindingId);

Libs/AST/Include/AST/Utils/Settings.h

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2015-2023 Piperift - All rights reserved
2+
3+
#pragma once
4+
5+
#include "AST/Tree.h"
6+
#include "AST/TypeRef.h"
7+
8+
#include <Pipe/Core/String.h>
9+
#include <Pipe/Serialize/Serialization.h>
10+
#include <PipeECS.h>
11+
12+
13+
namespace rift::ast
14+
{
15+
p::String GetUserSettingsPath();
16+
17+
template<typename T>
18+
T* GetUserSettings()
19+
{
20+
static TOwnPtr<T> instance;
21+
if (!instance)
22+
{
23+
p::String path = GetUserSettingsPath();
24+
String data;
25+
// if (p::LoadStringFile(path, data))
26+
//{
27+
// instance = MakeOwned<T>();
28+
// p::JsonFormatReader reader{data};
29+
// reader.GetReader().Serialize(*instance);
30+
// }
31+
}
32+
return instance.Get();
33+
}
34+
} // namespace rift::ast

Libs/AST/Include/AST/Utils/Statements.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,43 @@ namespace rift::ast
1515
{
1616
bool CanConnectStmt(const Tree& ast, Id outputNode, Id outputPin, Id inputNode);
1717

18-
bool TryConnectStmt(Tree& ast, ast::Id outputPin, ast::Id inputNode);
18+
bool TryConnectStmt(Tree& ast, Id outputPin, Id inputNode);
1919
// Disconnects a particular link. (Note: link ids are the same as input nodes)
20-
bool DisconnectStmtLink(Tree& ast, ast::Id linkId);
21-
bool DisconnectStmtFromPrevious(Tree& ast, ast::Id inputPin);
22-
bool DisconnectStmtFromNext(Tree& ast, ast::Id outputPin, ast::Id outputNode);
23-
bool DisconnectStmtFromNext(Tree& ast, ast::Id outputPin);
20+
bool DisconnectStmtLink(Tree& ast, Id linkId);
21+
bool DisconnectStmtFromPrevious(Tree& ast, Id inputPin);
22+
bool DisconnectStmtFromNext(Tree& ast, Id outputPin, Id outputNode);
23+
bool DisconnectStmtFromNext(Tree& ast, Id outputPin);
2424

2525
/**
2626
* @brief Disconnects all inputs and outputs from this ids and the children nodes
2727
*
2828
* @param ids
2929
* @param ignoreRoot ignore ids's inputs and outputs and only remove from children
3030
*/
31-
void DisconnectAllStmtDeep(Tree& ast, TView<const ast::Id> ids, bool ignoreRoot = false);
31+
void DisconnectAllStmtDeep(Tree& ast, p::TView<const Id> ids, bool ignoreRoot = false);
3232

3333
// TODO
3434
/** Check that a and b are connected (in any direction) */
35-
// bool AreNodesConnected(const Tree& ast, ast::Id outputNode, ast::Id inputNode);
36-
// bool ArePinsConnected(const Tree& ast, ast::Id outputPin, ast::Id inputPin);
37-
// bool IsOutputPinConnected(const Tree& ast, ast::Id outputPin);
38-
// bool IsOutputPinConnected(const Tree& ast, ast::Id outputPin, ast::Id outputNode);
39-
// bool IsInputPinConnected(const Tree& ast, ast::Id inputPin);
40-
// bool IsInputPinConnected(const Tree& ast, ast::Id inputPin /*unused*/, ast::Id inputNode);
35+
// bool AreNodesConnected(const Tree& ast, Id outputNode, Id inputNode);
36+
// bool ArePinsConnected(const Tree& ast, Id outputPin, Id inputPin);
37+
// bool IsOutputPinConnected(const Tree& ast, Id outputPin);
38+
// bool IsOutputPinConnected(const Tree& ast, Id outputPin, Id outputNode);
39+
// bool IsInputPinConnected(const Tree& ast, Id inputPin);
40+
// bool IsInputPinConnected(const Tree& ast, Id inputPin /*unused*/, Id inputNode);
4141

4242
/** Look for invalid ids and set them to NoId */
4343
void CleanInvalidStmtIds(Tree& ast);
4444

4545
// If two pins were to be connected, would they create a loop?
4646
bool WouldStmtLoop(const Tree& ast, Id outputNode, Id outputPin, Id inputNode);
4747

48-
Id GetPreviousStmt(TAccessRef<CStmtInput> access, Id stmtId);
48+
Id GetPreviousStmt(p::TAccessRef<CStmtInput> access, Id stmtId);
4949
void GetPreviousStmts(
50-
TAccessRef<CStmtInput> access, TView<const Id> stmtIds, TArray<Id>& prevStmtIds);
51-
TView<Id> GetNextStmts(TAccessRef<CStmtOutputs> access, Id stmtId);
50+
p::TAccessRef<CStmtInput> access, p::TView<const Id> stmtIds, p::TArray<Id>& prevStmtIds);
51+
p::TView<Id> GetNextStmts(p::TAccessRef<CStmtOutputs> access, Id stmtId);
5252
void GetNextStmts(
53-
TAccessRef<CStmtOutputs> access, TView<const Id> stmtIds, TArray<Id>& nextStmtIds);
53+
p::TAccessRef<CStmtOutputs> access, p::TView<const Id> stmtIds, p::TArray<Id>& nextStmtIds);
5454

55-
void GetStmtChain(TAccessRef<CStmtOutput, CStmtOutputs> access, Id firstStmtId,
56-
TArray<Id>& stmtIds, Id& splitStmtId);
55+
void GetStmtChain(p::TAccessRef<CStmtOutput, CStmtOutputs> access, Id firstStmtId,
56+
p::TArray<Id>& stmtIds, Id& splitStmtId);
5757
} // namespace rift::ast

Libs/AST/Include/AST/Utils/TransactionUtils.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
namespace rift::ast
1313
{
14-
using TransactionAccess = TAccessRef<TWrite<CChanged>, TWrite<CFileDirty>, CChild, CFileRef>;
14+
using TransactionAccess =
15+
p::TAccessRef<p::TWrite<CChanged>, p::TWrite<CFileDirty>, CChild, CFileRef>;
1516

1617
namespace Transactions
1718
{
@@ -25,13 +26,13 @@ namespace rift::ast
2526
bool active = false;
2627

2728
ScopedTransaction() {}
28-
ScopedTransaction(const TransactionAccess& access, TView<const Id> entityIds);
29+
ScopedTransaction(const TransactionAccess& access, p::TView<const Id> entityIds);
2930
ScopedTransaction(ScopedTransaction&& other) noexcept;
3031
~ScopedTransaction();
3132
};
3233

3334

34-
bool PreChange(const TransactionAccess& access, TView<const Id> entityIds);
35+
bool PreChange(const TransactionAccess& access, p::TView<const Id> entityIds);
3536
void PostChange();
3637
} // namespace Transactions
3738
} // namespace rift::ast

Libs/AST/Include/AST/Utils/TypeUtils.h

+23-21
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,28 @@ namespace rift::ast
4949

5050
void InitTypeFromFileType(Tree& ast, Id id, p::Tag typeId);
5151

52-
Id CreateType(Tree& ast, p::Tag typeId, Tag name = Tag::None(), StringView path = {});
52+
Id CreateType(Tree& ast, p::Tag typeId, p::Tag name = p::Tag::None(), p::StringView path = {});
5353

54-
void RemoveTypes(TAccessRef<TWrite<CChild>, TWrite<CParent>, CFileRef> access, TView<Id> types,
55-
bool removeFromDisk = false);
54+
void RemoveTypes(p::TAccessRef<p::TWrite<CChild>, p::TWrite<CParent>, CFileRef> access,
55+
p::TView<Id> types, bool removeFromDisk = false);
5656

57-
void SerializeType(Tree& ast, Id id, String& data);
58-
void DeserializeType(Tree& ast, Id id, const String& data);
57+
void SerializeType(Tree& ast, p::Id id, p::String& data);
58+
void DeserializeType(Tree& ast, p::Id id, const p::String& data);
5959

6060
Id FindTypeByPath(Tree& ast, p::StringView path);
61-
bool IsClassType(TAccessRef<CDeclClass> access, Id typeId);
62-
bool IsStructType(TAccessRef<CDeclStruct> access, Id typeId);
63-
bool IsStaticType(TAccessRef<CDeclStatic> access, Id typeId);
64-
bool HasVariables(TAccessRef<CDeclType> access, Id typeId);
65-
bool HasFunctions(TAccessRef<CDeclType> access, Id typeId);
66-
bool HasFunctionBodies(TAccessRef<CDeclType> access, Id typeId);
61+
bool IsClassType(p::TAccessRef<CDeclClass> access, Id typeId);
62+
bool IsStructType(p::TAccessRef<CDeclStruct> access, Id typeId);
63+
bool IsStaticType(p::TAccessRef<CDeclStatic> access, Id typeId);
64+
bool HasVariables(p::TAccessRef<CDeclType> access, Id typeId);
65+
bool HasFunctions(p::TAccessRef<CDeclType> access, Id typeId);
66+
bool HasFunctionBodies(p::TAccessRef<CDeclType> access, Id typeId);
6767

68-
Id AddVariable(TypeRef type, Tag name);
69-
Id AddFunction(TypeRef type, Tag name);
68+
Id AddVariable(TypeRef type, p::Tag name);
69+
Id AddFunction(TypeRef type, p::Tag name);
7070

7171
Id AddCall(TypeRef type, Id targetFunctionId);
72-
Id AddFunctionInput(Tree& ast, Id functionId, Tag name = Tag::None());
73-
Id AddFunctionOutput(Tree& ast, Id functionId, Tag name = Tag::None());
72+
Id AddFunctionInput(Tree& ast, Id functionId, p::Tag name = p::Tag::None());
73+
Id AddFunctionOutput(Tree& ast, Id functionId, p::Tag name = p::Tag::None());
7474

7575
Id AddIf(TypeRef type);
7676
Id AddReturn(TypeRef type);
@@ -80,21 +80,23 @@ namespace rift::ast
8080
Id AddUnaryOperator(TypeRef type, UnaryOperatorType operatorType);
8181
Id AddBinaryOperator(TypeRef type, BinaryOperatorType operatorType);
8282

83-
Id FindChildByName(TAccessRef<CNamespace, CParent> access, Id ownerId, Tag functionName);
83+
Id FindChildByName(p::TAccessRef<CNamespace, CParent> access, Id ownerId, p::Tag functionName);
8484

85-
using RemoveAccess = TAccess<TWrite<CChanged>, TWrite<CFileDirty>, TWrite<CStmtInput>,
86-
TWrite<CStmtOutputs>, TWrite<CParent>, TWrite<CChild>, CFileRef>;
87-
void RemoveNodes(const RemoveAccess& access, TView<Id> ids);
85+
using RemoveAccess =
86+
p::TAccess<p::TWrite<CChanged>, p::TWrite<CFileDirty>, p::TWrite<CStmtInput>,
87+
p::TWrite<CStmtOutputs>, p::TWrite<CParent>, p::TWrite<CChild>, CFileRef>;
88+
void RemoveNodes(const RemoveAccess& access, p::TView<Id> ids);
8889

89-
bool CopyExpressionType(TAccessRef<TWrite<CExprTypeId>> access, Id sourcePinId, Id targetPinId);
90+
bool CopyExpressionType(
91+
p::TAccessRef<p::TWrite<CExprTypeId>> access, Id sourcePinId, Id targetPinId);
9092

9193

9294
void RegisterFileType(RiftType&& descriptor);
9395
void UnregisterFileType(p::Tag typeId);
9496

9597
p::TView<const RiftType> GetFileTypes();
9698
const RiftType* FindFileType(p::Tag typeId);
97-
const RiftType* FindFileType(p::TAccessRef<ast::CDeclType> access, ast::Id typeId);
99+
const RiftType* FindFileType(p::TAccessRef<CDeclType> access, ast::Id typeId);
98100

99101
template<typename TagType>
100102
void RegisterFileType(p::Tag typeId, RiftTypeSettings settings)

0 commit comments

Comments
 (0)