Compare commits
7 Commits
2cf78790db
...
master
Author | SHA1 | Date | |
---|---|---|---|
a2bcafbec6 | |||
66a15a7a02 | |||
a4969ee266 | |||
3109ea4641 | |||
c895772cff | |||
f55e96ec6a | |||
0ad0b337b3 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,3 +42,4 @@ GasaGen_*.pdb
|
||||
Project/Content/
|
||||
.vs
|
||||
.vs
|
||||
Project/Binaries
|
||||
|
22
.vscode/settings.json
vendored
22
.vscode/settings.json
vendored
@ -4,5 +4,25 @@
|
||||
"files.associations": {
|
||||
"*.rmd": "markdown",
|
||||
"*.rh": "cpp"
|
||||
}
|
||||
},
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#65c89b",
|
||||
"activityBar.background": "#65c89b",
|
||||
"activityBar.foreground": "#15202b",
|
||||
"activityBar.inactiveForeground": "#15202b99",
|
||||
"activityBarBadge.background": "#945bc4",
|
||||
"activityBarBadge.foreground": "#e7e7e7",
|
||||
"commandCenter.border": "#15202b99",
|
||||
"sash.hoverBorder": "#65c89b",
|
||||
"statusBar.background": "#42b883",
|
||||
"statusBar.foreground": "#15202b",
|
||||
"statusBarItem.hoverBackground": "#359268",
|
||||
"statusBarItem.remoteBackground": "#42b883",
|
||||
"statusBarItem.remoteForeground": "#15202b",
|
||||
"titleBar.activeBackground": "#42b883",
|
||||
"titleBar.activeForeground": "#15202b",
|
||||
"titleBar.inactiveBackground": "#42b88399",
|
||||
"titleBar.inactiveForeground": "#15202b99"
|
||||
},
|
||||
"peacock.color": "#42b883"
|
||||
}
|
Binary file not shown.
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
Binary file not shown.
@ -17,175 +17,12 @@
|
||||
}
|
||||
],
|
||||
"Plugins": [
|
||||
{
|
||||
"Name": "ModelingToolsEditorMode",
|
||||
"Enabled": true,
|
||||
"TargetAllowList": [
|
||||
"Editor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "AssetManagerEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserAliasDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserAssetDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserClassDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserFileDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "EngineAssetDefinitions",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "LevelSequenceEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "Niagara",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "PluginBrowser",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "RiderSourceCodeAccess",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "WorldPartitionHLODUtilities",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "PropertyAccessEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "BlueprintMaterialTextureNodes",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "RenderDocPlugin",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "N10XSourceCodeAccess",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystemSteam",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystemNull",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystem",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SteamController",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "GameInput",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "GameInputWindows",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "WinDualShock",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "RawInput",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "XInputDevice",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "EnhancedInput",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "InputDebugging",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "AISupport",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "Spatialization",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SoundUtilities",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SoundMod",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "Metasound",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "AudioWidgets",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "TextureFormatOodle",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OodleNetwork",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "GameplayTagsEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "MeshPainting",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "NiagaraFluids",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "XRVisualization",
|
||||
"Name": "AssetManagerEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
@ -193,7 +30,15 @@
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ReplicationGraph",
|
||||
"Name": "AudioWidgets",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "BlueprintMaterialTextureNodes",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "BlueprintStats",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
@ -201,61 +46,7 @@
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SlateScripting",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OpenXR",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Linux",
|
||||
"Android"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OpenXREyeTracker",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Linux",
|
||||
"Android"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OpenXRMsftHandInteraction",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Android"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "XRBase",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SimpleHMD",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Linux",
|
||||
"Android",
|
||||
"Mac",
|
||||
"IOS",
|
||||
"VisionOS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "SlateModelViewViewModel",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ModelViewViewModel",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SteamAudio",
|
||||
"Name": "ColorCorrectRegions",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
@ -278,14 +69,145 @@
|
||||
"Name": "CogAll",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserAliasDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserAssetDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserClassDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ContentBrowserFileDataSource",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ControlFlows",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "EngineAssetDefinitions",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "EnhancedInput",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "GameplayInsights",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "GameInput",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "GameInputWindows",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "GameplayAbilities",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "GameplayTagsEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "InputDebugging",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "LevelSequenceEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "LiveLink",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "LiveUpdateForSlate",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "MeshPainting",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "Metasound",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ModelingToolsEditorMode",
|
||||
"Enabled": true,
|
||||
"TargetAllowList": [
|
||||
"Editor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "ModelViewViewModel",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "N10XSourceCodeAccess",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "NetworkPredictionInsights",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "Niagara",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "NiagaraFluids",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OodleNetwork",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystem",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystemNull",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OnlineSubsystemSteam",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "OpenXR",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Linux",
|
||||
"Android"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OpenXREyeTracker",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Linux",
|
||||
"Android"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "OpenXRHandTracking",
|
||||
"Enabled": true,
|
||||
@ -296,27 +218,27 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "VisualStudioSourceCodeAccess",
|
||||
"Name": "OpenXRMsftHandInteraction",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Android"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "PluginBrowser",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SlateInsights",
|
||||
"Name": "PropertyAccessEditor",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "TraceUtilities",
|
||||
"Name": "RawInput",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "NetworkPredictionInsights",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "TraceSourceFilters",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "GameplayInsights",
|
||||
"Name": "RenderDocPlugin",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
@ -324,24 +246,102 @@
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "BlueprintStats",
|
||||
"Name": "ReplicationGraph",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ColorCorrectRegions",
|
||||
"Name": "RiderSourceCodeAccess",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "ControlFlows",
|
||||
"Name": "SimpleHMD",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64",
|
||||
"Linux",
|
||||
"Android",
|
||||
"Mac",
|
||||
"IOS",
|
||||
"VisionOS"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "SlateInsights",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "LiveUpdateForSlate",
|
||||
"Name": "SlateModelViewViewModel",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SlateScripting",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SoundMod",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "Spatialization",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SoundUtilities",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SteamAudio",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SteamController",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "SunPosition",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "TextureFormatOodle",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "TraceUtilities",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "TraceSourceFilters",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "VisualStudioSourceCodeAccess",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "WinDualShock",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "WorldPartitionHLODUtilities",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "XRBase",
|
||||
"Enabled": true
|
||||
},
|
||||
{
|
||||
"Name": "XInputDevice",
|
||||
"Enabled": true,
|
||||
"SupportedTargetPlatforms": [
|
||||
"Win64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Name": "XRVisualization",
|
||||
"Enabled": false
|
||||
}
|
||||
]
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
using BuildSettingsVersion = UnrealBuildTool.BuildSettingsVersion;
|
||||
using TargetInfo = UnrealBuildTool.TargetInfo;
|
||||
using TargetRules = UnrealBuildTool.TargetRules;
|
||||
using TargetType = UnrealBuildTool.TargetType;
|
||||
using TargetInfo = UnrealBuildTool.TargetInfo;
|
||||
using TargetRules = UnrealBuildTool.TargetRules;
|
||||
using TargetType = UnrealBuildTool.TargetType;
|
||||
|
||||
public class GasaTarget : TargetRules
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ void AGasaCharacter::ApplyEffectToSelf(TSubclassOf<UGameplayEffect> GE, float Le
|
||||
UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
|
||||
ensure(ASC);
|
||||
ensure(GE);
|
||||
FGameplayEffectContextHandle Context = ASC->MakeEffectContext();
|
||||
FGameplayEffectContextHandle Context = ASC->MakeEffectContext(); Context.AddSourceObject(this);
|
||||
FGameplayEffectSpecHandle Spec = ASC->MakeOutgoingSpec(GE, Level, Context );
|
||||
ASC->ApplyGameplayEffectSpecToTarget( * Spec.Data, ASC );
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnrealBuildTool;
|
||||
using ModuleRules = UnrealBuildTool.ModuleRules;
|
||||
using ReadOnlyTargetRules = UnrealBuildTool.ReadOnlyTargetRules;
|
||||
using TargetRules = UnrealBuildTool.TargetRules;
|
||||
using ModuleRules = UnrealBuildTool.ModuleRules;
|
||||
using ReadOnlyTargetRules = UnrealBuildTool.ReadOnlyTargetRules;
|
||||
using TargetRules = UnrealBuildTool.TargetRules;
|
||||
using UnrealTargetConfiguration = UnrealBuildTool.UnrealTargetConfiguration;
|
||||
|
||||
public class Gasa : ModuleRules
|
||||
@ -26,8 +26,10 @@ public class Gasa : ModuleRules
|
||||
bEnableExceptions = false;
|
||||
bEnableBufferSecurityChecks = false;
|
||||
bEnableNonInlinedGenCppWarnings = false;
|
||||
bEnableUndefinedIdentifierWarnings = false;
|
||||
// bEnableUndefinedIdentifierWarnings = false;
|
||||
bIgnoreUnresolvedSymbols = false;
|
||||
|
||||
UndefinedIdentifierWarningLevel = WarningLevel.Off;
|
||||
|
||||
bEnableObjCAutomaticReferenceCounting = false;
|
||||
bEnableObjCExceptions = false;
|
||||
|
@ -4,9 +4,11 @@
|
||||
|
||||
#include "GasaCommon.generated.h"
|
||||
|
||||
#ifndef global
|
||||
#define global
|
||||
#define internal static
|
||||
#define local_persist static
|
||||
#endif
|
||||
|
||||
#ifndef ccast
|
||||
#define ccast( Type, Value ) ( *const_cast<(Type)*>( &( Value ) ) )
|
||||
@ -15,7 +17,9 @@
|
||||
#define scast( Type, Value ) static_cast<Type>( Value )
|
||||
#endif
|
||||
|
||||
#ifndef bit
|
||||
#define bit(position) (1 << position)
|
||||
#endif
|
||||
|
||||
#pragma region Math
|
||||
#define m_pow2( value ) (value * value)
|
||||
@ -45,8 +49,10 @@ class UCameraComponent;
|
||||
class UGameplayEffect;
|
||||
class UInputAction;
|
||||
class UInputMappingContext;
|
||||
class UNamedSlot;
|
||||
class USphereComponent;
|
||||
class USpringArmComponent;
|
||||
class UTextBlock;
|
||||
class UTexture2D;
|
||||
#pragma endregion Engine Forwards
|
||||
|
||||
@ -68,6 +74,9 @@ class AGasaPlayerController;
|
||||
class AGasaPlayerState;
|
||||
class APlayerCharacter;
|
||||
|
||||
class UAttributeMenu;
|
||||
class UAttributeMenu_FramedValue;
|
||||
class UAttributeMenu_TextValueRow;
|
||||
class UGasaAbilitySystemComp;
|
||||
class UGasaAttributeSet;
|
||||
class UGasaDevOptions;
|
||||
|
@ -7,7 +7,6 @@ USTRUCT()
|
||||
struct GASA_API FGasaDevOptionsCache
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY()
|
||||
TArray<UObject*> AttributeSets;
|
||||
UPROPERTY()
|
||||
|
3
Project/Source/Gasa/UI/AttributeMenu/AttributeMenu.cpp
Normal file
3
Project/Source/Gasa/UI/AttributeMenu/AttributeMenu.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include "AttributeMenu.h"
|
||||
|
||||
|
14
Project/Source/Gasa/UI/AttributeMenu/AttributeMenu.h
Normal file
14
Project/Source/Gasa/UI/AttributeMenu/AttributeMenu.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "UI/GasaUserWidget.h"
|
||||
|
||||
#include "AttributeMenu.generated.h"
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class GASA_API UAttributeMenu : public UGasaUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
|
||||
};
|
26
Project/Source/Gasa/UI/AttributeMenu/FramedValue.cpp
Normal file
26
Project/Source/Gasa/UI/AttributeMenu/FramedValue.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "FramedValue.h"
|
||||
|
||||
#include "UI/GasaImage.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "UI/GasaSizeBox.h"
|
||||
|
||||
void UAttributeMenu_FramedValue::SetBackgroundBrush(FSlateBrush Brush)
|
||||
{
|
||||
BG->SetBrush(Brush);
|
||||
}
|
||||
|
||||
void UAttributeMenu_FramedValue::SetBorderBrush(FSlateBrush Brush)
|
||||
{
|
||||
Border->SetBrush(Brush);
|
||||
}
|
||||
|
||||
void UAttributeMenu_FramedValue::SetBoxSize(float Width, float Height)
|
||||
{
|
||||
SB_Root->SetWidthOverride(Width);
|
||||
SB_Root->SetHeightOverride(Height);
|
||||
}
|
||||
|
||||
void UAttributeMenu_FramedValue::SetText(FText Content)
|
||||
{
|
||||
Value->SetText(Content);
|
||||
}
|
42
Project/Source/Gasa/UI/AttributeMenu/FramedValue.h
Normal file
42
Project/Source/Gasa/UI/AttributeMenu/FramedValue.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include "UI/GasaUserWidget.h"
|
||||
|
||||
#include "FramedValue.generated.h"
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class GASA_API UAttributeMenu_FramedValue : public UGasaUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UGasaSizeBox* SB_Root;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UGasaImage* BG;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UGasaImage* Border;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UTextBlock* Value;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame")
|
||||
float BoxHeight;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame")
|
||||
float BoxWidth;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetBackgroundBrush(FSlateBrush Brush);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetBorderBrush(FSlateBrush Brush);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetBoxSize(float Width, float Height);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetText(FText Content);
|
||||
};
|
21
Project/Source/Gasa/UI/AttributeMenu/TextValueRow.cpp
Normal file
21
Project/Source/Gasa/UI/AttributeMenu/TextValueRow.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "TextValueRow.h"
|
||||
|
||||
#include "Components/TextBlock.h"
|
||||
#include "UI/GasaSizeBox.h"
|
||||
|
||||
|
||||
void UAttributeMenu_TextValueRow::SetAttributeName(FText Name)
|
||||
{
|
||||
TB_AttributeName->SetText(Name);
|
||||
}
|
||||
|
||||
void UAttributeMenu_TextValueRow::SetBoxSize(float Width, float Height)
|
||||
{
|
||||
SB_Root->SetWidthOverride(Width);
|
||||
SB_Root->SetHeightOverride(Height);
|
||||
}
|
||||
|
||||
void UAttributeMenu_TextValueRow::NativePreConstruct()
|
||||
{
|
||||
Super::NativePreConstruct();
|
||||
}
|
43
Project/Source/Gasa/UI/AttributeMenu/TextValueRow.h
Normal file
43
Project/Source/Gasa/UI/AttributeMenu/TextValueRow.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
#include "UI/GasaUserWidget.h"
|
||||
|
||||
#include "TextValueRow.generated.h"
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class GASA_API UAttributeMenu_TextValueRow : public UGasaUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UGasaSizeBox* SB_Root;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UTextBlock* TB_AttributeName;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UAttributeMenu_FramedValue* Value;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame", meta=(BindWidget))
|
||||
UNamedSlot* NSlot;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame")
|
||||
FText AttributeName;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame")
|
||||
float BoxHeight;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Frame")
|
||||
float BoxWidth;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetAttributeName(FText Name);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetBoxSize(float Width, float Height);
|
||||
|
||||
#pragma region UserWidget
|
||||
void NativePreConstruct() override;
|
||||
#pragma endregion UserWidget
|
||||
};
|
@ -196,4 +196,3 @@ void UGlobeProgressBar::Serialize(FStructuredArchive::FRecord Record)
|
||||
Super::Serialize(Record);
|
||||
}
|
||||
#pragma endregion UserWidget
|
||||
|
||||
|
@ -1,42 +1,50 @@
|
||||
using UnrealBuildTool;
|
||||
using ModuleRules = UnrealBuildTool.ModuleRules;
|
||||
using ReadOnlyTargetRules = UnrealBuildTool.ReadOnlyTargetRules;
|
||||
|
||||
public class GasaEditor : ModuleRules
|
||||
{
|
||||
public GasaEditor(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
#region Engine
|
||||
PrivateIncludePathModuleNames.AddRange(new string[] {
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
});
|
||||
PrivateDependencyModuleNames.AddRange(new string[] {
|
||||
"Core",
|
||||
"Engine",
|
||||
"CoreUObject",
|
||||
public GasaEditor(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
#region Engine
|
||||
|
||||
PrivateIncludePathModuleNames.AddRange(new string[]
|
||||
{
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
});
|
||||
PrivateDependencyModuleNames.AddRange(new string[]
|
||||
{
|
||||
"Core",
|
||||
"Engine",
|
||||
"CoreUObject",
|
||||
"EditorStyle",
|
||||
"PropertyEditor",
|
||||
"SlateCore",
|
||||
"Slate",
|
||||
"UMG",
|
||||
"UnrealEd",
|
||||
});
|
||||
#endregion Engine
|
||||
|
||||
"PropertyEditor",
|
||||
"SlateCore",
|
||||
"Slate",
|
||||
"UMG",
|
||||
"UnrealEd",
|
||||
});
|
||||
|
||||
#endregion Engine
|
||||
|
||||
PublicIncludePaths.Add("GasaEditor");
|
||||
PrivateDependencyModuleNames.Add("Gasa");
|
||||
|
||||
bWarningsAsErrors = false;
|
||||
ShadowVariableWarningLevel = UnrealBuildTool.WarningLevel.Off;
|
||||
|
||||
bWarningsAsErrors = false;
|
||||
ShadowVariableWarningLevel = UnrealBuildTool.WarningLevel.Off;
|
||||
UndefinedIdentifierWarningLevel = UnrealBuildTool.WarningLevel.Off;
|
||||
|
||||
|
||||
// gencpp related defines
|
||||
PublicDefinitions.Add("Build_Debug=1");
|
||||
PublicDefinitions.Add("GEN_TIME=1");
|
||||
PublicDefinitions.Add("GEN_EXECUTION_EXPRESSION_SUPPORT=0");
|
||||
PublicDefinitions.Add("GEN_EXPOSE_BACKEND=1");
|
||||
PublicDefinitions.Add("GEN_PARSER_DISABLE_MACRO_TYPEDEF=0");
|
||||
PublicDefinitions.Add("GEN_DONT_USE_NAMESPACE=0");
|
||||
PublicDefinitions.Add("GEN_BUILD_DEBUG=1");
|
||||
PublicDefinitions.Add("GEN_SUPPORT_CPP_REFERENCES=1");
|
||||
|
||||
OptimizeCode = CodeOptimization.Never;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,22 +36,22 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
|
||||
check( asset_name.StartsWith(TEXT("DT_") ))
|
||||
asset_name = asset_name.RightChop(3);
|
||||
String str_AssetName = to_string(asset_name);
|
||||
Str str_AssetName = to_string(asset_name);
|
||||
|
||||
String class_name = String::fmt_buf(GlobalAllocator, "U%S", str_AssetName);
|
||||
String header_file_name = String::fmt_buf(GlobalAllocator, "%S.h", str_AssetName);
|
||||
String inlines_file_name = String::fmt_buf(GlobalAllocator, "%S_Inlines.h", str_AssetName);
|
||||
String path_header_file = String::fmt_buf(GlobalAllocator, path_gasa_ability_system "%S.h", str_AssetName);
|
||||
String path_inlines_file = String::fmt_buf(GlobalAllocator, path_gasa_ability_system "%S_Inlines.h", str_AssetName);
|
||||
String path_source_file = String::fmt_buf(GlobalAllocator, path_gasa_ability_system "%S.cpp", str_AssetName);
|
||||
String uht_include_file = String::fmt_buf(GlobalAllocator, "%S.generated.h", str_AssetName);
|
||||
Str class_name = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, "U%S", str_AssetName);
|
||||
Str header_file_name = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, "%S.h", str_AssetName);
|
||||
Str inlines_file_name = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, "%S_Inlines.h", str_AssetName);
|
||||
Str path_header_file = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, path_gasa_ability_system "%S.h", str_AssetName);
|
||||
Str path_inlines_file = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, path_gasa_ability_system "%S_Inlines.h", str_AssetName);
|
||||
Str path_source_file = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, path_gasa_ability_system "%S.cpp", str_AssetName);
|
||||
Str uht_include_file = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, "%S.generated.h", str_AssetName);
|
||||
|
||||
CodeType type_UAttributeSet = def_type( txt("UAttributeSet") );
|
||||
CodeComment generation_notice = def_comment(txt("Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp"));
|
||||
CodeTypename type_UAttributeSet = def_type( txt("UAttributeSet") );
|
||||
CodeComment generation_notice = def_comment(txt("Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp"));
|
||||
|
||||
CodeAttributes api_attribute = def_attributes( UModule_GASA_API->Name);
|
||||
|
||||
Builder header = builder_open( path_header_file );
|
||||
Builder header = gasa_builder_open( path_header_file );
|
||||
{
|
||||
header.print(generation_notice);
|
||||
header.print(pragma_once);
|
||||
@ -65,7 +65,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
|
||||
gen::CodeClass attribute_set_class = {};
|
||||
{
|
||||
CodeBody body = def_body( CodeT::Class_Body );
|
||||
CodeBody body = def_body( CT_Class_Body );
|
||||
{
|
||||
body.append( UHT_GENERATED_BODY);
|
||||
body.append( access_public );
|
||||
@ -76,15 +76,15 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
// Generate UPROPERTIES for each attribute field, organized by category
|
||||
for ( TPair< FName, TArray<FAttributeSetField>>& attributes : AttributesByCategory )
|
||||
{
|
||||
String category_name = to_string(attributes.Key);
|
||||
CodeComment category_cmt = def_comment(token_fmt("category_name", (StrC)category_name, "<category_name> Attributes"));
|
||||
Str category_name = to_string(attributes.Key);
|
||||
CodeComment category_cmt = def_comment(token_fmt("category_name", category_name, "<category_name> Attributes"));
|
||||
body.append(category_cmt);
|
||||
body.append(fmt_newline);
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
Code field_uproperty = code_fmt(
|
||||
"category", (StrC)to_string(attribute.Category),
|
||||
"property", (StrC)to_string(attribute.Name),
|
||||
"category", to_string(attribute.Category),
|
||||
"property", to_string(attribute.Name),
|
||||
stringize(
|
||||
UPROPERTY(ReplicatedUsing = Client_OnRep_<property>, EditAnywhere, BlueprintReadWrite, Category = "Attributes|<category>")
|
||||
FGameplayAttributeData <property>;
|
||||
@ -104,7 +104,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
body.append(fmt_newline);
|
||||
body.append(umeta_UFUNCTION);
|
||||
body.append(fmt_newline);
|
||||
body.append(code_fmt("property", (StrC)to_string(attribute.Name), stringize(
|
||||
body.append(code_fmt("property", to_string(attribute.Name), stringize(
|
||||
void Client_OnRep_<property>(FGameplayAttributeData& Prev<property>);
|
||||
)));
|
||||
}
|
||||
@ -118,8 +118,8 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
CodeFn generated_get_attribute = parse_function(token_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"property", (StrC)to_string(attribute.Name),
|
||||
"class_name", class_name,
|
||||
"property", to_string(attribute.Name),
|
||||
stringize(
|
||||
static FGameplayAttribute Get<property>Attribute()
|
||||
{
|
||||
@ -135,7 +135,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
for ( TPair< FName, TArray<FAttributeSetField>>& attributes : AttributesByCategory )
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
body.append(code_fmt("property", (StrC)to_string(attribute.Name),
|
||||
body.append(code_fmt("property", to_string(attribute.Name),
|
||||
stringize(
|
||||
FORCEINLINE float Get<property>() const
|
||||
{
|
||||
@ -154,7 +154,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
for ( TPair< FName, TArray<FAttributeSetField>>& attributes : AttributesByCategory )
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
body.append(code_fmt("property", (StrC)to_string(attribute.Name),
|
||||
body.append(code_fmt("property", to_string(attribute.Name),
|
||||
stringize(
|
||||
FORCEINLINE void Set<property>(float NewVal);
|
||||
)));
|
||||
@ -180,10 +180,10 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
body.append(fmt_newline);
|
||||
}
|
||||
|
||||
attribute_set_class = def_class( class_name, body
|
||||
, type_UAttributeSet, AccessSpec::Public
|
||||
attribute_set_class = def_class( class_name, { body
|
||||
, type_UAttributeSet, AccessSpec_Public
|
||||
, api_attribute
|
||||
);
|
||||
});
|
||||
header.print(UHT_UCLASS);
|
||||
header.print(attribute_set_class);
|
||||
}
|
||||
@ -192,7 +192,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
format_file(path_header_file);
|
||||
}
|
||||
|
||||
Builder inlines = builder_open( path_inlines_file );
|
||||
Builder inlines = gasa_builder_open( path_inlines_file );
|
||||
{
|
||||
inlines.print(generation_notice);
|
||||
inlines.print(pragma_once);
|
||||
@ -201,7 +201,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
inlines.print(def_include(txt("AbilitySystemComponent.h")));
|
||||
inlines.print(fmt_newline);
|
||||
|
||||
CodeBody body = def_body(ECode::Global_Body);
|
||||
CodeBody body = def_body(CT_Global_Body);
|
||||
{
|
||||
body.append(def_pragma(txt("region Attribute Setters")));
|
||||
{
|
||||
@ -209,8 +209,8 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
CodeFn generated_get_attribute = parse_function(token_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"property", (StrC)to_string(attribute.Name),
|
||||
"class_name", class_name,
|
||||
"property", to_string(attribute.Name),
|
||||
stringize(
|
||||
FORCEINLINE void <class_name>::Set<property>(float NewVal)
|
||||
{
|
||||
@ -230,7 +230,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
inlines.print(fmt_newline);
|
||||
|
||||
CodeNS ns_gasa = parse_namespace(token_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"class_name", class_name,
|
||||
stringize(
|
||||
namespace Gasa
|
||||
{
|
||||
@ -247,7 +247,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
format_file(path_inlines_file);
|
||||
}
|
||||
|
||||
Builder source = builder_open( path_source_file );
|
||||
Builder source = gasa_builder_open( path_source_file );
|
||||
{
|
||||
source.print(generation_notice);
|
||||
header.print(fmt_newline);
|
||||
@ -260,7 +260,7 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
source.print(def_include(txt("Networking/GasaNetLibrary.h")));
|
||||
source.print(def_include(txt("GameplayEffectExtension.h")));
|
||||
{
|
||||
CodeBody body = def_body(CodeT::Global_Body);
|
||||
CodeBody body = def_body(CT_Global_Body);
|
||||
body.append(fmt_newline);
|
||||
|
||||
CodeConstructor constructor_for_UGasaAttributeSet = parse_constructor(code(
|
||||
@ -278,8 +278,8 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
CodeFn field_impl = parse_function(token_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"property", (StrC)to_string(attribute.Name),
|
||||
"class_name", class_name,
|
||||
"property", to_string(attribute.Name),
|
||||
"from_notice", txt("\n// From GAMEPLAYATTRIBUTE_REPNOTIFY\n"),
|
||||
stringize(
|
||||
void <class_name>::Client_OnRep_<property>(FGameplayAttributeData & Prev<property>)
|
||||
@ -298,8 +298,8 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
CodeFn PostGameplayEffectExecute;
|
||||
CodeFn PreAttributeChange;
|
||||
{
|
||||
CodeBody pre_attribute_clamps = def_body(CodeT::Function_Body);
|
||||
CodeBody post_attribute_clamps = def_body(CodeT::Function_Body);
|
||||
CodeBody pre_attribute_clamps = def_body(CT_Function_Body);
|
||||
CodeBody post_attribute_clamps = def_body(CT_Function_Body);
|
||||
|
||||
// Generate field clamping ops for the pre & post functions
|
||||
{
|
||||
@ -311,22 +311,22 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
for (TPair< FName, TArray<FAttributeSetField>>& attributes : AttributesByCategory)
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
String clamp_min;
|
||||
Str clamp_min;
|
||||
if (attribute.bUseMinAttribute)
|
||||
clamp_min = get_cached_string(token_fmt("MinName", (StrC)to_string(attribute.MinAttribute), "Get<MinName>()"));
|
||||
clamp_min = cache_str(token_fmt("MinName", to_string(attribute.MinAttribute), "Get<MinName>()"));
|
||||
else
|
||||
clamp_min = String::fmt_buf(GlobalAllocator, "%f", attribute.MinValue);
|
||||
clamp_min = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, "%f", attribute.MinValue);
|
||||
|
||||
String clamp_max;
|
||||
Str clamp_max;
|
||||
if (attribute.bUseMaxAttribute)
|
||||
clamp_max = get_cached_string(token_fmt("MaxName", (StrC)to_string(attribute.MaxAttribute), "Get<MaxName>()"));
|
||||
clamp_max = cache_str(token_fmt("MaxName", to_string(attribute.MaxAttribute), "Get<MaxName>()"));
|
||||
else
|
||||
clamp_max = String::fmt_buf(GlobalAllocator, "%f", attribute.MaxValue);
|
||||
clamp_max = StrBuilder::fmt_buf(gen_ctx.Allocator_Temp, "%f", attribute.MaxValue);
|
||||
|
||||
pre_attribute_clamps.append(code_fmt(
|
||||
"field", (StrC)to_string(attribute.Name),
|
||||
"clamp_min", (StrC)clamp_min,
|
||||
"clamp_max", (StrC)clamp_max,
|
||||
"field", to_string(attribute.Name),
|
||||
"clamp_min", clamp_min,
|
||||
"clamp_max", clamp_max,
|
||||
stringize(
|
||||
if (Attribute == Get<field>Attribute())
|
||||
{
|
||||
@ -335,9 +335,9 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
)));
|
||||
|
||||
post_attribute_clamps.append(code_fmt(
|
||||
"field", (StrC)to_string(attribute.Name),
|
||||
"clamp_min", (StrC)clamp_min,
|
||||
"clamp_max", (StrC)clamp_max,
|
||||
"field", to_string(attribute.Name),
|
||||
"clamp_min", clamp_min,
|
||||
"clamp_max", clamp_max,
|
||||
stringize(
|
||||
if (Data.EvaluatedData.Attribute == Get<field>Attribute())
|
||||
{
|
||||
@ -353,8 +353,8 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
}
|
||||
|
||||
PreAttributeChange = parse_function(token_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"attribute_clamps", (StrC)pre_attribute_clamps.to_string(),
|
||||
"class_name", class_name,
|
||||
"attribute_clamps", pre_attribute_clamps.to_strbuilder().to_str(),
|
||||
stringize(
|
||||
void <class_name>::PreAttributeChange(FGameplayAttribute const& Attribute, float& NewValue)
|
||||
{
|
||||
@ -365,8 +365,8 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
)));
|
||||
|
||||
PostGameplayEffectExecute = parse_function(token_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"attribute_clamps", (StrC)post_attribute_clamps.to_string(),
|
||||
"class_name", class_name,
|
||||
"attribute_clamps", post_attribute_clamps.to_strbuilder().to_str(),
|
||||
stringize(
|
||||
void <class_name>::PostGameplayEffectExecute(FGameplayEffectModCallbackData const& Data)
|
||||
{
|
||||
@ -387,23 +387,23 @@ void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
|
||||
CodeFn GetLifetimeOfReplicatedProps;
|
||||
{
|
||||
CodeBody field_lifetimes = def_body(CodeT::Function_Body);
|
||||
CodeBody field_lifetimes = def_body(CT_Function_Body);
|
||||
field_lifetimes.append(fmt_newline);
|
||||
field_lifetimes.append(fmt_newline);
|
||||
for (TPair< FName, TArray<FAttributeSetField>>& attributes : AttributesByCategory)
|
||||
for (FAttributeSetField attribute : attributes.Value)
|
||||
{
|
||||
field_lifetimes.append(code_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"property", (StrC)to_string(attribute.Name),
|
||||
"class_name", class_name,
|
||||
"property", to_string(attribute.Name),
|
||||
stringize(
|
||||
DOREPLIFETIME_DEFAULT_GAS( <class_name>, <property> );
|
||||
)));
|
||||
}
|
||||
|
||||
GetLifetimeOfReplicatedProps = parse_function(token_fmt(
|
||||
"class_name", (StrC)class_name,
|
||||
"property_lifetimes", (StrC)(field_lifetimes.to_string()),
|
||||
"class_name", class_name,
|
||||
"property_lifetimes", field_lifetimes.to_strbuilder().to_str(),
|
||||
stringize(
|
||||
void <class_name>::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "ChangeBPActionMenu.h"
|
||||
#include "GasaGen_Common.h"
|
||||
|
||||
constexpr StrC SBlueprintActionMenu_Construct_Replacement = txt(R"(
|
||||
constexpr Str SBlueprintActionMenu_Construct_Replacement = txt(R"(
|
||||
void SBlueprintActionMenu::Construct( const FArguments& InArgs, TSharedPtr<FBlueprintEditor> InEditor )
|
||||
{
|
||||
bActionExecuted = false;
|
||||
@ -244,23 +244,22 @@ void change_SBlueprintActionMenu_Construct()
|
||||
#define path_SBlueprintActionMenuCpp \
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Editor\Kismet\Private\SBlueprintActionMenu.cpp)"
|
||||
|
||||
FileContents content = file_read_contents( GlobalAllocator, true, path_SBlueprintActionMenuCpp );
|
||||
CodeBody parsed_SBlueprintActionMenu = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
FileContents content = file_read_contents( gen_ctx.Allocator_Temp, true, path_SBlueprintActionMenuCpp );
|
||||
CodeBody parsed_SBlueprintActionMenu = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
CodeFn signature_to_change = parse_function( code(
|
||||
void SBlueprintActionMenu::Construct( const FArguments& InArgs, TSharedPtr<FBlueprintEditor> InEditor ) {}
|
||||
));
|
||||
|
||||
CodeBody changed_SBlueprintActionMenu = def_body(ECode::Global_Body);
|
||||
CodeBody changed_SBlueprintActionMenu = def_body(CT_Global_Body);
|
||||
for ( Code code : parsed_SBlueprintActionMenu )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
using namespace ECode;
|
||||
case Function:
|
||||
CodeFn function_def = code.cast<CodeFn>();
|
||||
case CT_Function:
|
||||
CodeFn function_def = cast(CodeFn, code);
|
||||
|
||||
if ( String::are_equal(function_def->Name, signature_to_change->Name)
|
||||
if ( str_are_equal(function_def->Name, signature_to_change->Name)
|
||||
&& function_def->Params.is_equal(signature_to_change->Params))
|
||||
{
|
||||
code = parse_function( SBlueprintActionMenu_Construct_Replacement );
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "GasaGen_Common.h"
|
||||
#include "GasaEditorCommon.h"
|
||||
|
||||
constexpr StrC SAssetView_Construct_Replacement = txt(R"(
|
||||
constexpr Str SAssetView_Construct_Replacement = txt(R"(
|
||||
void SAssetView::Construct( const FArguments& InArgs )
|
||||
{
|
||||
ViewCorrelationGuid = FGuid::NewGuid();
|
||||
@ -391,7 +391,7 @@ void SAssetView::Construct( const FArguments& InArgs )
|
||||
}
|
||||
})");
|
||||
|
||||
constexpr StrC SAssetView_GetThumbnailScale_Replacement = txt(R"(
|
||||
constexpr Str SAssetView_GetThumbnailScale_Replacement = txt(R"(
|
||||
float SAssetView::GetThumbnailScale() const
|
||||
{
|
||||
float BaseScale;
|
||||
@ -423,7 +423,7 @@ float SAssetView::GetThumbnailScale() const
|
||||
return BaseScale * GetTickSpaceGeometry().Scale;
|
||||
})");
|
||||
|
||||
constexpr StrC SPropertyMenuAssetPicker_Construct_Replacement = txt(R"(
|
||||
constexpr Str SPropertyMenuAssetPicker_Construct_Replacement = txt(R"(
|
||||
void SPropertyMenuAssetPicker::Construct( const FArguments& InArgs )
|
||||
{
|
||||
CurrentObject = InArgs._InitialObject;
|
||||
@ -595,27 +595,26 @@ void change_EditorContentList()
|
||||
#define path_PropertyEditorAssetConstantsHeader \
|
||||
R"(C:\Projects\Unreal\Surgo\UE\Engine\Source\Editor\PropertyEditor\Private\UserInterface\PropertyEditor\PropertyEditorAssetConstants.h)"
|
||||
|
||||
FileContents content = file_read_contents( GlobalAllocator, true, path_PropertyEditorAssetConstantsHeader );
|
||||
CodeBody parsed_PropertyEditorAssetConstantsHeader = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
FileContents content = file_read_contents( gen_ctx.Allocator_Temp, true, path_PropertyEditorAssetConstantsHeader );
|
||||
CodeBody parsed_PropertyEditorAssetConstantsHeader = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
CodeBody changed_PropertyEditorAssetConstantsHeader = def_body(ECode::Global_Body);
|
||||
CodeBody changed_PropertyEditorAssetConstantsHeader = def_body(CT_Global_Body);
|
||||
for ( Code code : parsed_PropertyEditorAssetConstantsHeader )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
using namespace ECode;
|
||||
case Namespace:
|
||||
CodeNS ns = code.cast<CodeNS>();
|
||||
case CT_Namespace:
|
||||
CodeNS ns = cast(CodeNS, code);
|
||||
for ( Code ns_code : ns->Body )
|
||||
{
|
||||
switch ( ns_code->Type )
|
||||
{
|
||||
case Variable:
|
||||
CodeVar var = ns_code.cast<CodeVar>();
|
||||
case CT_Variable:
|
||||
CodeVar var = cast(CodeVar, ns_code);
|
||||
if ( var->Name.starts_with(txt("ContentBrowserWindowSize")) )
|
||||
{
|
||||
// Swap value with new value
|
||||
var->Value->Content = get_cached_string(txt("300.0f, 600.0f"));
|
||||
var->Value->Content = cache_str(txt("300.0f, 600.0f"));
|
||||
Gasa::LogEditor("Swapped: " + to_fstring(var->Name));
|
||||
}
|
||||
|
||||
@ -639,8 +638,8 @@ void change_EditorContentList()
|
||||
#define path_SAssetView \
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Editor\ContentBrowser\Private\SAssetView.cpp)"
|
||||
|
||||
FileContents content = file_read_contents( GlobalAllocator, true, path_SAssetView );
|
||||
CodeBody parsed_SAssetViewCpp = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
FileContents content = file_read_contents( gen_ctx.Allocator_Temp, true, path_SAssetView );
|
||||
CodeBody parsed_SAssetViewCpp = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
CodeFn signature_Construct = parse_function( code(
|
||||
void SAssetView::Construct( const FArguments& InArgs ) {}
|
||||
@ -649,24 +648,23 @@ void change_EditorContentList()
|
||||
float SAssetView::GetThumbnailScale() const {}
|
||||
));
|
||||
|
||||
CodeBody changed_SAssetViewCpp = def_body(ECode::Global_Body);
|
||||
CodeBody changed_SAssetViewCpp = def_body(CT_Global_Body);
|
||||
for ( Code code : parsed_SAssetViewCpp )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
using namespace ECode;
|
||||
case Function:
|
||||
case CT_Function:
|
||||
{
|
||||
CodeFn function_def = code.cast<CodeFn>();
|
||||
CodeFn function_def = cast(CodeFn, code);
|
||||
|
||||
if ( String::are_equal(function_def->Name, signature_Construct->Name)
|
||||
&& function_def->Params.is_equal(signature_Construct->Params))
|
||||
if ( str_are_equal(function_def->Name, signature_Construct->Name)
|
||||
&& function_def->Params && function_def->Params.is_equal(signature_Construct->Params))
|
||||
{
|
||||
code = parse_function( SAssetView_Construct_Replacement );
|
||||
Gasa::LogEditor("Swapped: " + to_fstring(function_def->Name));
|
||||
}
|
||||
else if ( String::are_equal(function_def->Name, signature_GetThumbnailScale->Name)
|
||||
&& function_def->Params.is_equal(signature_GetThumbnailScale->Params))
|
||||
else if ( str_are_equal(function_def->Name, signature_GetThumbnailScale->Name)
|
||||
&& function_def->Params && function_def->Params.is_equal(signature_GetThumbnailScale->Params))
|
||||
{
|
||||
code = parse_function( SAssetView_GetThumbnailScale_Replacement );
|
||||
Gasa::LogEditor("Swapped: " + to_fstring(function_def->Name));
|
||||
@ -689,24 +687,23 @@ void change_EditorContentList()
|
||||
#define path_SPropertyMenuAssetPicker \
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Editor\PropertyEditor\Private\UserInterface\PropertyEditor\SPropertyMenuAssetPicker.cpp)"
|
||||
|
||||
FileContents content = file_read_contents( GlobalAllocator, true, path_SPropertyMenuAssetPicker );
|
||||
CodeBody parsed = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
FileContents content = file_read_contents( gen_ctx.Allocator_Temp, true, path_SPropertyMenuAssetPicker );
|
||||
CodeBody parsed = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
CodeFn signature = parse_function( code(
|
||||
void SPropertyMenuAssetPicker::Construct( const FArguments& InArgs ) {}
|
||||
));
|
||||
|
||||
CodeBody changed = def_body(ECode::Global_Body);
|
||||
CodeBody changed = def_body(CT_Global_Body);
|
||||
for ( Code code : parsed )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
using namespace ECode;
|
||||
case Function:
|
||||
case CT_Function:
|
||||
{
|
||||
CodeFn function_def = code.cast<CodeFn>();
|
||||
CodeFn function_def = cast(CodeFn, code);
|
||||
|
||||
if ( String::are_equal(function_def->Name, signature->Name)
|
||||
if ( str_are_equal(function_def->Name, signature->Name)
|
||||
&& function_def->Params.is_equal(signature->Params))
|
||||
{
|
||||
code = parse_function( SPropertyMenuAssetPicker_Construct_Replacement );
|
||||
|
@ -8,38 +8,38 @@
|
||||
|
||||
void generate_DevOptionsCache()
|
||||
{
|
||||
Array<CodeVar> GasaDevOptions_UPROPERTIES = Array<CodeVar>::init(GlobalAllocator);
|
||||
Array<CodeVar> GasaDevOptions_UPROPERTIES = Array<CodeVar>::init(gen_ctx.Allocator_Temp);
|
||||
{
|
||||
CodeBody header_GasaDevOptions = parse_file( path_module_gasa "GasaDevOptions.h" );
|
||||
CodeClass UGasaDevOptions = NoCode;
|
||||
CodeClass UGasaDevOptions = NullCode;
|
||||
for (Code entry : header_GasaDevOptions)
|
||||
{
|
||||
if ( entry->Type == ECode::Class && entry->Name.starts_with( txt("UGasaDevOptions")) )
|
||||
if ( entry->Type == CT_Class && entry->Name.starts_with( txt("UGasaDevOptions")) )
|
||||
{
|
||||
UGasaDevOptions = entry.cast<CodeClass>();
|
||||
UGasaDevOptions = cast(CodeClass, entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (Code member = UGasaDevOptions->Body.begin(); member != UGasaDevOptions->Body.end(); ++ member)
|
||||
{
|
||||
if ( member->Type == ECode::Untyped && member->Name.starts_with(str_UPROPERTY) )
|
||||
if ( member->Type == CT_Untyped && member->Name.starts_with(str_UPROPERTY) )
|
||||
++ member;
|
||||
if ( member->Type == ECode::Variable
|
||||
if ( member->Type == CT_Variable
|
||||
&& ( member->ValueType->Name.starts_with( txt("TArray< TSoftObjectPtr"))
|
||||
|| member->ValueType->Name.starts_with( txt("TSoftClassPtr"))
|
||||
|| member->ValueType->Name.starts_with( txt("TSoftObjectPtr")) )
|
||||
)
|
||||
GasaDevOptions_UPROPERTIES.append(member.cast<CodeVar>());
|
||||
GasaDevOptions_UPROPERTIES.append(cast(CodeVar, member));
|
||||
}
|
||||
}
|
||||
|
||||
CodeComment generation_notice = def_comment(txt("Generated by GasaGen/GasaGen_DevOptionsCache.cpp"));
|
||||
|
||||
CodeType t_UClassPtr = parse_type(code(UClass*));
|
||||
CodeType t_UObjectPtr = parse_type(code(UObject*));
|
||||
CodeType t_Array_UObjectPtr = parse_type(code(TArray< UObject* >));
|
||||
CodeTypename t_UClassPtr = parse_type(code(UClass*));
|
||||
CodeTypename t_UObjectPtr = parse_type(code(UObject*));
|
||||
CodeTypename t_Array_UObjectPtr = parse_type(code(TArray< UObject* >));
|
||||
|
||||
Builder header = builder_open( path_module_gasa "GasaDevOptionsCache.h" );
|
||||
Builder header = gasa_builder_open( path_module_gasa "GasaDevOptionsCache.h" );
|
||||
{
|
||||
header.print( generation_notice );
|
||||
header.print( pragma_once );
|
||||
@ -50,7 +50,7 @@ void generate_DevOptionsCache()
|
||||
header.print( UHT_USTRUCT );
|
||||
CodeStruct FGasaDevOptionsCache;
|
||||
{
|
||||
CodeBody body = def_body(ECode::Struct_Body);
|
||||
CodeBody body = def_body(CT_Struct_Body);
|
||||
{
|
||||
body.append(UHT_GENERATED_BODY);
|
||||
body.append(fmt_newline);
|
||||
@ -72,7 +72,7 @@ void generate_DevOptionsCache()
|
||||
body.append(fmt_newline);
|
||||
body.append( parse_function(code( void CachedDevOptions(); )));
|
||||
}
|
||||
FGasaDevOptionsCache = parse_struct( token_fmt( "body", (StrC)body.to_string(), stringize(
|
||||
FGasaDevOptionsCache = parse_struct( token_fmt( "body", body.to_strbuilder().to_str(), stringize(
|
||||
struct GASA_API FGasaDevOptionsCache {
|
||||
<body>
|
||||
};
|
||||
@ -84,15 +84,15 @@ void generate_DevOptionsCache()
|
||||
format_file( path_module_gasa "GasaDevOptionsCache.h" );
|
||||
}
|
||||
|
||||
Builder source = builder_open( path_module_gasa "GasaDevOptionsCache.cpp" );
|
||||
Builder source = gasa_builder_open( path_module_gasa "GasaDevOptionsCache.cpp" );
|
||||
{
|
||||
Array<CodeInclude> GasaDevOptions_Includes = Array<CodeInclude>::init(GlobalAllocator);
|
||||
Array<CodeInclude> GasaDevOptions_Includes = Array<CodeInclude>::init(gen_ctx.Allocator_Temp);
|
||||
{
|
||||
CodeBody source_GasaDevOptions = parse_file( path_module_gasa "GasaDevOptions.cpp");
|
||||
for ( Code entry : source_GasaDevOptions )
|
||||
{
|
||||
if ( entry->Type == ECode::Preprocess_Include )
|
||||
GasaDevOptions_Includes.append( entry.cast<CodeInclude>() );
|
||||
if ( entry->Type == CT_Preprocess_Include )
|
||||
GasaDevOptions_Includes.append( cast(CodeInclude, entry));
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,17 +105,17 @@ void generate_DevOptionsCache()
|
||||
source.print( parse_using(code( using namespace Gasa; )));
|
||||
source.print(fmt_newline);
|
||||
|
||||
CodeBody cached_property_assignments = def_body(ECode::Function_Body);
|
||||
CodeBody cached_property_assignments = def_body(CT_Function_Body);
|
||||
{
|
||||
cached_property_assignments.append(fmt_newline);
|
||||
cached_property_assignments.append(fmt_newline);
|
||||
for (CodeVar var : GasaDevOptions_UPROPERTIES)
|
||||
{
|
||||
if ( var->ValueType.to_string().starts_with(txt("TArray")) )
|
||||
if ( var->ValueType->Name.starts_with(txt("TArray")) )
|
||||
{
|
||||
#pragma push_macro("TEXT")
|
||||
#undef TEXT
|
||||
Code assignment = code_fmt( "property_array", (StrC)var->Name, stringize(
|
||||
Code assignment = code_fmt( "property_array", var->Name, stringize(
|
||||
for ( auto& entry : DevOpts-> <property_array> )
|
||||
{
|
||||
<property_array>.Push( entry.LoadSynchronous() );
|
||||
@ -132,7 +132,7 @@ void generate_DevOptionsCache()
|
||||
|
||||
#pragma push_macro("TEXT")
|
||||
#undef TEXT
|
||||
Code assignment = code_fmt( "property", (StrC)var->Name, stringize(
|
||||
Code assignment = code_fmt( "property", var->Name, stringize(
|
||||
<property> = DevOpts-> <property>.LoadSynchronous();
|
||||
ensureMsgf(<property> != nullptr, TEXT("<property> is null, DO NOT RUN PIE or else you may get a crash if not handled in BP or C++"));
|
||||
));
|
||||
@ -144,7 +144,7 @@ void generate_DevOptionsCache()
|
||||
}
|
||||
|
||||
CodeFn CachedDevOptions = parse_function( token_fmt(
|
||||
"cached_property_assignments", (StrC)cached_property_assignments.to_string(),
|
||||
"cached_property_assignments", cached_property_assignments.to_strbuilder().to_str(),
|
||||
stringize(
|
||||
void FGasaDevOptionsCache::CachedDevOptions()
|
||||
{
|
||||
@ -163,4 +163,3 @@ void generate_DevOptionsCache()
|
||||
|
||||
#pragma pop_macro("ensureMsgf")
|
||||
#pragma pop_macro("GASA_API")
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
#define LOCTEXT_NAMESPACE "GasaEditor"
|
||||
|
||||
global String Project_Path;
|
||||
global String Root_Path;
|
||||
global Str Project_Path;
|
||||
global Str Root_Path;
|
||||
|
||||
global Code UHT_GENERATED_BODY;
|
||||
global Code UHT_UCLASS;
|
||||
@ -19,6 +19,8 @@ global Code UHT_UPROPERTY;
|
||||
global Code UHT_USTRUCT;
|
||||
global Code UModule_GASA_API;
|
||||
|
||||
global Context gen_ctx = {};
|
||||
|
||||
void Execute_GasaModule_Codegen()
|
||||
{
|
||||
FScopedSlowTask SlowTask(100.0f, LOCTEXT("RunningGasaGen", "Running GasaGen..."));
|
||||
@ -28,8 +30,7 @@ void Execute_GasaModule_Codegen()
|
||||
{
|
||||
Gasa::LogEditor("Executing: Gasa Module code generation.");
|
||||
|
||||
gen::init();
|
||||
|
||||
gen::init( & gen_ctx);
|
||||
FString ue_project_path = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir());
|
||||
FPaths::NormalizeDirectoryName(ue_project_path);
|
||||
char const* ue_ansi_project_path = TCHAR_TO_ANSI(*ue_project_path);
|
||||
@ -38,8 +39,8 @@ void Execute_GasaModule_Codegen()
|
||||
FPaths::NormalizeDirectoryName(ue_root_path);
|
||||
char const* ue_ansi_rooot_path = TCHAR_TO_ANSI(*ue_project_path);
|
||||
|
||||
Project_Path = String::make_length(GlobalAllocator, ue_ansi_project_path, ue_project_path.Len());
|
||||
Root_Path = String::make_length(GlobalAllocator, ue_ansi_rooot_path, ue_root_path.Len());
|
||||
Project_Path = StrBuilder::make_length(gen_ctx.Allocator_Temp, ue_ansi_project_path, ue_project_path.Len());
|
||||
Root_Path = StrBuilder::make_length(gen_ctx.Allocator_Temp, ue_ansi_rooot_path, ue_root_path.Len());
|
||||
|
||||
// Initialize Globals
|
||||
{
|
||||
@ -66,62 +67,72 @@ void Execute_GasaModule_Codegen()
|
||||
}
|
||||
|
||||
// Populate Defines
|
||||
{
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_CLASS));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DELEGATE_RetVal_OneParam));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DELEGATE_RetVal_ThreeParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DELEGATE_SixParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_EVENT_ThreeParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_EVENT_TwoParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_FUNCTION));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_LOG_CATEGORY_EXTERN));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_MULTICAST_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_MULTICAST_DELEGATE_ThreeParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_MULTICAST_DELEGATE_TwoParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams));
|
||||
PreprocessorDefines.append(get_cached_string(str_DEFINE_ACTORDESC_TYPE));
|
||||
PreprocessorDefines.append(get_cached_string(str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL));
|
||||
PreprocessorDefines.append(get_cached_string(str_ENUM_CLASS_FLAGS));
|
||||
PreprocessorDefines.append(get_cached_string(str_FORCEINLINE_DEBUGGABLE));
|
||||
// PreprocessorDefines.append( get_cached_string(str_FORCEINLINE));
|
||||
PreprocessorDefines.append(get_cached_string(str_GENERATED_BODY));
|
||||
PreprocessorDefines.append(get_cached_string(str_GENERATED_UCLASS_BODY));
|
||||
PreprocessorDefines.append(get_cached_string(str_GENERATED_USTRUCT_BODY));
|
||||
PreprocessorDefines.append(get_cached_string(str_PRAGMA_DISABLE_DEPRECATION_WARNINGS));
|
||||
PreprocessorDefines.append(get_cached_string(str_PRAGMA_ENABLE_DEPRECATION_WARNINGS));
|
||||
PreprocessorDefines.append(get_cached_string(str_PROPERTY_BINDING_IMPLEMENTATION));
|
||||
PreprocessorDefines.append(get_cached_string(str_RESULT_DECL));
|
||||
PreprocessorDefines.append(get_cached_string(str_SLATE_BEGIN_ARGS));
|
||||
PreprocessorDefines.append(get_cached_string(str_SLATE_END_ARGS));
|
||||
PreprocessorDefines.append(get_cached_string(str_TEXT));
|
||||
PreprocessorDefines.append(get_cached_string(str_UCLASS));
|
||||
PreprocessorDefines.append(get_cached_string(str_UENUM));
|
||||
PreprocessorDefines.append(get_cached_string(str_UFUNCTION));
|
||||
PreprocessorDefines.append(get_cached_string(str_UMETA));
|
||||
PreprocessorDefines.append(get_cached_string(str_UPARAM));
|
||||
PreprocessorDefines.append(get_cached_string(str_UPROPERTY));
|
||||
PreprocessorDefines.append(get_cached_string(str_USTRUCT));
|
||||
PreprocessorDefines.append(get_cached_string(str_UE_REQUIRES));
|
||||
}
|
||||
register_macros( args(
|
||||
(Macro { str_DECLARE_CLASS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DELEGATE_RetVal_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DELEGATE_RetVal_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DELEGATE_SixParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_EVENT_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_EVENT_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_FUNCTION, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_LOG_CATEGORY_EXTERN, MT_Statement, MF_Functional | MF_Allow_As_Definition }),
|
||||
(Macro { str_DECLARE_MULTICAST_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_MULTICAST_DELEGATE_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_MULTICAST_DELEGATE_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_TS_MULTICAST_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DEFINE_ACTORDESC_TYPE, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL, MT_Statement, MF_Functional }),
|
||||
(Macro { str_ENUM_CLASS_FLAGS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GENERATED_BODY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GENERATED_UCLASS_BODY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GENERATED_USTRUCT_BODY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_PRAGMA_DISABLE_DEPRECATION_WARNINGS, MT_Statement, MF_Null | MF_Allow_As_Attribute }),
|
||||
(Macro { str_PRAGMA_ENABLE_DEPRECATION_WARNINGS, MT_Statement, MF_Null | MF_Allow_As_Attribute }),
|
||||
(Macro { str_PROPERTY_BINDING_IMPLEMENTATION, MT_Statement, MF_Functional }),
|
||||
(Macro { str_RESULT_DECL, MT_Expression, MF_Functional }),
|
||||
(Macro { str_SLATE_BEGIN_ARGS, MT_Statement, MF_Functional | MF_Expects_Body }),
|
||||
(Macro { str_SLATE_END_ARGS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_TEXT, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UCLASS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UENUM, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UFUNCTION, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UMETA, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UPARAM, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UPROPERTY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_USTRUCT, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UE_REQUIRES, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UE_DEPRECATED, MT_Statement, MF_Functional | MF_Allow_As_Attribute }),
|
||||
(Macro { str_ACTOR_HAS_LABELS, MT_Expression, MF_Null }),
|
||||
(Macro { str_HIDE_ACTOR_TRANSFORM_FUNCTIONS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_SCENECOMPONENT_QUAT_TOLERANCE, MT_Expression, MF_Null }),
|
||||
(Macro { str_SCENECOMPONENT_ROTATOR_TOLERANCE, MT_Expression, MF_Null }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_REPNOTIFY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_PROPERTY_GETTER, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_VALUE_GETTER, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_VALUE_SETTER, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_VALUE_INITTER, MT_Statement, MF_Functional }),
|
||||
(Macro { str_LOCTEXT_NAMESPACE, MT_Statement, MF_Null })
|
||||
));
|
||||
|
||||
// generate_AttributeSets();
|
||||
//generate_DevOptionsCache();
|
||||
//generate_HostWidgetController();
|
||||
change_SBlueprintActionMenu_Construct();
|
||||
change_EditorContentList();
|
||||
// register_macros()
|
||||
|
||||
gen::deinit();
|
||||
generate_AttributeSets();
|
||||
generate_DevOptionsCache();
|
||||
// generate_HostWidgetController();
|
||||
// change_SBlueprintActionMenu_Construct();
|
||||
// change_EditorContentList();
|
||||
|
||||
gen::deinit( & gen_ctx);
|
||||
});
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
|
@ -17,54 +17,65 @@ using namespace gen;
|
||||
#define path_gasa_game path_module_gasa "Game/"
|
||||
#define path_gasa_ui path_module_gasa "UI/"
|
||||
|
||||
constexpr StrC str_DECLARE_CLASS = txt("DECLARE_CLASS(");
|
||||
constexpr StrC str_DECLARE_DELEGATE_RetVal_OneParam = txt("DECLARE_DELEGATE_RetVal_OneParam(");
|
||||
constexpr StrC str_DECLARE_DELEGATE_RetVal_ThreeParams = txt("DECLARE_DELEGATE_RetVal_ThreeParams(");
|
||||
constexpr StrC str_DECLARE_DELEGATE_SixParams = txt("DECLARE_DELEGATE_SixParams(");
|
||||
constexpr StrC str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(");
|
||||
constexpr StrC str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams(");
|
||||
constexpr StrC str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams(");
|
||||
constexpr StrC str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams(");
|
||||
constexpr StrC str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam(");
|
||||
constexpr StrC str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams(");
|
||||
constexpr StrC str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams(");
|
||||
constexpr StrC str_DECLARE_EVENT_ThreeParams = txt("DECLARE_EVENT_ThreeParams(");
|
||||
constexpr StrC str_DECLARE_EVENT_TwoParams = txt("DECLARE_EVENT_TwoParams(");
|
||||
constexpr StrC str_DECLARE_FUNCTION = txt("DECLARE_FUNCTION(");
|
||||
constexpr StrC str_DECLARE_LOG_CATEGORY_EXTERN = txt("DECLARE_LOG_CATEGORY_EXTERN(");
|
||||
constexpr StrC str_DECLARE_MULTICAST_DELEGATE_OneParam = txt("DECLARE_MULTICAST_DELEGATE_OneParam(");
|
||||
constexpr StrC str_DECLARE_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_MULTICAST_DELEGATE_ThreeParams(");
|
||||
constexpr StrC str_DECLARE_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_MULTICAST_DELEGATE_TwoParams(");
|
||||
constexpr StrC str_DECLARE_TS_MULTICAST_DELEGATE_OneParam = txt("DECLARE_TS_MULTICAST_DELEGATE_OneParam(");
|
||||
constexpr StrC str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_TS_MULTICAST_DELEGATE_TwoParams(");
|
||||
constexpr StrC str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_TS_MULTICAST_DELEGATE_ThreeParams(");
|
||||
constexpr StrC str_DEFINE_ACTORDESC_TYPE = txt("DEFINE_ACTORDESC_TYPE(");
|
||||
constexpr StrC str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL = txt("DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(");
|
||||
constexpr StrC str_ENUM_CLASS_FLAGS = txt("ENUM_CLASS_FLAGS(");
|
||||
// constexpr StrC str_FORCEINLINE = txt("FORCEINLINE");
|
||||
constexpr StrC str_FORCEINLINE_DEBUGGABLE = txt("FORCEINLINE_DEBUGGABLE");
|
||||
constexpr StrC str_GENERATED_BODY = txt("GENERATED_BODY(");
|
||||
constexpr StrC str_GENERATED_UCLASS_BODY = txt("GENERATED_UCLASS_BODY(");
|
||||
constexpr StrC str_GENERATED_USTRUCT_BODY = txt("GENERATED_USTRUCT_BODY(");
|
||||
constexpr StrC str_PRAGMA_DISABLE_DEPRECATION_WARNINGS = txt("PRAGMA_DISABLE_DEPRECATION_WARNINGS");
|
||||
constexpr StrC str_PRAGMA_ENABLE_DEPRECATION_WARNINGS = txt("PRAGMA_ENABLE_DEPRECATION_WARNINGS");
|
||||
constexpr StrC str_PROPERTY_BINDING_IMPLEMENTATION = txt("PROPERTY_BINDING_IMPLEMENTATION(");
|
||||
constexpr StrC str_RESULT_DECL = txt("RESULT_DECL");
|
||||
constexpr StrC str_SLATE_BEGIN_ARGS = txt("SLATE_BEGIN_ARGS(");
|
||||
constexpr StrC str_SLATE_END_ARGS = txt("SLATE_END_ARGS(");
|
||||
constexpr StrC str_TEXT = txt("TEXT(");
|
||||
constexpr StrC str_UCLASS = txt("UCLASS(");
|
||||
constexpr StrC str_UENUM = txt("UENUM(");
|
||||
constexpr StrC str_UFUNCTION = txt("UFUNCTION(");
|
||||
constexpr StrC str_UMETA = txt("UMETA(");
|
||||
constexpr StrC str_UPARAM = txt("UPARAM(");
|
||||
constexpr StrC str_UPROPERTY = txt("UPROPERTY(");
|
||||
constexpr StrC str_USTRUCT = txt("USTRUCT(");
|
||||
constexpr StrC str_UE_REQUIRES = txt("UE_REQUIRES(");
|
||||
constexpr Str str_DECLARE_CLASS = txt("DECLARE_CLASS");
|
||||
constexpr Str str_DECLARE_DELEGATE_RetVal_OneParam = txt("DECLARE_DELEGATE_RetVal_OneParam");
|
||||
constexpr Str str_DECLARE_DELEGATE_RetVal_ThreeParams = txt("DECLARE_DELEGATE_RetVal_ThreeParams");
|
||||
constexpr Str str_DECLARE_DELEGATE_SixParams = txt("DECLARE_DELEGATE_SixParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams");
|
||||
constexpr Str str_DECLARE_EVENT_ThreeParams = txt("DECLARE_EVENT_ThreeParams");
|
||||
constexpr Str str_DECLARE_EVENT_TwoParams = txt("DECLARE_EVENT_TwoParams");
|
||||
constexpr Str str_DECLARE_FUNCTION = txt("DECLARE_FUNCTION");
|
||||
constexpr Str str_DECLARE_LOG_CATEGORY_EXTERN = txt("DECLARE_LOG_CATEGORY_EXTERN");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_OneParam = txt("DECLARE_MULTICAST_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_MULTICAST_DELEGATE_ThreeParams");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_MULTICAST_DELEGATE_TwoParams");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_OneParam = txt("DECLARE_TS_MULTICAST_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_TS_MULTICAST_DELEGATE_TwoParams");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_TS_MULTICAST_DELEGATE_ThreeParams");
|
||||
constexpr Str str_DEFINE_ACTORDESC_TYPE = txt("DEFINE_ACTORDESC_TYPE");
|
||||
constexpr Str str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL = txt("DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL");
|
||||
constexpr Str str_ENUM_CLASS_FLAGS = txt("ENUM_CLASS_FLAGS");
|
||||
constexpr Str str_GENERATED_BODY = txt("GENERATED_BODY");
|
||||
constexpr Str str_GENERATED_UCLASS_BODY = txt("GENERATED_UCLASS_BODY");
|
||||
constexpr Str str_GENERATED_USTRUCT_BODY = txt("GENERATED_USTRUCT_BODY");
|
||||
constexpr Str str_PRAGMA_DISABLE_DEPRECATION_WARNINGS = txt("PRAGMA_DISABLE_DEPRECATION_WARNINGS");
|
||||
constexpr Str str_PRAGMA_ENABLE_DEPRECATION_WARNINGS = txt("PRAGMA_ENABLE_DEPRECATION_WARNINGS");
|
||||
constexpr Str str_PROPERTY_BINDING_IMPLEMENTATION = txt("PROPERTY_BINDING_IMPLEMENTATION");
|
||||
constexpr Str str_RESULT_DECL = txt("RESULT_DECL");
|
||||
constexpr Str str_SLATE_BEGIN_ARGS = txt("SLATE_BEGIN_ARGS");
|
||||
constexpr Str str_SLATE_END_ARGS = txt("SLATE_END_ARGS");
|
||||
constexpr Str str_TEXT = txt("TEXT");
|
||||
constexpr Str str_UCLASS = txt("UCLASS");
|
||||
constexpr Str str_UENUM = txt("UENUM");
|
||||
constexpr Str str_UFUNCTION = txt("UFUNCTION");
|
||||
constexpr Str str_UMETA = txt("UMETA");
|
||||
constexpr Str str_UPARAM = txt("UPARAM");
|
||||
constexpr Str str_UPROPERTY = txt("UPROPERTY");
|
||||
constexpr Str str_USTRUCT = txt("USTRUCT");
|
||||
constexpr Str str_UE_REQUIRES = txt("UE_REQUIRES");
|
||||
constexpr Str str_UE_DEPRECATED = txt("UE_DEPRECATED");
|
||||
constexpr Str str_ACTOR_HAS_LABELS = txt("ACTOR_HAS_LABELS");
|
||||
constexpr Str str_HIDE_ACTOR_TRANSFORM_FUNCTIONS = txt("HIDE_ACTOR_TRANSFORM_FUNCTIONS");
|
||||
constexpr Str str_SCENECOMPONENT_QUAT_TOLERANCE = txt("SCENECOMPONENT_QUAT_TOLERANCE");
|
||||
constexpr Str str_SCENECOMPONENT_ROTATOR_TOLERANCE = txt("SCENECOMPONENT_ROTATOR_TOLERANCE");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_REPNOTIFY = txt("GAMEPLAYATTRIBUTE_REPNOTIFY");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_PROPERTY_GETTER = txt("GAMEPLAYATTRIBUTE_PROPERTY_GETTER");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_VALUE_GETTER = txt("GAMEPLAYATTRIBUTE_VALUE_GETTER");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_VALUE_SETTER = txt("GAMEPLAYATTRIBUTE_VALUE_SETTER");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_VALUE_INITTER = txt("GAMEPLAYATTRIBUTE_VALUE_INITTER");
|
||||
constexpr Str str_LOCTEXT_NAMESPACE = txt("LOCTEXT_NAMESPACE");
|
||||
|
||||
constexpr Str str_GASA_API = txt("GASA_API");
|
||||
|
||||
#pragma region Globals
|
||||
extern String Project_Path;
|
||||
extern String Root_Path;
|
||||
extern Str Project_Path;
|
||||
extern Str Root_Path;
|
||||
|
||||
// These Code objects are created before anything else after gencpp does its initializatioon
|
||||
extern Code UHT_GENERATED_BODY;
|
||||
@ -72,24 +83,26 @@ extern Code UHT_UCLASS;
|
||||
extern Code UHT_UPROPERTY;
|
||||
extern Code UHT_USTRUCT;
|
||||
extern Code UModule_GASA_API;
|
||||
|
||||
extern Context gen_ctx;
|
||||
#pragma endregion Globals
|
||||
|
||||
inline
|
||||
CodeBody parse_file( char const* path ) {
|
||||
String
|
||||
resolved_path = String::make(GlobalAllocator, StrC(Project_Path));
|
||||
StrBuilder
|
||||
resolved_path = StrBuilder::make(gen_ctx.Allocator_Temp, Project_Path);
|
||||
resolved_path.append(path);
|
||||
|
||||
FileContents content = file_read_contents( GlobalAllocator, true, resolved_path );
|
||||
CodeBody code = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
FileContents content = file_read_contents( gen_ctx.Allocator_Temp, true, resolved_path );
|
||||
CodeBody code = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
return code;
|
||||
}
|
||||
|
||||
// Automatically handles resolving project path
|
||||
inline
|
||||
Builder builder_open(char const* path) {
|
||||
String
|
||||
resolved_path = String::make(GlobalAllocator, StrC(Project_Path));
|
||||
Builder gasa_builder_open(char const* path) {
|
||||
StrBuilder
|
||||
resolved_path = StrBuilder::make(gen_ctx.Allocator_Temp, Project_Path);
|
||||
resolved_path.append(path);
|
||||
return Builder::open( resolved_path );
|
||||
}
|
||||
@ -100,13 +113,13 @@ Builder builder_open(char const* path) {
|
||||
inline
|
||||
void format_file( char const* path, bool relative_path = true )
|
||||
{
|
||||
String
|
||||
resolved_path = String::make_reserve(GlobalAllocator, Project_Path.length());
|
||||
StrBuilder
|
||||
resolved_path = StrBuilder::make_reserve(gen_ctx.Allocator_Temp, Project_Path.Len);
|
||||
if (relative_path)
|
||||
resolved_path.append(StrC(Project_Path));
|
||||
resolved_path.append(Project_Path);
|
||||
resolved_path.append(path);
|
||||
|
||||
String style_arg = String::make(GlobalAllocator, txt("-style=file:"));
|
||||
StrBuilder style_arg = StrBuilder::make(gen_ctx.Allocator_Temp, txt("-style=file:"));
|
||||
style_arg.append(Root_Path);
|
||||
style_arg.append("/scripts/.clang-format ");
|
||||
|
||||
@ -114,7 +127,7 @@ void format_file( char const* path, bool relative_path = true )
|
||||
#define clang_format "clang-format "
|
||||
#define cf_format_inplace "-i "
|
||||
#define cf_verbose "-verbose "
|
||||
String command = String::make( GlobalAllocator, clang_format );
|
||||
StrBuilder command = StrBuilder::make( gen_ctx.Allocator_Temp, clang_format );
|
||||
command.append( cf_format_inplace );
|
||||
command.append( cf_verbose );
|
||||
command.append( style_arg );
|
||||
@ -129,19 +142,19 @@ void format_file( char const* path, bool relative_path = true )
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
String to_string( FString ue_string ) {
|
||||
Str to_string( FString ue_string ) {
|
||||
char const* ansi_str = TCHAR_TO_ANSI(*ue_string);
|
||||
return String::make_length(GlobalAllocator, ansi_str, ue_string.Len());
|
||||
return StrBuilder::make_length(gen_ctx.Allocator_Temp, ansi_str, ue_string.Len()).to_str();
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
String to_string( FName ue_fname ) {
|
||||
Str to_string( FName ue_fname ) {
|
||||
char const* ansi_str = TCHAR_TO_ANSI(*ue_fname.ToString());
|
||||
return String::make_length(GlobalAllocator, ansi_str, ue_fname.GetStringLength());
|
||||
return StrBuilder::make_length(gen_ctx.Allocator_Temp, ansi_str, ue_fname.GetStringLength()).to_str();
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
FString to_fstring( String string )
|
||||
FString to_fstring( Str string )
|
||||
{
|
||||
return FString::ConstructFromPtrSize( string.Data, string.length() );
|
||||
return FString::ConstructFromPtrSize( string.Ptr, string.Len );
|
||||
}
|
||||
|
@ -1,44 +1,59 @@
|
||||
## Navigation
|
||||
|
||||
[Top](../Readme.md)
|
||||
|
||||
<- [docs - General](Readme.md)
|
||||
|
||||
## Current Design
|
||||
|
||||
`AST` is the actual managed node object for the library.
|
||||
Its raw and really not meant to be used directly.
|
||||
|
||||
All user interaction must be with its pointer so the type they deal with is `AST*`.
|
||||
For user-facing code, they should never be giveen a nullptr. Instead, they should be given a designated `Invalid` AST node.
|
||||
In order to abstract away constant use of `AST*` its wrapped in a Code type which can be either:
|
||||
|
||||
In order to abstract away constant use of `AST*`, I wanted to provide a wrapper for it.
|
||||
|
||||
The simpliest being just a type alias.
|
||||
|
||||
```cpp
|
||||
using Code = AST*;
|
||||
When its the [C generated variant of the library](../gen_c_library/)
|
||||
```c
|
||||
typedef AST* Code;
|
||||
tyepdef AST_<name>* Code<name>;
|
||||
...
|
||||
```
|
||||
|
||||
This is what the genc library would have to use due to its constraints of a langauge.
|
||||
The actual content per type of AST is covered within [AST_Types.md](AST_Types.md).
|
||||
|
||||
These are pure PODS that just have the lay members relevant to the type of AST node they represent.
|
||||
Each of them has a Code type alias specific to it.
|
||||
|
||||
Again, the simpliest case for these would be a type alias.
|
||||
**or**
|
||||
|
||||
For C++:
|
||||
```cpp
|
||||
using struct AST_Typedef CodeTypedef;
|
||||
struct Code {
|
||||
AST* ast;
|
||||
};
|
||||
struct Code<name> {
|
||||
...
|
||||
|
||||
AST_<name>* ast;
|
||||
};
|
||||
```
|
||||
|
||||
As of November 21st, 2023, the AST has had a strict layout for how its content is laid out.
|
||||
This will be abandoned during its redesign that will occur starting with support for statments & expressions for either execution and type declarations.
|
||||
Having a strict layout is too resctrictive vs allowing each AST type to have maximum control over the layout.
|
||||
The full definitions of all asts are within:
|
||||
|
||||
The redesign will occur after the following todos are addressed:
|
||||
* [`ast.hpp`](../base/components/ast.hpp)
|
||||
* [`ast_types.hpp`](../base/components/ast_types.hpp)
|
||||
* [`code_types.hpp`](../base/components/code_types.hpp)
|
||||
|
||||
* [Improvements Lexer & Token struct#27](https://github.com/Ed94/gencpp/issues/27)
|
||||
* [Generalize AST Flags to a single 4-byte flag#42](https://github.com/Ed94/gencpp/issues/42)
|
||||
* [AST-Code Object Redesign.#38](https://github.com/Ed94/gencpp/issues/38)
|
||||
* [Code-AST Documentation#40](https://github.com/Ed94/gencpp/issues/40)
|
||||
* [AST::debug_str() improvements#33](https://github.com/Ed94/gencpp/issues/33)
|
||||
* [AST::is_equal implemented and works with singleheader-test#31](https://github.com/Ed94/gencpp/issues/31)
|
||||
* [Parser : Add ability to have a parse failure and continue with errors recorded.#35](https://github.com/Ed94/gencpp/issues/35)
|
||||
* [Scanner : Add CodeFile#29](https://github.com/Ed94/gencpp/issues/29)
|
||||
* [Auxiliary : AST visual debugger#36](https://github.com/Ed94/gencpp/issues/36)
|
||||
The C/C++ interface procedures are located with `ast.hpp` (for the Code type), and `code_types.hpp` for all others.
|
||||
|
||||
## Serialization
|
||||
|
||||
All code types can either serialize using a function of the pattern:
|
||||
|
||||
```c
|
||||
StrBuilder <prefix>_to_strbuilder(Code code);
|
||||
// or
|
||||
<prefix>_to_strbuilder(Code code, StrBuilder& result);
|
||||
```
|
||||
|
||||
Where the first generates strings allocated using Allocator_StringArena and the other appends an existing strings with their backed allocator.
|
||||
|
||||
Serialization of for the AST is defined for `Code` in [`ast.cpp`](../base/components/ast.cpp) with `code_to_strbuilder_ptr` & `code_to_strbuilder`.
|
||||
Serializtion for the rest of the code types is within [`code_serialization.cpp`](../base/components/code_serialization.cpp).
|
||||
|
||||
Gencpp's serialization does not provide coherent formatting of the code. The user should use a formatter after serializing.
|
||||
|
@ -1,10 +1,16 @@
|
||||
## Navigation
|
||||
|
||||
[Top](../Readme.md)
|
||||
|
||||
<- [docs - General](Readme.md)
|
||||
|
||||
# AST Types Documentation
|
||||
|
||||
While the Readme for docs covers the data layout per AST, this will focus on the AST types avaialble, and their nuances.
|
||||
|
||||
## Body
|
||||
|
||||
These are containers representing a scope body of a definition that can be of the following `ECode` type:
|
||||
These are containers representing a scope body of a definition that can be of the following `CodeType` type:
|
||||
|
||||
* Class_Body
|
||||
* Enum_Body
|
||||
@ -19,26 +25,27 @@ These are containers representing a scope body of a definition that can be of th
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
Code Front;
|
||||
Code Back;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
s32 NumEntries;
|
||||
StrCached Name;
|
||||
Code Front;
|
||||
Code Back;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
s32 NumEntries;
|
||||
```
|
||||
|
||||
The `Front` member represents the start of the link list and `Back` the end.
|
||||
NumEntries is the number of entries in the body.
|
||||
|
||||
Parent should have a compatible ECode type for the type of defintion used.
|
||||
Parent should have a compatible CodeType type for the type of defintion used.
|
||||
|
||||
Serialization:
|
||||
|
||||
Will output only the entries, the braces are handled by the parent.
|
||||
|
||||
```cpp
|
||||
<Front>...
|
||||
<Front>
|
||||
...
|
||||
<Back>
|
||||
```
|
||||
|
||||
@ -49,13 +56,13 @@ Represent standard or vendor specific C/C++ attributes.
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StringCached Content;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -73,13 +80,13 @@ Stores a comment.
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StringCached Content;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -102,12 +109,12 @@ CodeComment InlineCmt; // Only supported by forward declarations
|
||||
CodeAttributes Attributes;
|
||||
CodeType ParentType;
|
||||
CodeBody Body;
|
||||
CodeType Prev; // Used to store references to interfaces
|
||||
CodeType Next; // Used to store references to interfaces
|
||||
parser::Token* Tok;
|
||||
StrCached Name;
|
||||
CodeType Prev;
|
||||
CodeType Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
AccessSpec ParentAccess;
|
||||
```
|
||||
@ -125,23 +132,23 @@ Serialization:
|
||||
};
|
||||
```
|
||||
|
||||
You'll notice that only one parent type is supported only with parent access. This library only supports single inheritance, the rest must be done through interfaces.
|
||||
You'll notice that only one parent type is supported only with parent access. This library only supports single inheritance, the rest are assumed to be interfaces and are given public acess specifiers.
|
||||
|
||||
## Constructor
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt; // Only supported by forward declarations
|
||||
Code InitializerList;
|
||||
CodeParam Params;
|
||||
Code Body;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeComment InlineCmt; // Only supported by forward declarations
|
||||
Code InitializerList;
|
||||
CodeParams Params;
|
||||
Code Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -171,13 +178,14 @@ Represents a preprocessor define
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StringCached Content;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeDefineParams Params;
|
||||
Code Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -186,6 +194,28 @@ Serialization:
|
||||
#define <Name> <Content>
|
||||
```
|
||||
|
||||
## DefineParams
|
||||
|
||||
Preprocessor define's parameters.
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Name;
|
||||
Code Last;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
s32 NumEntries;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<Name>, <Next> ...
|
||||
```
|
||||
|
||||
## Destructor
|
||||
|
||||
Fields:
|
||||
@ -194,12 +224,12 @@ Fields:
|
||||
CodeComment InlineCmt;
|
||||
CodeSpecifiers Specs;
|
||||
Code Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -229,24 +259,28 @@ Fields:
|
||||
CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeType UnderlyingType;
|
||||
Code UnderlyingTypeMacro;
|
||||
CodeBody Body;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Name;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
UnderlyingTypeMacro is a macro the library natively supports: `enum_underlying(type)` that is meant to behave as a wrapper for underlying type assignment.
|
||||
The `enum_underlying_sig` is a `Str` global var that can be set which will be defined within `PreprocessorDefines` and used in `parser_parse_enum` to identify a valid macro.
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Enum_Fwd
|
||||
<ModuleFlags> enum class <Name> : <UnderlyingType>; <InlineCmt>
|
||||
<ModuleFlags> enum class <Name> : <UnderlyingType> or <UnderlyingTypeMacro> ; <InlineCmt>
|
||||
|
||||
// Enum
|
||||
<ModuleFlags> <enum or enum class> <Name> : <UnderlyingType>
|
||||
<ModuleFlags> <enum or enum class> <Name> : <UnderlyingType> or <UnderlyingTypeMacro>
|
||||
{
|
||||
<Body>
|
||||
};
|
||||
@ -260,13 +294,13 @@ Will be obsolute when function body parsing is implemented.
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StringCached Content;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -275,18 +309,18 @@ Serialization:
|
||||
<Content>
|
||||
```
|
||||
|
||||
## External Linkage
|
||||
## External Linkage (Extern)
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeBody Body;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -303,13 +337,13 @@ extern "<Name>"
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StringCached Content;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Code Parent;
|
||||
parser::Token* Tok;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Code Parent;
|
||||
Token* Tok;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -325,14 +359,14 @@ This library (until its necessary become some third-party library to do otherwis
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
Code Declaration;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeComment InlineCmt;
|
||||
Code Declaration;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -350,14 +384,14 @@ CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeSpecifiers Specs;
|
||||
CodeType ReturnType;
|
||||
CodeParam Params;
|
||||
CodeParams Params;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
@ -379,13 +413,13 @@ Serialization:
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -399,14 +433,14 @@ Serialization:
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeBody Body;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -418,7 +452,7 @@ Serialization:
|
||||
}
|
||||
```
|
||||
|
||||
## Operator Overload
|
||||
## Operator Overload (Operator)
|
||||
|
||||
Fields:
|
||||
|
||||
@ -427,14 +461,14 @@ CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeSpecifiers Specs;
|
||||
CodeType ReturnType;
|
||||
CodeParam Params;
|
||||
CodeParams Params;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
OperatorT Op;
|
||||
```
|
||||
@ -452,7 +486,7 @@ Serialization:
|
||||
}
|
||||
```
|
||||
|
||||
## Operator Cast Overload ( User-Defined Type Conversion )
|
||||
## Operator Cast Overload ( User-Defined Type Conversion, OpCast )
|
||||
|
||||
Fields:
|
||||
|
||||
@ -461,12 +495,12 @@ CodeComment InlineCmt;
|
||||
CodeSpecifiers Specs;
|
||||
CodeType ValueType;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -482,21 +516,22 @@ Serialization:
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters (AST_Param)
|
||||
## Parameters (AST_Params)
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeType ValueType;
|
||||
Code Macro;
|
||||
Code Value;
|
||||
CodeParam Last;
|
||||
CodeParam Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
s32 NumEntries;
|
||||
CodeType ValueType;
|
||||
Code Macro;
|
||||
Code Value;
|
||||
Code PostNameMacro;
|
||||
StrCached Name;
|
||||
CodeParams Last;
|
||||
CodeParams Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
s32 NumEntries;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -504,7 +539,7 @@ Serialization:
|
||||
```cpp
|
||||
<Macro>, <Next> ... <Last>
|
||||
|
||||
<Macro> <ValueType> <Name>, <Next>... <Last>
|
||||
<Macro> <ValueType> <Name> <PostNameMacro> = <Value>, <Next>... <Last>
|
||||
```
|
||||
|
||||
## Pragma
|
||||
@ -512,13 +547,13 @@ Serialization:
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StringCached Content;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -532,13 +567,13 @@ Serialization:
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StringCached Content;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
paser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -552,14 +587,14 @@ Serialization:
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
SpecifierT ArrSpecs[ AST::ArrSpecs_Cap ];
|
||||
SpecifierT ArrSpecs[ AST_ArrSpecs_Cap ];
|
||||
CodeSpecifiers NextSpecs;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
s32 NumEntries;
|
||||
```
|
||||
|
||||
@ -574,15 +609,15 @@ Serialization:
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeParam Params;
|
||||
Code Declaration;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
CodeParams Params;
|
||||
Code Declaration;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -603,23 +638,30 @@ Fields:
|
||||
CodeAttributes Attributes;
|
||||
CodeSpecifiers Specs;
|
||||
CodeReturnType ReturnType;
|
||||
CodeParam Params;
|
||||
CodeParams Params;
|
||||
Code ArrExpr;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
StrCached Name;
|
||||
CodeType Type;
|
||||
b32 IsParamPack;
|
||||
ETypenameTag TypeTag;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<Attributes> <Name> <Specs> <IsParamPack ?: ...>
|
||||
<Attributes> <TypeTag> <Name> <Specs> <IsParamPack ?: ...>
|
||||
// Function
|
||||
<Attributes> <ReturnType> <Name> <Params> <Specs>
|
||||
```
|
||||
|
||||
`<Name>` currently has the full serialization of anything with
|
||||
|
||||
*Note: ArrExpr is not used in serialization by `typename_to_strbuilder_ref` its instead handled by a parent AST's serailization (variable, typedef, using).*
|
||||
|
||||
## Typedef
|
||||
|
||||
Behave as usual except function or macro typedefs.
|
||||
@ -628,27 +670,32 @@ Those (macros) don't use the underlying type field as everything was serialized
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
Code UnderlyingType;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parse::Token* Tok
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
b32 IsFunction;
|
||||
CodeComment InlineCmt;
|
||||
Code UnderlyingType;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
b32 IsFunction;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Regular
|
||||
<ModuleFlags> typedef <UnderlyingType> <Name>; <InlineCmt>
|
||||
<ModuleFlags> typedef <UnderlyingType> <Name> <UnderlyingType-ArrExpr>; <InlineCmt>
|
||||
|
||||
// Functions
|
||||
<ModuleFlags> typedef <ReturnType> <Name>( <Parameters> ); <InlineCmt>
|
||||
<ModuleFlags> typedef <ReturnType> ( <Expression that yeilds an Identifier signature> )( <Parameters> ); <InlineCmt>
|
||||
|
||||
// Currently:
|
||||
<ModuleFlags> typedef <UnderlyingType (Serialized expression)>; <InlineCmt>
|
||||
|
||||
// Desired: Not handled yet
|
||||
<ModuleFlags> typedef <UnderlyingType->ReturnType> UnderlyingType->Name> <UnderlyingType-ArrExpr> ( <UnderlyingType->Parameters> ); <InlineCmt>
|
||||
<ModuleFlags> typedef <UnderlyingType->ReturnType> ( <Name->Namespace> for<Specs->has(Spec_Ptr) ?: *> <UnderlyingType->Name> <UnderlyingType-ArrExpr> ) ( <UnderlyingType->Parameters> ); <InlineCmt>
|
||||
```
|
||||
|
||||
## Union
|
||||
@ -658,12 +705,12 @@ Fields:
|
||||
```cpp
|
||||
CodeAttributes Attributes;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
@ -684,12 +731,12 @@ Fields:
|
||||
CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeType UnderlyingType;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
@ -716,14 +763,15 @@ CodeSpecifiers Specs;
|
||||
CodeType ValueType;
|
||||
Code BitfieldSize;
|
||||
Code Value;
|
||||
StrCached Name;
|
||||
CodeVar NextVar;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
parser::Token* Tok;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
s32 VarParenthesizedInit;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
@ -734,4 +782,7 @@ Serialization:
|
||||
|
||||
// Bitfield
|
||||
<ModuleFlags> <Attributes> <Specs> <ValueType> <Name> : <BitfieldSize> = <Value>, NextVar ...; <InlineCmt>
|
||||
|
||||
// VarParenthesizedInit
|
||||
<Attributes> <Specs> <ValueType> <Name>( <Value>, NextVar ... ); <InlineCmt>
|
||||
```
|
||||
|
@ -26,3 +26,19 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Source URL: https://github.com/Ed94/gencpp
|
||||
|
||||
Acknowledgements
|
||||
|
||||
* The dependencies for gencpp source are derived from the zpl library: https://github.com/zpl-c/zpl
|
||||
|
||||
Special thanks to:
|
||||
|
||||
* The Handmade Community.
|
||||
|
||||
* Casey Muratori, Ginger Bill (Bill Hall), Mr. 4th (Allen Webster), Ryan Fluery: Influnced conceptually how to handle staged metaprograming.
|
||||
|
||||
* Jonathan Blow: Jai's metaprogramming influenced the design of this library.
|
||||
|
||||
* My friends for putting up with discord spam on this library.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,33 +1,40 @@
|
||||
## Navigation
|
||||
|
||||
[Top](../Readme.md)
|
||||
|
||||
<- [docs - General](Readme.md)
|
||||
|
||||
# Parsing
|
||||
|
||||
The library features a naive parser tailored for only what the library needs to construct the supported syntax of C++ into its AST.
|
||||
The library features a naive single-pass parser, tailored for only what the library needs; for construction of C++ code into gencpp's AST for *"front-end"* meta-programming purposes.
|
||||
|
||||
This parser does not, and should not do the compiler's job. By only supporting this minimal set of features, the parser is kept (so far) around ~5600 loc. I hope to keep it under 10k loc worst case.
|
||||
This parser does not, and should not do the compiler's job. By only supporting this minimal set of features, the parser is kept (so far) around ~7000 loc. I hope to keep it under 10-15k loc worst case.
|
||||
|
||||
You can think of this parser of a frontend parser vs a semantic parser. Its intuitively similar to WYSIWYG. What you precerive as the syntax from the user-side before the compiler gets a hold of it, is what you get.
|
||||
You can think of this parser as *frontend parser* vs a *semantic parser*. Its intuitively similar to WYSIWYG. What you ***precerive*** as the syntax from the user-side before the compiler gets a hold of it, is what you get.
|
||||
|
||||
User exposed interface:
|
||||
|
||||
```cpp
|
||||
CodeClass parse_class ( StrC class_def );
|
||||
CodeConstructor parse_constructor ( StrC constructor_def );
|
||||
CodeDestructor parse_destructor ( StrC destructor_def );
|
||||
CodeEnum parse_enum ( StrC enum_def );
|
||||
CodeBody parse_export_body ( StrC export_def );
|
||||
CodeExtern parse_extern_link ( StrC exten_link_def );
|
||||
CodeFriend parse_friend ( StrC friend_def );
|
||||
CodeFn parse_function ( StrC fn_def );
|
||||
CodeBody parse_global_body ( StrC body_def );
|
||||
CodeNS parse_namespace ( StrC namespace_def );
|
||||
CodeOperator parse_operator ( StrC operator_def );
|
||||
CodeOpCast parse_operator_cast( StrC operator_def );
|
||||
CodeStruct parse_struct ( StrC struct_def );
|
||||
CodeTemplate parse_template ( StrC template_def );
|
||||
CodeType parse_type ( StrC type_def );
|
||||
CodeTypedef parse_typedef ( StrC typedef_def );
|
||||
CodeUnion parse_union ( StrC union_def );
|
||||
CodeUsing parse_using ( StrC using_def );
|
||||
CodeVar parse_variable ( StrC var_def );
|
||||
CodeClass parse_class ( Str class_def );
|
||||
CodeConstructor parse_constructor ( Str constructor_def );
|
||||
CodeDefine parse_define ( Str define_def );
|
||||
CodeDestructor parse_destructor ( Str destructor_def );
|
||||
CodeEnum parse_enum ( Str enum_def );
|
||||
CodeBody parse_export_body ( Str export_def );
|
||||
CodeExtern parse_extern_link ( Str exten_link_def );
|
||||
CodeFriend parse_friend ( Str friend_def );
|
||||
CodeFn parse_function ( Str fn_def );
|
||||
CodeBody parse_global_body ( Str body_def );
|
||||
CodeNS parse_namespace ( Str namespace_def );
|
||||
CodeOperator parse_operator ( Str operator_def );
|
||||
CodeOpCast parse_operator_cast( Str operator_def );
|
||||
CodeStruct parse_struct ( Str struct_def );
|
||||
CodeTemplate parse_template ( Str template_def );
|
||||
CodeType parse_type ( Str type_def );
|
||||
CodeTypedef parse_typedef ( Str typedef_def );
|
||||
CodeUnion parse_union ( Str union_def );
|
||||
CodeUsing parse_using ( Str using_def );
|
||||
CodeVar parse_variable ( Str var_def );
|
||||
```
|
||||
|
||||
To parse file buffers, use the `parse_global_body` function.
|
||||
@ -47,35 +54,106 @@ The keywords supported for the preprocessor are:
|
||||
* endif
|
||||
* pragma
|
||||
|
||||
Each directive `#` line is considered one preproecessor unit, and will be treated as one Preprocessor AST. *These ASTs will be considered members or entries of braced scope they reside within*.
|
||||
Each directive `#` line is considered one preproecessor unit, and will be treated as one Preprocessor AST node.
|
||||
If a directive is used with an unsupported keyword its will be processed as an untyped AST.
|
||||
|
||||
The preprocessor lines are stored as members of their associated scope they are parsed within. ( Global, Namespace, Class/Struct )
|
||||
The preprocessor lines are stored as members of their associated scope they are parsed within ( Global, Namespace, Class/Struct ).
|
||||
***Again: These ASTs will be considered members or entries of braced scope they reside within***
|
||||
|
||||
Any preprocessor definition abuse that changes the syntax of the core language is unsupported and will fail to parse if not kept within an execution scope (function body, or expression assignment).
|
||||
Exceptions:
|
||||
|
||||
* function signatures are allowed for a preprocessed macro: `neverinline MACRO() { ... }`
|
||||
* varaible definitions are allowed for a preprocessed macro `extern MACRO();`
|
||||
* function definitions are allowed for a preprocessed macro: `neverinline MACRO() { ... }`
|
||||
* Disable with: `#define GEN_PARSER_DISABLE_MACRO_FUNCTION_SIGNATURES`
|
||||
* typedefs allow for a preprocessed macro: `typedef MACRO();`
|
||||
* Disable with: `#define GEN_PARSER_DISABLE_MACRO_TYPEDEF`
|
||||
* Macros can behave as typenames
|
||||
* There is some macro support in parameters for functions or templates *(Specifically added to support parsing Unreal Engine source)*.
|
||||
|
||||
*(Exceptions are added on an on-demand basis)*
|
||||
*(See functions `parse_operator_function_or_variable` and `parse_typedef` )*
|
||||
|
||||
Adding your own exceptions is possible by simply modifying the parser to allow for the syntax you need.
|
||||
|
||||
*Note: You could interpret this strictness as a feature. This would allow the user to see if their codebase or a third-party's codebase some some egregious preprocessor abuse.*
|
||||
*Note: You could interpret this strictness as a feature. This would allow the user to see if their codebase or a third-party's codebase contains some egregious preprocessor abuse.*
|
||||
|
||||
The lexing and parsing takes shortcuts from whats expected in the standard.
|
||||
Macros used within a file should be registered by the user before parsing. This can be done two ways:
|
||||
|
||||
1. The register macro interface within [interface.hpp](../base/components/interface.hpp).
|
||||
2. Using `def_define` to create a CodeDefine and making sure to not set `opts.dont_register_to_preprocess_macros` to `true`.
|
||||
|
||||
## Registering macros
|
||||
|
||||
While the registeration of macros in the meta-program's side for parsing can be considered tedius, its necessary for the parser to accurately resolve the macros intent in one pass (and it provides some hygenics by verifying that they are used as intended).
|
||||
|
||||
The following can be used to register a macro:
|
||||
|
||||
```c
|
||||
GEN_API void register_macro( Macro macro );
|
||||
GEN_API void register_macros( s32 num, ... );
|
||||
GEN_API void register_macros_arr( s32 num, Macro* macros );
|
||||
```
|
||||
|
||||
The Macro typename is defined with the following in [parser_types.hpp](../base/components/parser_types.hpp):
|
||||
|
||||
```c
|
||||
struct Macro
|
||||
{
|
||||
StrCached Name;
|
||||
MacroType Type;
|
||||
MacroFlags Flags;
|
||||
};
|
||||
```
|
||||
|
||||
The macro can be designated one of the following types:
|
||||
|
||||
* `MT_Expression`: Intended to resolve to an expression expansion.
|
||||
* `MT_Statement`: Intended to resolve an statement expansion.
|
||||
* `MT_Typename`: Intended to resolve to a typename.
|
||||
|
||||
Additioonally tthe following flags may be set:
|
||||
|
||||
* `MF_Functional`: The macro intended to be passed arguments are at least have the calling `()` as part of its usage.
|
||||
* `MF_Expects_Body`: The parser should expect a braced-body `{ ... }` after the macro signature `<name> <params>`
|
||||
* `MF_Allow_As_Identifier`: Will allow the macro to be an acceptable token/s when an `Tok_Identifier` is expected.
|
||||
* `MF_Allow_As_Attribute`: Will allow the macro to be an acceptable token/s when an attribute token/s is expected.
|
||||
* `MF_Allow_As_Definition`: Will allow the macro be an acceptable token/s when the parser expects a declartion or definition to resolve after attributes or specifiers have been identified beforehand.
|
||||
* This flag requires that the macro is of type `MT_Statement` to make any sense of usage.
|
||||
|
||||
If a macro is not defined the following warning will be issued if `GEN_BUILD_DEBUG=1` during lexing within [lexer.cpp](../base/components/lexer.cpp) - `lex_preprocessor_define`:
|
||||
|
||||
```c
|
||||
log_fmt("Warning: '%S' was not registered before the lexer processed its #define directive, it will be registered as a expression macro\n"
|
||||
, name.Text
|
||||
);
|
||||
```
|
||||
|
||||
Further within the same scope, the lexer will issue a warning if it detects a macro was not flagged as function but has an open parenthesis `(` token right after is name with no whitespace:
|
||||
|
||||
```c
|
||||
log_fmt("Warning: %S registered macro is not flagged as functional yet the definition detects opening parenthesis '(' for arguments\n"
|
||||
, name.Text
|
||||
);
|
||||
```
|
||||
|
||||
Macros are tracked using a `MacroTable Macros;` defined as a member of the library's `Context`.
|
||||
|
||||
```c
|
||||
typedef HashTable(Macro) MacroTable;
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
* Empty lines used throughout the file are preserved for formatting purposes during ast serialization (they have a dedicated Token: `Tok_NewLine`).
|
||||
* Numeric literals are not checked for validity.
|
||||
* The parse API treats any execution scope definitions with no validation and are turned into untyped Code ASTs.
|
||||
* The parse API treats any execution scope definitions with no validation and are turned into untyped Code ASTs. (There is a [todo](https://github.com/Ed94/gencpp/issues/49) to add support)
|
||||
* *This includes the assignment of variables.*
|
||||
* Attributes ( `[[]]` (standard), `__declspec` (Microsoft), or `__attribute__` (GNU) )
|
||||
* Assumed to *come before specifiers* (`const`, `constexpr`, `extern`, `static`, etc) for a function or right afterthe return type.
|
||||
* Or in the usual spot for class, structs, (*right after the declaration keyword*)
|
||||
* typedefs have attributes with the type (`parse_type`)
|
||||
* Parsing attributes can be extended to support user defined macros by defining `GEN_DEFINE_ATTRIBUTE_TOKENS` (see `gen.hpp` for the formatting)
|
||||
* This is useful for example: parsing Unreal `Module_API` macros.
|
||||
|
||||
Empty lines used throughout the file are preserved for formatting purposes during ast serialization.
|
||||
**The lexer & parser do not gracefully attempt to continue when it comes across incorrect code, and doesn't properly track errors into a listing (yet).**
|
||||
|
@ -1,137 +1,34 @@
|
||||
# gencpp
|
||||
## Navigation
|
||||
|
||||
An attempt at simple staged metaprogramming for c/c++.
|
||||
# base
|
||||
|
||||
The library API is a composition of code element constructors.
|
||||
These build up a code AST to then serialize with a file builder.
|
||||
[Top](../Readme.md)
|
||||
|
||||
This code base attempts follow the [handmade philosophy](https://handmade.network/manifesto).
|
||||
Its not meant to be a black box metaprogramming utility, it should be easy to intergrate into a user's project domain.
|
||||
* [docs](../docs/Readme.md)
|
||||
|
||||
## Notes
|
||||
# Unreal Engine Version Generator
|
||||
|
||||
**On Partial Hiatus: Life has got me tackling other issues..**
|
||||
I will be passively updating the library with bug fixes and minor improvements as I use it for my personal projects.
|
||||
There won't be any major reworks or features to this thing for a while.
|
||||
This generates a variant of gencpp thats compatiable with use as a thirdparty module within a plugin or module of an Unreal Project or the Engine itself.
|
||||
|
||||
This project is still in development (very much an alpha state), so expect bugs and missing features.
|
||||
See [issues](https://github.com/Ed94/gencpp/issues) for a list of known bugs or todos.
|
||||
|
||||
The library can already be used to generate code just fine, but the parser is where the most work is needed. If your C++ isn't "down to earth" expect issues.
|
||||
|
||||
A `natvis` and `natstepfilter` are provided in the scripts directory (its outdated, I'll update this readme when its not).
|
||||
|
||||
***The editor and scanner have not been implemented yet. The scanner will come first, then the editor.***
|
||||
|
||||
A C variant is hosted [here](https://github.com/Ed94/genc); I will complete it when this library is feature complete, it should be easier to make than this...
|
||||
|
||||
## Usage
|
||||
|
||||
A metaprogram is built to generate files before the main program is built. We'll term runtime for this program as `GEN_TIME`. The metaprogram's core implementation are within `gen.hpp` and `gen.cpp` in the project directory.
|
||||
|
||||
`gen.cpp` \`s `main()` is defined as `gen_main()` which the user will have to define once for their program. There they will dictate everything that should be generated.
|
||||
|
||||
In order to keep the locality of this code within the same files the following pattern may be used (although this pattern isn't required at all):
|
||||
|
||||
Within `program.cpp` :
|
||||
|
||||
```cpp
|
||||
#ifdef GEN_TIME
|
||||
#include "gen.hpp"
|
||||
|
||||
...
|
||||
|
||||
u32 gen_main()
|
||||
{
|
||||
...
|
||||
}
|
||||
#endif
|
||||
|
||||
// "Stage" agnostic code.
|
||||
|
||||
#ifndef GEN_TIME
|
||||
#include "program.gen.cpp"
|
||||
|
||||
// Regular runtime dependent on the generated code here.
|
||||
#endif
|
||||
If using the library's provided build scripts:
|
||||
|
||||
```ps1
|
||||
.\build.ps1 <compiler> <debug or omit> unreal
|
||||
```
|
||||
|
||||
The design uses a constructive builder API for the code to generate.
|
||||
The user is provided `Code` objects that are used to build up the AST.
|
||||
## Notables
|
||||
|
||||
Example using each construction interface:
|
||||
For the most part this follows the same conventions as `gen_segmented`.
|
||||
|
||||
### Upfront
|
||||
This generator uses a separate enumeration definitions for the following:
|
||||
|
||||
Validation and construction through a functional interface.
|
||||
* [AttributeTokens.csv](./enums/AttributeTokens.csv) : Add your own <MODULE>_API attributes, etc here that are encountered within the Engine.
|
||||
* [ESpecifier.csv](./enums/ESpecifier.csv) : Adds the `FORCEINLINE` & `FORCEINLINE_DEBUGGABLE` specfiers (additions are made as they are encountered)
|
||||
* [ETokType.csv](./enums/ETokType.csv) : Same modifications as ESpecifier.csv.
|
||||
|
||||
```cpp
|
||||
Code t_uw = def_type( name(usize) );
|
||||
Code t_allocator = def_type( name(allocator) );
|
||||
Code t_string_const = def_type( name(char), def_specifiers( args( ESpecifier::Const, ESpecifier::Ptr ) ));
|
||||
A separate [parser_case_macros.cpp](./components/parser_case_macros.cpp) is used to accomodate for the new forceinline specifiers.
|
||||
|
||||
Code header;
|
||||
{
|
||||
Code num = def_variable( t_uw, name(Num) );
|
||||
Code cap = def_variable( t_uw, name(Capacity) );
|
||||
Code mem_alloc = def_variable( t_allocator, name(Allocator) );
|
||||
Code body = def_struct_body( args( num, cap, mem_alloc ) );
|
||||
The `global` macro the library uses is redefined as an empty substiution.
|
||||
|
||||
header = def_struct( name(ArrayHeader), __, __, body );
|
||||
}
|
||||
```
|
||||
|
||||
### Parse
|
||||
|
||||
Validation through ast construction.
|
||||
|
||||
```cpp
|
||||
Code header = parse_struct( code(
|
||||
struct ArrayHeader
|
||||
{
|
||||
usize Num;
|
||||
usize Capacity;
|
||||
allocator Allocator;
|
||||
};
|
||||
));
|
||||
|
||||
```
|
||||
|
||||
### Untyped
|
||||
|
||||
No validation, just glorified text injection.
|
||||
|
||||
```cpp
|
||||
Code header = code_str(
|
||||
struct ArrayHeader
|
||||
{
|
||||
usize Num;
|
||||
usize Capacity;
|
||||
allocator Allocator;
|
||||
};
|
||||
);
|
||||
```
|
||||
|
||||
`name` is a helper macro for providing a string literal with its size, intended for the name parameter of functions.
|
||||
`code` is a helper macro for providing a string literal with its size, but intended for code string parameters.
|
||||
`args` is a helper macro for providing the number of arguments to varadic constructors.
|
||||
`code_str` is a helper macro for writting `untyped_str( code( <content> ))`
|
||||
|
||||
All three constrcuton interfaces will generate the following C code:
|
||||
|
||||
```cpp
|
||||
struct ArrayHeader
|
||||
{
|
||||
usize Num;
|
||||
usize Capacity;
|
||||
allocator Allocator;
|
||||
};
|
||||
```
|
||||
|
||||
**Note: The formatting shown here is not how it will look. For your desired formatting its recommended to run a pass through the files with an auto-formatter.**
|
||||
*(The library currently uses clang-format for formatting, beware its pretty slow...)*
|
||||
|
||||
## Building
|
||||
|
||||
See the [scripts directory](scripts/).
|
||||
The expected usage of this library is to put into into a third-party plugin module to then use either in editor modules or in shell script done in some stage of hot-reloading or building the Unreal Engine or Project.
|
||||
|
@ -1,196 +1,129 @@
|
||||
## Documentation
|
||||
# General Docs
|
||||
|
||||
The project has no external dependencies beyond:
|
||||
[Top](../Readme.md)
|
||||
|
||||
* `errno.h`
|
||||
* `stat.h`
|
||||
* `stdarg.h`
|
||||
* `stddef.h`
|
||||
* `stdio.h`
|
||||
* `copyfile.h` (Mac)
|
||||
* `types.h` (Linux)
|
||||
* `unistd.h` (Linux/Mac)
|
||||
* `intrin.h` (Windows)
|
||||
* `io.h` (Windows with gcc)
|
||||
* `windows.h` (Windows)
|
||||
Contains:
|
||||
|
||||
Dependencies for the project are wrapped within `GENCPP_ROLL_OWN_DEPENDENCIES` (Defining it will disable them).
|
||||
The majority of the dependency's implementation was derived from the [c-zpl library](https://github.com/zpl-c/zpl).
|
||||
* [AST_Design](./AST_Design.md): Overview of ASTs
|
||||
* [AST Types](./AST_Types.md): Listing of all AST types along with their Code type interface.
|
||||
* [Parsing](./Parsing.md): Overview of the parsing interface.
|
||||
* [Parser Algo](./Parser_Algo.md): In-depth breakdown of the parser's implementation.
|
||||
|
||||
This library was written in a subset of C++ where the following are not used at all:
|
||||
|
||||
* RAII (Constructors/Destructors), lifetimes are managed using named static or regular functions.
|
||||
* Language provide dynamic dispatch, RTTI
|
||||
* Object-Oriented Inheritance
|
||||
* Exceptions
|
||||
|
||||
Polymorphic & Member-functions are used as an ergonomic choice, along with a conserative use of operator overloads.
|
||||
There are only 4 template definitions in the entire library. (`Array<Type>`, `Hashtable<Type>`, `swap<Type>`, and `AST/Code::cast<Type>`)
|
||||
|
||||
Two generic templated containers are used throughout the library:
|
||||
|
||||
* `template< class Type> struct Array`
|
||||
* `template< class Type> struct HashTable`
|
||||
|
||||
Both Code and AST definitions have a `template< class Type> Code/AST :: cast()`. Its just an alternative way to explicitly cast to each other.
|
||||
|
||||
`template< class Type> swap( Type& a, Type& b)` is used over a macro.
|
||||
|
||||
Otherwise the library is free of any templates.
|
||||
|
||||
### *WHAT IS NOT PROVIDED*
|
||||
### *CURRENTLY UNSUPPORTED*
|
||||
|
||||
**There is no support for validating expressions.**
|
||||
Its difficult to parse without enough benefits (At the metaprogramming level).
|
||||
I plan to add this only at the tail of the project parsing milestone.
|
||||
Its a [todo](https://github.com/Ed94/gencpp/issues/49)
|
||||
|
||||
**Only trivial template support is provided.**
|
||||
The intention is for only simple, non-recursive substitution.
|
||||
The parameters of the template are treated like regular parameter AST entries.
|
||||
**Only trivial template support is provided.**
|
||||
The intention is for only simple, non-recursive substitution.
|
||||
The parameters of the template are treated like regular parameter AST entries.
|
||||
This means that the typename entry for the parameter AST would be either:
|
||||
|
||||
* `class`
|
||||
* `typename`
|
||||
* A fundamental type, function, or pointer type.
|
||||
|
||||
Anything beyond this usage is not supported by parse_template for arguments (at least not intentionally).
|
||||
Use at your own mental peril.
|
||||
***Concepts and Constraints are not supported***
|
||||
Its a [todo](https://github.com/Ed94/gencpp/issues/21)
|
||||
|
||||
*Concepts and Constraints are not supported, its usage is non-trivial substitution.*
|
||||
### Feature Macros
|
||||
|
||||
* `GEN_DEFINE_ATTRIBUTE_TOKENS` : Allows user to define their own attribute macros for use in parsing.
|
||||
* This can be generated using base.cpp.
|
||||
* `GEN_DEFINE_LIBRARY_CORE_CONSTANTS` : Optional typename codes as they are non-standard to C/C++ and not necessary to library usage
|
||||
* `GEN_DONT_ENFORCE_GEN_TIME_GUARD` : By default, the library ( gen.hpp/ gen.cpp ) expects the macro `GEN_TIME` to be defined, this disables that.
|
||||
* `GEN_ENFORCE_STRONG_CODE_TYPES` : Enforces casts to filtered code types.
|
||||
* `GEN_EXPOSE_BACKEND` : Will expose symbols meant for internal use only.
|
||||
* `GEN_ROLL_OWN_DEPENDENCIES` : Optional override so that user may define the dependencies themselves.
|
||||
* `GEN_DONT_ALLOW_INVALID_CODE` (Not implemented yet) : Will fail when an invalid code is constructed, parsed, or serialized.
|
||||
* `GEN_C_LIKE_CPP` : Setting to `<true or 1>` Will prevent usage of function defnitions using references and structs with member functions. Structs will still have user-defined operator conversions, for-range support, and other operator overloads
|
||||
|
||||
### The Data & Interface
|
||||
|
||||
The library's persistent state is managed tracked by a context struct: `global Context* _ctx;` defined within [static_data.cpp](../base/components/static_data.cpp)
|
||||
|
||||
https://github.com/Ed94/gencpp/blob/967a044637f1615c709cb723dc61118fcc08dcdb/base/components/interface.hpp#L39-L97
|
||||
|
||||
The interface for the context:
|
||||
|
||||
* `init`: Initializtion
|
||||
* `deinit`: De-initialization.
|
||||
* `reset`: Clears the allocations, but doesn't free the memoery, then calls `init()` on `_ctx` again.
|
||||
* `get_context`: Retreive the currently tracked context.
|
||||
* `set_context`: Swap out the current tracked context.
|
||||
|
||||
|
||||
#### Allocato usage
|
||||
|
||||
* `Allocator_DyanmicContainers`: Growing arrays, hash tables. (Unbounded sized containers)
|
||||
* `Allocator_Pool`: Fixed-sized object allocations (ASTs, etc)
|
||||
* `Allocator_StrCache`: StrCached allocations
|
||||
* `Allocator_Temp`: Temporary alloations mostly intended for StrBuilder usage. Manually cleared by the user by their own discretion.
|
||||
|
||||
The allocator definitions used are exposed to the user incase they want to dictate memory usage
|
||||
|
||||
* Allocators are defined with the `AllocatorInfo` structure found in [`memory.hpp`](../base/dependencies/memory.hpp)
|
||||
* Most of the work is just defining the allocation procedure:
|
||||
|
||||
```cpp
|
||||
void* ( void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags );
|
||||
```
|
||||
|
||||
For any allocator above that the user does not define before `init`, a fallback allocator will be assigned that utiizes the `fallback_allocator_proc` wtihin [interface.cpp](../base/components/interface.cpp).
|
||||
|
||||
As mentioned in root readme, the user is provided Code objects by calling the constructor's functions to generate them or find existing matches.
|
||||
|
||||
The AST is managed by the library and provided to the user via its interface.
|
||||
However, the user may specifiy memory configuration.
|
||||
|
||||
Data layout of AST struct (Subject to heavily change with upcoming redesign):
|
||||
[Data layout of AST struct (Subject to heavily change with upcoming todos)](../base/components/ast.hpp#L396-461)
|
||||
|
||||
```cpp
|
||||
union {
|
||||
struct
|
||||
{
|
||||
AST* InlineCmt; // Class, Constructor, Destructor, Enum, Friend, Functon, Operator, OpCast, Struct, Typedef, Using, Variable
|
||||
AST* Attributes; // Class, Enum, Function, Struct, Typedef, Union, Using, Variable
|
||||
AST* Specs; // Destructor, Function, Operator, Typename, Variable
|
||||
union {
|
||||
AST* InitializerList; // Constructor
|
||||
AST* ParentType; // Class, Struct, ParentType->Next has a possible list of interfaces.
|
||||
AST* ReturnType; // Function, Operator, Typename
|
||||
AST* UnderlyingType; // Enum, Typedef
|
||||
AST* ValueType; // Parameter, Variable
|
||||
};
|
||||
union {
|
||||
AST* Macro; // Parameters
|
||||
AST* BitfieldSize; // Variable (Class/Struct Data Member)
|
||||
AST* Params; // Constructor, Function, Operator, Template, Typename
|
||||
};
|
||||
union {
|
||||
AST* ArrExpr; // Typename
|
||||
AST* Body; // Class, Constructr, Destructor, Enum, Function, Namespace, Struct, Union
|
||||
AST* Declaration; // Friend, Template
|
||||
AST* Value; // Parameter, Variable
|
||||
};
|
||||
union {
|
||||
AST* NextVar; // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = NextVar->Value )
|
||||
AST* SpecsFuncSuffix; // Only used with typenames, to store the function suffix if typename is function signature.
|
||||
};
|
||||
};
|
||||
StringCached Content; // Attributes, Comment, Execution, Include
|
||||
struct {
|
||||
SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
|
||||
AST* NextSpecs; // Specifiers
|
||||
};
|
||||
};
|
||||
union {
|
||||
AST* Prev;
|
||||
AST* Front;
|
||||
AST* Last;
|
||||
};
|
||||
union {
|
||||
AST* Next;
|
||||
AST* Back;
|
||||
};
|
||||
AST* Parent;
|
||||
StringCached Name;
|
||||
CodeT Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
union {
|
||||
b32 IsFunction; // Used by typedef to not serialize the name field.
|
||||
b32 IsParamPack; // Used by typename to know if type should be considered a parameter pack.
|
||||
OperatorT Op;
|
||||
AccessSpec ParentAccess;
|
||||
s32 NumEntries;
|
||||
};
|
||||
s32 Token; // Handle to the token, stored in the CodeFile (Otherwise unretrivable)
|
||||
```
|
||||
https://github.com/Ed94/gencpp/blob/967a044637f1615c709cb723dc61118fcc08dcdb/base/components/ast.hpp#L369-L435
|
||||
|
||||
*`CodeT` is a typedef for `ECode::Type` which has an underlying type of `u32`*
|
||||
*`StringCahced` is a typedef for `Str` (a string slice), to denote it is an interned string*
|
||||
*`CodeType` is enum taggin the type of code. Has an underlying type of `u32`*
|
||||
*`OperatorT` is a typedef for `EOperator::Type` which has an underlying type of `u32`*
|
||||
*`StringCahced` is a typedef for `String const`, to denote it is an interned string*
|
||||
*`String` is the dynamically allocated string type for the library*
|
||||
*`StrBuilder` is the dynamically allocating string builder type for the library*
|
||||
|
||||
AST widths are setup to be AST_POD_Size.
|
||||
AST widths are setup to be AST_POD_Size (128 bytes by default).
|
||||
The width dictates how much the static array can hold before it must give way to using an allocated array:
|
||||
|
||||
```cpp
|
||||
constexpr static
|
||||
usize ArrSpecs_Cap =
|
||||
int AST_ArrSpecs_Cap =
|
||||
(
|
||||
AST_POD_Size
|
||||
- sizeof(AST*) * 3
|
||||
- sizeof(StringCached)
|
||||
- sizeof(CodeT)
|
||||
- sizeof(Code)
|
||||
- sizeof(StrCached)
|
||||
- sizeof(Code) * 2
|
||||
- sizeof(Token*)
|
||||
- sizeof(Code)
|
||||
- sizeof(CodeType)
|
||||
- sizeof(ModuleFlag)
|
||||
- sizeof(u32)
|
||||
)
|
||||
/ sizeof(SpecifierT) -1; // -1 for 4 extra bytes (Odd num of AST*)
|
||||
/ sizeof(Specifier) - 1;
|
||||
```
|
||||
|
||||
*Ex: If the AST_POD_Size is 128 the capacity of the static array is 20.*
|
||||
|
||||
Data Notes:
|
||||
|
||||
* The allocator definitions used are exposed to the user incase they want to dictate memory usage
|
||||
* You'll find the memory handling in `init`, `deinit`, `reset`, `gen_string_allocator`, `get_cached_string`, `make_code`.
|
||||
* Allocators are defined with the `AllocatorInfo` structure found in `dependencies\memory.hpp`
|
||||
* Most of the work is just defining the allocation procedure:
|
||||
|
||||
```cpp
|
||||
void* ( void* allocator_data, AllocType type, ssize size, ssize alignment, void* old_memory, ssize old_size, u64 flags );
|
||||
```
|
||||
|
||||
* ASTs are wrapped for the user in a Code struct which is a wrapper for a AST* type.
|
||||
* Both AST and Code have member symbols but their data layout is enforced to be POD types.
|
||||
* Code types have member symbols but their data layout is enforced to be POD types.
|
||||
* This library treats memory failures as fatal.
|
||||
* Cached Strings are stored in their own set of arenas. AST constructors use cached strings for names, and content.
|
||||
* `StringArenas`, `StringCache`, `Allocator_StringArena`, and `Allocator_StringTable` are the associated containers or allocators.
|
||||
* Strings used for serialization and file buffers are not contained by those used for cached strings.
|
||||
* They are currently using `GlobalAllocator`, which are tracked array of arenas that grows as needed (adds buckets when one runs out).
|
||||
* Memory within the buckets is not reused, so its inherently wasteful.
|
||||
* I will be augmenting the single arena with a simple slag allocator.
|
||||
* Linked lists used children nodes on bodies, and parameters.
|
||||
* `_ctx->Allocator_Temp` is used.
|
||||
* Its intended to generate the AST in one go and serialize after. The constructors and serializer are designed to be a "one pass, front to back" setup.
|
||||
* Allocations can be tuned by defining the folloiwng macros:
|
||||
* `GEN_GLOBAL_BUCKET_SIZE` : Size of each bucket area for the global allocator
|
||||
* `GEN_CODEPOOL_NUM_BLOCKS` : Number of blocks per code pool in the code allocator
|
||||
* `GEN_SIZE_PER_STRING_ARENA` : Size per arena used with string caching.
|
||||
* `GEN_MAX_COMMENT_LINE_LENGTH` : Longest length a comment can have per line.
|
||||
* `GEN_MAX_NAME_LENGTH` : Max length of any identifier.
|
||||
* `GEN_MAX_UNTYPED_STR_LENGTH` : Max content length for any untyped code.
|
||||
* `GEN_TOKEN_FMT_TOKEN_MAP_MEM_SIZE` : token_fmt_va uses local_persit memory of this size for the hashtable.
|
||||
* `GEN_LEX_ALLOCATOR_SIZE`
|
||||
* `GEN_BUILDER_STR_BUFFER_RESERVE`
|
||||
* Any modifcations to an existing AST should be to just construct another with the modifications done on-demand while traversing the AST (non-destructive).
|
||||
|
||||
The following CodeTypes are used which the user may optionally use strong typing with if they enable: `GEN_ENFORCE_STRONG_CODE_TYPES`
|
||||
|
||||
* CodeBody : Has support for `for-range` iterating across Code objects.
|
||||
* CodeBody : Has support for `for : range` iterating across Code objects.
|
||||
* CodeAttributes
|
||||
* CodeComment
|
||||
* CodeClass
|
||||
* CodeConstructor
|
||||
* CodeDefine
|
||||
* CodeDefineParams
|
||||
* CodeDestructor
|
||||
* CodeEnum
|
||||
* CodeExec
|
||||
@ -201,24 +134,28 @@ The following CodeTypes are used which the user may optionally use strong typing
|
||||
* CodeModule
|
||||
* CodeNS
|
||||
* CodeOperator
|
||||
* CodeOpCast
|
||||
* CodeParam : Has support for `for-range` iterating across parameters.
|
||||
* CodeOpCast : User defined member operator conversion
|
||||
* CodeParams : Has support for `for : range` iterating across parameters.
|
||||
* CodePreprocessCond
|
||||
* CodePragma
|
||||
* CodeSpecifiers : Has support for `for-range` iterating across specifiers.
|
||||
* CodeSpecifiers : Has support for `for : range` iterating across specifiers.
|
||||
* CodeStruct
|
||||
* CodeTemplate
|
||||
* CodeType
|
||||
* CodeTypename
|
||||
* CodeTypedef
|
||||
* CodeUnion
|
||||
* CodeUsing
|
||||
* CodeVar
|
||||
|
||||
Each Code boy has an associated "filtered AST" with the naming convention: `AST_<CodeName>`
|
||||
Each `struct Code<Name>` has an associated "filtered AST" with the naming convention: `AST_<CodeName>`
|
||||
Unrelated fields of the AST for that node type are omitted and only necessary padding members are defined otherwise.
|
||||
Retrieving a raw version of the ast can be done using the `raw()` function defined in each AST.
|
||||
|
||||
## There are three sets of interfaces for Code AST generation the library provides
|
||||
For the interface related to these code types see:
|
||||
|
||||
* [ast.hpp](../base/components/ast.hpp): Under the region pragma `Code C-Interface`
|
||||
* [code_types.hpp](../base/components/code_types.hpp): Under the region pragma `Code C-Interface`. Additional functionlity for c++ will be within the struct definitions or at the end of the file.
|
||||
|
||||
## There are three categories of interfaces for Code AST generation & reflection
|
||||
|
||||
* Upfront
|
||||
* Parsing
|
||||
@ -238,6 +175,7 @@ Interface :``
|
||||
* def_class
|
||||
* def_constructor
|
||||
* def_define
|
||||
* def_define_params
|
||||
* def_destructor
|
||||
* def_enum
|
||||
* def_execution
|
||||
@ -292,7 +230,29 @@ Code <name>
|
||||
|
||||
```
|
||||
|
||||
All optional parmeters are defined within `struct Opts_def_<functon name>`. This was done to setup a [macro trick](https://x.com/vkrajacic/status/1749816169736073295) for default optional parameers in the C library:
|
||||
|
||||
```cpp
|
||||
struct gen_Opts_def_struct
|
||||
{
|
||||
gen_CodeBody body;
|
||||
gen_CodeTypename parent;
|
||||
gen_AccessSpec parent_access;
|
||||
gen_CodeAttributes attributes;
|
||||
gen_CodeTypename* interfaces;
|
||||
gen_s32 num_interfaces;
|
||||
gen_ModuleFlag mflags;
|
||||
};
|
||||
typedef struct gen_Opts_def_struct gen_Opts_def_struct;
|
||||
|
||||
GEN_API gen_CodeClass gen_def__struct( gen_Str name, gen_Opts_def_struct opts GEN_PARAM_DEFAULT );
|
||||
#define gen_def_struct( name, ... ) gen_def__struct( name, ( gen_Opts_def_struct ) { __VA_ARGS__ } )
|
||||
```
|
||||
|
||||
In the C++ library, the `def_<funtion name>` is not wrapped in a macro.
|
||||
|
||||
When using the body functions, its recommended to use the args macro to auto determine the number of arguments for the varadic:
|
||||
|
||||
```cpp
|
||||
def_global_body( args( ht_entry, array_ht_entry, hashtable ));
|
||||
|
||||
@ -300,8 +260,8 @@ def_global_body( args( ht_entry, array_ht_entry, hashtable ));
|
||||
def_global_body( 3, ht_entry, array_ht_entry, hashtable );
|
||||
```
|
||||
|
||||
If a more incremental approach is desired for the body ASTs, `Code def_body( CodeT type )` can be used to create an empty body.
|
||||
When the members have been populated use: `AST::validate_body` to verify that the members are valid entires for that type.
|
||||
If a more incremental approach is desired for the body ASTs, `Code def_body( CodeT type )` can be used to create an empty body.
|
||||
When the members have been populated use: `code_validate_body` to verify that the members are valid entires for that type.
|
||||
|
||||
### Parse construction
|
||||
|
||||
@ -311,12 +271,12 @@ Interface :
|
||||
|
||||
* parse_class
|
||||
* parse_constructor
|
||||
* parse_define
|
||||
* parse_destructor
|
||||
* parse_enum
|
||||
* parse_export_body
|
||||
* parse_extern_link
|
||||
* parse_friend
|
||||
* Purposefully are only support forward declares with this constructor.
|
||||
* parse_function
|
||||
* parse_global_body
|
||||
* parse_namespace
|
||||
@ -352,7 +312,7 @@ Interface :
|
||||
* untyped_fmt
|
||||
* untyped_token_fmt
|
||||
|
||||
During serialization any untyped Code AST has its string value directly injected inline of whatever context the content existed as an entry within.
|
||||
During serialization any untyped Code AST has its string value directly injected inline of whatever context the content existed as an entry within.
|
||||
Even though these are not validated from somewhat correct c/c++ syntax or components, it doesn't mean that Untyped code can be added as any component of a Code AST:
|
||||
|
||||
* Untyped code cannot have children, thus there cannot be recursive injection this way.
|
||||
@ -373,6 +333,7 @@ Code <name> = untyped_str( code(
|
||||
```
|
||||
|
||||
Optionally, `code_str`, and `code_fmt` macros can be used so that the code macro doesn't have to be used:
|
||||
|
||||
```cpp
|
||||
Code <name> = code_str( <some code without "" quotes > )
|
||||
```
|
||||
@ -380,7 +341,7 @@ Code <name> = code_str( <some code without "" quotes > )
|
||||
Template metaprogramming in the traditional sense becomes possible with the use of `token_fmt` and parse constructors:
|
||||
|
||||
```cpp
|
||||
StrC value = txt("Something");
|
||||
Str value = txt("Something");
|
||||
|
||||
char const* template_str = txt(
|
||||
Code with <key> to replace with token_values
|
||||
@ -394,6 +355,7 @@ Code <name> = parse_<function name>( gen_code_str );
|
||||
|
||||
The following are provided predefined by the library as they are commonly used:
|
||||
|
||||
* `enum_underlying_macro`
|
||||
* `access_public`
|
||||
* `access_protected`
|
||||
* `access_private`
|
||||
@ -402,8 +364,8 @@ The following are provided predefined by the library as they are commonly used:
|
||||
* `module_global_fragment`
|
||||
* `module_private_fragment`
|
||||
* `fmt_newline`
|
||||
* `param_varaidc` (Used for varadic definitions)
|
||||
* `pragma_once`
|
||||
* `param_varaidc` (Used for varadic definitions)
|
||||
* `preprocess_else`
|
||||
* `preprocess_endif`
|
||||
* `spec_const`
|
||||
@ -419,6 +381,7 @@ The following are provided predefined by the library as they are commonly used:
|
||||
* `spec_local_persist` (local_persist macro)
|
||||
* `spec_mutable`
|
||||
* `spec_neverinline`
|
||||
* `spec_noexcept`
|
||||
* `spec_override`
|
||||
* `spec_ptr`
|
||||
* `spec_pure`
|
||||
@ -450,8 +413,8 @@ Optionally the following may be defined if `GEN_DEFINE_LIBRARY_CODE_CONSTANTS` i
|
||||
* `t_u16`
|
||||
* `t_u32`
|
||||
* `t_u64`
|
||||
* `t_sw` (ssize_t)
|
||||
* `t_uw` (size_t)
|
||||
* `t_ssize` (ssize_t)
|
||||
* `t_usize` (size_t)
|
||||
* `t_f32`
|
||||
* `t_f64`
|
||||
|
||||
@ -469,15 +432,12 @@ and have the desired specifiers assigned to them beforehand.
|
||||
|
||||
## Code generation and modification
|
||||
|
||||
There are three provided auxillary interfaces:
|
||||
There are two provided auxillary interfaces:
|
||||
|
||||
* Builder
|
||||
* Editor
|
||||
* Scanner
|
||||
|
||||
Editor and Scanner are disabled by default, use `GEN_FEATURE_EDITOR` and `GEN_FEATURE_SCANNER` to enable them.
|
||||
|
||||
### Builder is a similar object to the jai language's string_builder
|
||||
### Builder is a similar object to the jai language's strbuilder_builder
|
||||
|
||||
* The purpose of it is to generate a file.
|
||||
* A file is specified and opened for writing using the open( file_path) function.
|
||||
@ -486,4 +446,8 @@ Editor and Scanner are disabled by default, use `GEN_FEATURE_EDITOR` and `GEN_FE
|
||||
|
||||
### Scanner Auxillary Interface
|
||||
|
||||
Provides *(eventually)* `scan_file` to automatically populate a CodeFile which contains a parsed AST (`Code`) of the file, with any contextual failures that are reported from the parser.
|
||||
* The purpose is to scan or parse files
|
||||
* Some with two basic functions to convert a fil to code: `scan_file` and `parse_file`
|
||||
* `scan_file`: Merely grabs the file and stores it in an untyped Code.
|
||||
* `parse_file`: Will parse the file using `parse_global_body` and return a `CodeBody`.
|
||||
* Two basic functions for grabbing columns from a CSV: `parse_csv_one_column` and `parse_csv_two_columns`
|
||||
|
@ -9,6 +9,9 @@
|
||||
# pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma clang diagnostic ignored "-Wvarargs"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic ignored "-Wbraced-scalar-init"
|
||||
# pragma clang diagnostic ignored "-W#pragma-messages"
|
||||
# pragma clang diagnostic ignored "-Wstatic-in-inline"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
@ -23,7 +26,9 @@
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
Builder Builder::open( char const* path )
|
||||
#pragma region Builder
|
||||
|
||||
Builder builder_open( char const* path )
|
||||
{
|
||||
Builder result;
|
||||
|
||||
@ -34,51 +39,51 @@ Builder Builder::open( char const* path )
|
||||
return result;
|
||||
}
|
||||
|
||||
result.Buffer = String::make_reserve( GlobalAllocator, Builder_StrBufferReserve );
|
||||
Context* ctx = get_context();
|
||||
GEN_ASSERT_NOT_NULL(ctx);
|
||||
result.Buffer = strbuilder_make_reserve( ctx->Allocator_Temp, ctx->InitSize_BuilderBuffer );
|
||||
|
||||
// log_fmt("$Builder - Opened file: %s\n", result.File.filename );
|
||||
return result;
|
||||
}
|
||||
|
||||
void Builder::pad_lines( s32 num )
|
||||
void builder_pad_lines( Builder* builder, s32 num )
|
||||
{
|
||||
Buffer.append( "\n" );
|
||||
strbuilder_append_str( & builder->Buffer, txt("\n") );
|
||||
}
|
||||
|
||||
void Builder::print( Code code )
|
||||
void builder_print( Builder* builder, Code code )
|
||||
{
|
||||
String str = code->to_string();
|
||||
StrBuilder str = code_to_strbuilder(code);
|
||||
// const ssize len = str.length();
|
||||
// log_fmt( "%s - print: %.*s\n", File.filename, len > 80 ? 80 : len, str.Data );
|
||||
Buffer.append( str );
|
||||
strbuilder_append_string( & builder->Buffer, str );
|
||||
}
|
||||
|
||||
void Builder::print_fmt( char const* fmt, ... )
|
||||
void builder_print_fmt_va( Builder* builder, char const* fmt, va_list va )
|
||||
{
|
||||
ssize res;
|
||||
char buf[ GEN_PRINTF_MAXLEN ] = { 0 };
|
||||
|
||||
va_list va;
|
||||
va_start( va, fmt );
|
||||
res = str_fmt_va( buf, count_of( buf ) - 1, fmt, va ) - 1;
|
||||
va_end( va );
|
||||
res = c_str_fmt_va( buf, count_of( buf ) - 1, fmt, va ) - 1;
|
||||
|
||||
// log_fmt( "$%s - print_fmt: %.*s\n", File.filename, res > 80 ? 80 : res, buf );
|
||||
Buffer.append( buf, res );
|
||||
strbuilder_append_c_str_len( (StrBuilder*) & (builder->Buffer), (char const*)buf, res);
|
||||
}
|
||||
|
||||
void Builder::write()
|
||||
void builder_write(Builder* builder)
|
||||
{
|
||||
b32 result = file_write( & File, Buffer, Buffer.length() );
|
||||
b32 result = file_write( & builder->File, builder->Buffer, strbuilder_length(builder->Buffer) );
|
||||
|
||||
if ( result == false )
|
||||
log_failure("gen::File::write - Failed to write to file: %s\n", file_name( & File ) );
|
||||
log_failure("gen::File::write - Failed to write to file: %s\n", file_name( & builder->File ) );
|
||||
|
||||
log_fmt( "Generated: %s\n", File.filename );
|
||||
file_close( & File );
|
||||
Buffer.free();
|
||||
log_fmt( "Generated: %s\n", builder->File.filename );
|
||||
file_close( & builder->File );
|
||||
strbuilder_free(& builder->Buffer);
|
||||
}
|
||||
|
||||
#pragma endregion Builder
|
||||
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
|
@ -9,6 +9,9 @@
|
||||
# pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma clang diagnostic ignored "-Wvarargs"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic ignored "-Wbraced-scalar-init"
|
||||
# pragma clang diagnostic ignored "-W#pragma-messages"
|
||||
# pragma clang diagnostic ignored "-Wstatic-in-inline"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
@ -25,21 +28,60 @@
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
#pragma region Builder
|
||||
|
||||
struct Builder;
|
||||
typedef struct Builder Builder;
|
||||
|
||||
Builder builder_open ( char const* path );
|
||||
void builder_pad_lines ( Builder* builder, s32 num );
|
||||
void builder_print ( Builder* builder, Code code );
|
||||
void builder_print_fmt_va( Builder* builder, char const* fmt, va_list va );
|
||||
void builder_write ( Builder* builder );
|
||||
|
||||
FORCEINLINE void builder_print_fmt ( Builder* builder, char const* fmt, ... ) {
|
||||
va_list va;
|
||||
va_start( va, fmt );
|
||||
builder_print_fmt_va( builder, fmt, va );
|
||||
va_end( va );
|
||||
}
|
||||
|
||||
struct Builder
|
||||
{
|
||||
FileInfo File;
|
||||
String Buffer;
|
||||
StrBuilder Buffer;
|
||||
|
||||
static Builder open( char const* path );
|
||||
#if GEN_COMPILER_CPP && ! GEN_C_LIKE_CPP
|
||||
FORCEINLINE static Builder open( char const* path ) { return builder_open(path); }
|
||||
|
||||
void pad_lines( s32 num );
|
||||
FORCEINLINE void pad_lines( s32 num ) { return builder_pad_lines(this, num); }
|
||||
|
||||
void print( Code );
|
||||
void print_fmt( char const* fmt, ... );
|
||||
FORCEINLINE void print( Code code ) { return builder_print(this, code); }
|
||||
FORCEINLINE void print_fmt( char const* fmt, ... ) {
|
||||
va_list va;
|
||||
va_start( va, fmt );
|
||||
builder_print_fmt_va( this, fmt, va );
|
||||
va_end( va );
|
||||
}
|
||||
|
||||
void write();
|
||||
FORCEINLINE void write() { return builder_write(this); }
|
||||
#endif
|
||||
};
|
||||
|
||||
#if GEN_COMPILER_CPP && ! GEN_C_LIKE_CPP
|
||||
FORCEINLINE void builder_pad_lines( Builder& builder, s32 num ) { return builder_pad_lines(& builder, num); }
|
||||
FORCEINLINE void builder_print ( Builder& builder, Code code ) { return builder_print(& builder, code); }
|
||||
FORCEINLINE void builder_write ( Builder& builder ) { return builder_write(& builder ); }
|
||||
FORCEINLINE void builder_print_fmt( Builder& builder, char const* fmt, ...) {
|
||||
va_list va;
|
||||
va_start( va, fmt );
|
||||
builder_print_fmt_va( & builder, fmt, va );
|
||||
va_end( va );
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma endregion Builder
|
||||
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,9 @@
|
||||
# pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma clang diagnostic ignored "-Wvarargs"
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic ignored "-Wbraced-scalar-init"
|
||||
# pragma clang diagnostic ignored "-W#pragma-messages"
|
||||
# pragma clang diagnostic ignored "-Wstatic-in-inline"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
@ -25,590 +28,36 @@
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
#pragma region ADT
|
||||
|
||||
enum ADT_Type : u32
|
||||
{
|
||||
EADT_TYPE_UNINITIALISED, /* node was not initialised, this is a programming error! */
|
||||
EADT_TYPE_ARRAY,
|
||||
EADT_TYPE_OBJECT,
|
||||
EADT_TYPE_STRING,
|
||||
EADT_TYPE_MULTISTRING,
|
||||
EADT_TYPE_INTEGER,
|
||||
EADT_TYPE_REAL,
|
||||
};
|
||||
|
||||
enum ADT_Props : u32
|
||||
{
|
||||
EADT_PROPS_NONE,
|
||||
EADT_PROPS_NAN,
|
||||
EADT_PROPS_NAN_NEG,
|
||||
EADT_PROPS_INFINITY,
|
||||
EADT_PROPS_INFINITY_NEG,
|
||||
EADT_PROPS_FALSE,
|
||||
EADT_PROPS_TRUE,
|
||||
EADT_PROPS_NULL,
|
||||
EADT_PROPS_IS_EXP,
|
||||
EADT_PROPS_IS_HEX,
|
||||
|
||||
// Used internally so that people can fill in real numbers they plan to write.
|
||||
EADT_PROPS_IS_PARSED_REAL,
|
||||
};
|
||||
|
||||
enum ADT_NamingStyle : u32
|
||||
{
|
||||
EADT_NAME_STYLE_DOUBLE_QUOTE,
|
||||
EADT_NAME_STYLE_SINGLE_QUOTE,
|
||||
EADT_NAME_STYLE_NO_QUOTES,
|
||||
};
|
||||
|
||||
enum ADT_AssignStyle : u32
|
||||
{
|
||||
EADT_ASSIGN_STYLE_COLON,
|
||||
EADT_ASSIGN_STYLE_EQUALS,
|
||||
EADT_ASSIGN_STYLE_LINE,
|
||||
};
|
||||
|
||||
enum ADT_DelimStyle : u32
|
||||
{
|
||||
EADT_DELIM_STYLE_COMMA,
|
||||
EADT_DELIM_STYLE_LINE,
|
||||
EADT_DELIM_STYLE_NEWLINE,
|
||||
};
|
||||
|
||||
enum ADT_Error : u32
|
||||
{
|
||||
EADT_ERROR_NONE,
|
||||
EADT_ERROR_INTERNAL,
|
||||
EADT_ERROR_ALREADY_CONVERTED,
|
||||
EADT_ERROR_INVALID_TYPE,
|
||||
EADT_ERROR_OUT_OF_MEMORY,
|
||||
};
|
||||
|
||||
struct ADT_Node
|
||||
{
|
||||
char const* name;
|
||||
struct ADT_Node* parent;
|
||||
|
||||
/* properties */
|
||||
ADT_Type type : 4;
|
||||
u8 props : 4;
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
u8 cfg_mode : 1;
|
||||
u8 name_style : 2;
|
||||
u8 assign_style : 2;
|
||||
u8 delim_style : 2;
|
||||
u8 delim_line_width : 4;
|
||||
u8 assign_line_width : 4;
|
||||
#endif
|
||||
|
||||
/* adt data */
|
||||
union
|
||||
{
|
||||
char const* string;
|
||||
Array<ADT_Node> nodes; ///< zpl_array
|
||||
|
||||
struct
|
||||
{
|
||||
union
|
||||
{
|
||||
f64 real;
|
||||
s64 integer;
|
||||
};
|
||||
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
/* number analysis */
|
||||
s32 base;
|
||||
s32 base2;
|
||||
u8 base2_offset : 4;
|
||||
s8 exp : 4;
|
||||
u8 neg_zero : 1;
|
||||
u8 lead_digit : 1;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/* ADT NODE LIMITS
|
||||
* delimiter and assignment segment width is limited to 128 whitespace symbols each.
|
||||
* real number limits decimal position to 128 places.
|
||||
* real number exponent is limited to 64 digits.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialise an ADT object or array
|
||||
*
|
||||
* @param node
|
||||
* @param backing Memory allocator used for descendants
|
||||
* @param name Node's name
|
||||
* @param is_array
|
||||
* @return error code
|
||||
*/
|
||||
u8 adt_make_branch( ADT_Node* node, AllocatorInfo backing, char const* name, b32 is_array );
|
||||
|
||||
/**
|
||||
* @brief Destroy an ADT branch and its descendants
|
||||
*
|
||||
* @param node
|
||||
* @return error code
|
||||
*/
|
||||
u8 adt_destroy_branch( ADT_Node* node );
|
||||
|
||||
/**
|
||||
* @brief Initialise an ADT leaf
|
||||
*
|
||||
* @param node
|
||||
* @param name Node's name
|
||||
* @param type Node's type (use zpl_adt_make_branch for container nodes)
|
||||
* @return error code
|
||||
*/
|
||||
u8 adt_make_leaf( ADT_Node* node, char const* name, ADT_Type type );
|
||||
|
||||
|
||||
/**
|
||||
* @brief Fetch a node using provided URI string.
|
||||
*
|
||||
* This method uses a basic syntax to fetch a node from the ADT. The following features are available
|
||||
* to retrieve the data:
|
||||
*
|
||||
* - "a/b/c" navigates through objects "a" and "b" to get to "c"
|
||||
* - "arr/[foo=123]/bar" iterates over "arr" to find any object with param "foo" that matches the value "123", then gets its field called "bar"
|
||||
* - "arr/3" retrieves the 4th element in "arr"
|
||||
* - "arr/[apple]" retrieves the first element of value "apple" in "arr"
|
||||
*
|
||||
* @param node ADT node
|
||||
* @param uri Locator string as described above
|
||||
* @return zpl_adt_node*
|
||||
*
|
||||
* @see code/apps/examples/json_get.c
|
||||
*/
|
||||
ADT_Node* adt_query( ADT_Node* node, char const* uri );
|
||||
|
||||
/**
|
||||
* @brief Find a field node within an object by the given name.
|
||||
*
|
||||
* @param node
|
||||
* @param name
|
||||
* @param deep_search Perform search recursively
|
||||
* @return zpl_adt_node * node
|
||||
*/
|
||||
ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search );
|
||||
|
||||
/**
|
||||
* @brief Allocate an unitialised node within a container at a specified index.
|
||||
*
|
||||
* @param parent
|
||||
* @param index
|
||||
* @return zpl_adt_node * node
|
||||
*/
|
||||
ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index );
|
||||
|
||||
/**
|
||||
* @brief Allocate an unitialised node within a container.
|
||||
*
|
||||
* @param parent
|
||||
* @return zpl_adt_node * node
|
||||
*/
|
||||
ADT_Node* adt_alloc( ADT_Node* parent );
|
||||
|
||||
/**
|
||||
* @brief Move an existing node to a new container at a specified index.
|
||||
*
|
||||
* @param node
|
||||
* @param new_parent
|
||||
* @param index
|
||||
* @return zpl_adt_node * node
|
||||
*/
|
||||
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index );
|
||||
|
||||
/**
|
||||
* @brief Move an existing node to a new container.
|
||||
*
|
||||
* @param node
|
||||
* @param new_parent
|
||||
* @return zpl_adt_node * node
|
||||
*/
|
||||
ADT_Node* adt_move_node( ADT_Node* node, ADT_Node* new_parent );
|
||||
|
||||
/**
|
||||
* @brief Swap two nodes.
|
||||
*
|
||||
* @param node
|
||||
* @param other_node
|
||||
* @return
|
||||
*/
|
||||
void adt_swap_nodes( ADT_Node* node, ADT_Node* other_node );
|
||||
|
||||
/**
|
||||
* @brief Remove node from container.
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
void adt_remove_node( ADT_Node* node );
|
||||
|
||||
/**
|
||||
* @brief Initialise a node as an object
|
||||
*
|
||||
* @param obj
|
||||
* @param name
|
||||
* @param backing
|
||||
* @return
|
||||
*/
|
||||
b8 adt_set_obj( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
||||
|
||||
/**
|
||||
* @brief Initialise a node as an array
|
||||
*
|
||||
* @param obj
|
||||
* @param name
|
||||
* @param backing
|
||||
* @return
|
||||
*/
|
||||
b8 adt_set_arr( ADT_Node* obj, char const* name, AllocatorInfo backing );
|
||||
|
||||
/**
|
||||
* @brief Initialise a node as a string
|
||||
*
|
||||
* @param obj
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
b8 adt_set_str( ADT_Node* obj, char const* name, char const* value );
|
||||
|
||||
/**
|
||||
* @brief Initialise a node as a float
|
||||
*
|
||||
* @param obj
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
b8 adt_set_flt( ADT_Node* obj, char const* name, f64 value );
|
||||
|
||||
/**
|
||||
* @brief Initialise a node as a signed integer
|
||||
*
|
||||
* @param obj
|
||||
* @param name
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
b8 adt_set_int( ADT_Node* obj, char const* name, s64 value );
|
||||
|
||||
/**
|
||||
* @brief Append a new node to a container as an object
|
||||
*
|
||||
* @param parent
|
||||
* @param name
|
||||
* @return*
|
||||
*/
|
||||
ADT_Node* adt_append_obj( ADT_Node* parent, char const* name );
|
||||
|
||||
/**
|
||||
* @brief Append a new node to a container as an array
|
||||
*
|
||||
* @param parent
|
||||
* @param name
|
||||
* @return*
|
||||
*/
|
||||
ADT_Node* adt_append_arr( ADT_Node* parent, char const* name );
|
||||
|
||||
/**
|
||||
* @brief Append a new node to a container as a string
|
||||
*
|
||||
* @param parent
|
||||
* @param name
|
||||
* @param value
|
||||
* @return*
|
||||
*/
|
||||
ADT_Node* adt_append_str( ADT_Node* parent, char const* name, char const* value );
|
||||
|
||||
/**
|
||||
* @brief Append a new node to a container as a float
|
||||
*
|
||||
* @param parent
|
||||
* @param name
|
||||
* @param value
|
||||
* @return*
|
||||
*/
|
||||
ADT_Node* adt_append_flt( ADT_Node* parent, char const* name, f64 value );
|
||||
|
||||
/**
|
||||
* @brief Append a new node to a container as a signed integer
|
||||
*
|
||||
* @param parent
|
||||
* @param name
|
||||
* @param value
|
||||
* @return*
|
||||
*/
|
||||
ADT_Node* adt_append_int( ADT_Node* parent, char const* name, s64 value );
|
||||
|
||||
/* parser helpers */
|
||||
|
||||
/**
|
||||
* @brief Parses a text and stores the result into an unitialised node.
|
||||
*
|
||||
* @param node
|
||||
* @param base
|
||||
* @return*
|
||||
*/
|
||||
char* adt_parse_number( ADT_Node* node, char* base );
|
||||
|
||||
/**
|
||||
* @brief Parses a text and stores the result into an unitialised node.
|
||||
* This function expects the entire input to be a number.
|
||||
*
|
||||
* @param node
|
||||
* @param base
|
||||
* @return*
|
||||
*/
|
||||
char* adt_parse_number_strict( ADT_Node* node, char* base_str );
|
||||
|
||||
/**
|
||||
* @brief Parses and converts an existing string node into a number.
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
ADT_Error adt_str_to_number( ADT_Node* node );
|
||||
|
||||
/**
|
||||
* @brief Parses and converts an existing string node into a number.
|
||||
* This function expects the entire input to be a number.
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
ADT_Error adt_str_to_number_strict( ADT_Node* node );
|
||||
|
||||
/**
|
||||
* @brief Prints a number into a file stream.
|
||||
*
|
||||
* The provided file handle can also be a memory mapped stream.
|
||||
*
|
||||
* @see zpl_file_stream_new
|
||||
* @param file
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
ADT_Error adt_print_number( FileInfo* file, ADT_Node* node );
|
||||
|
||||
/**
|
||||
* @brief Prints a string into a file stream.
|
||||
*
|
||||
* The provided file handle can also be a memory mapped stream.
|
||||
*
|
||||
* @see zpl_file_stream_new
|
||||
* @param file
|
||||
* @param node
|
||||
* @param escaped_chars
|
||||
* @param escape_symbol
|
||||
* @return
|
||||
*/
|
||||
ADT_Error adt_print_string( FileInfo* file, ADT_Node* node, char const* escaped_chars, char const* escape_symbol );
|
||||
|
||||
#pragma endregion ADT
|
||||
|
||||
#pragma region CSV
|
||||
|
||||
enum CSV_Error : u32
|
||||
{
|
||||
ECSV_Error__NONE,
|
||||
ECSV_Error__INTERNAL,
|
||||
ECSV_Error__UNEXPECTED_END_OF_INPUT,
|
||||
ECSV_Error__MISMATCHED_ROWS,
|
||||
};
|
||||
|
||||
typedef ADT_Node CSV_Object;
|
||||
|
||||
u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header );
|
||||
u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header, char delim );
|
||||
void csv_free( CSV_Object* obj );
|
||||
|
||||
void csv_write( FileInfo* file, CSV_Object* obj );
|
||||
String csv_write_string( AllocatorInfo a, CSV_Object* obj );
|
||||
void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delim );
|
||||
String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delim );
|
||||
|
||||
/* inline */
|
||||
|
||||
inline
|
||||
u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header )
|
||||
{
|
||||
return csv_parse_delimiter( root, text, allocator, has_header, ',' );
|
||||
}
|
||||
|
||||
inline
|
||||
void csv_write( FileInfo* file, CSV_Object* obj )
|
||||
{
|
||||
csv_write_delimiter( file, obj, ',' );
|
||||
}
|
||||
|
||||
inline
|
||||
String csv_write_string( AllocatorInfo a, CSV_Object* obj )
|
||||
{
|
||||
return csv_write_string_delimiter( a, obj, ',' );
|
||||
}
|
||||
|
||||
#pragma endregion CSV
|
||||
#pragma region Scanner
|
||||
|
||||
// This is a simple file reader that reads the entire file into memory.
|
||||
// It has an extra option to skip the first few lines for undesired includes.
|
||||
// This is done so that includes can be kept in dependency and component files so that intellisense works.
|
||||
inline
|
||||
Code scan_file( char const* path )
|
||||
{
|
||||
FileInfo file;
|
||||
Code scan_file( char const* path );
|
||||
|
||||
FileError error = file_open_mode( & file, EFileMode_READ, path );
|
||||
if ( error != EFileError_NONE )
|
||||
{
|
||||
GEN_FATAL( "scan_file: Could not open: %s", path );
|
||||
}
|
||||
CodeBody parse_file( const char* path );
|
||||
|
||||
ssize fsize = file_size( & file );
|
||||
if ( fsize <= 0 )
|
||||
{
|
||||
GEN_FATAL("scan_file: %s is empty", path );
|
||||
}
|
||||
// The follow is basic support for light csv parsing (use it as an example)
|
||||
// Make something robust if its more serious.
|
||||
|
||||
String str = String::make_reserve( GlobalAllocator, fsize );
|
||||
file_read( & file, str, fsize );
|
||||
str.get_header().Length = fsize;
|
||||
|
||||
// Skip GEN_INTELLISENSE_DIRECTIVES preprocessor blocks
|
||||
// Its designed so that the directive should be the first thing in the file.
|
||||
// Anything that comes before it will also be omitted.
|
||||
{
|
||||
#define current (*scanner)
|
||||
#define matched 0
|
||||
#define move_fwd() do { ++ scanner; -- left; } while (0)
|
||||
const StrC directive_start = txt( "ifdef" );
|
||||
const StrC directive_end = txt( "endif" );
|
||||
const StrC def_intellisense = txt("GEN_INTELLISENSE_DIRECTIVES" );
|
||||
|
||||
bool found_directive = false;
|
||||
char const* scanner = str.Data;
|
||||
s32 left = fsize;
|
||||
while ( left )
|
||||
{
|
||||
// Processing directive.
|
||||
if ( current == '#' )
|
||||
{
|
||||
move_fwd();
|
||||
while ( left && char_is_space( current ) )
|
||||
move_fwd();
|
||||
|
||||
if ( ! found_directive )
|
||||
{
|
||||
if ( left && str_compare( scanner, directive_start.Ptr, directive_start.Len ) == matched )
|
||||
{
|
||||
scanner += directive_start.Len;
|
||||
left -= directive_start.Len;
|
||||
|
||||
while ( left && char_is_space( current ) )
|
||||
move_fwd();
|
||||
|
||||
if ( left && str_compare( scanner, def_intellisense.Ptr, def_intellisense.Len ) == matched )
|
||||
{
|
||||
scanner += def_intellisense.Len;
|
||||
left -= def_intellisense.Len;
|
||||
|
||||
found_directive = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip to end of line
|
||||
while ( left && current != '\r' && current != '\n' )
|
||||
move_fwd();
|
||||
move_fwd();
|
||||
|
||||
if ( left && current == '\n' )
|
||||
move_fwd();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( left && str_compare( scanner, directive_end.Ptr, directive_end.Len ) == matched )
|
||||
{
|
||||
scanner += directive_end.Len;
|
||||
left -= directive_end.Len;
|
||||
|
||||
// Skip to end of line
|
||||
while ( left && current != '\r' && current != '\n' )
|
||||
move_fwd();
|
||||
move_fwd();
|
||||
|
||||
if ( left && current == '\n' )
|
||||
move_fwd();
|
||||
|
||||
// sptr skip_size = fsize - left;
|
||||
if ( (scanner + 2) >= ( str.Data + fsize ) )
|
||||
{
|
||||
mem_move( str, scanner, left );
|
||||
str.get_header().Length = left;
|
||||
break;
|
||||
}
|
||||
|
||||
mem_move( str, scanner, left );
|
||||
str.get_header().Length = left;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
move_fwd();
|
||||
}
|
||||
#undef move_fwd
|
||||
#undef matched
|
||||
#undef current
|
||||
}
|
||||
|
||||
file_close( & file );
|
||||
return untyped_str( str );
|
||||
}
|
||||
|
||||
#if 0
|
||||
struct CodeFile
|
||||
{
|
||||
using namespace Parser;
|
||||
|
||||
String FilePath;
|
||||
TokArray Tokens;
|
||||
Array<ParseFailure> ParseFailures;
|
||||
Code CodeRoot;
|
||||
typedef struct CSV_Column CSV_Column;
|
||||
struct CSV_Column {
|
||||
CSV_Object ADT;
|
||||
Array(ADT_Node) Content;
|
||||
};
|
||||
|
||||
namespace Parser
|
||||
{
|
||||
struct ParseFailure
|
||||
{
|
||||
String Reason;
|
||||
Code Node;
|
||||
};
|
||||
}
|
||||
typedef struct CSV_Columns2 CSV_Columns2;
|
||||
struct CSV_Columns2 {
|
||||
CSV_Object ADT;
|
||||
Array(ADT_Node) Col_1;
|
||||
Array(ADT_Node) Col_2;
|
||||
};
|
||||
|
||||
CodeFile scan_file( char const* path )
|
||||
{
|
||||
using namespace Parser;
|
||||
CSV_Column parse_csv_one_column(AllocatorInfo allocator, char const* path);
|
||||
CSV_Columns2 parse_csv_two_columns(AllocatorInfo allocator, char const* path);
|
||||
|
||||
CodeFile
|
||||
result = {};
|
||||
result.FilePath = String::make( GlobalAllocator, path );
|
||||
#pragma endregion Scanner
|
||||
|
||||
Code code = scan_file( path );
|
||||
result.CodeRoot = code;
|
||||
|
||||
ParseContext context = parser_get_last_context();
|
||||
result.Tokens = context.Tokens;
|
||||
result.ParseFailures = context.Failures;
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
|
@ -27,8 +27,6 @@ int gen_main()
|
||||
gen::init(& ctx);
|
||||
log_fmt("Generating code for the Gasa module\n");
|
||||
|
||||
Array(StrCached)& PreprocessorDefines = ctx.PreprocessorDefines;
|
||||
|
||||
// Initialize Globals
|
||||
{
|
||||
UHT_UCLASS = code_str( UCLASS() );
|
||||
@ -39,52 +37,60 @@ int gen_main()
|
||||
}
|
||||
|
||||
// Populate Defines
|
||||
{
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_CLASS));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DELEGATE_RetVal_OneParam));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DELEGATE_RetVal_ThreeParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DELEGATE_SixParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_EVENT_ThreeParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_EVENT_TwoParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_FUNCTION));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_LOG_CATEGORY_EXTERN));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_MULTICAST_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_MULTICAST_DELEGATE_ThreeParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_MULTICAST_DELEGATE_TwoParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_TS_MULTICAST_DELEGATE_OneParam));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams));
|
||||
PreprocessorDefines.append( cache_str(str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams));
|
||||
PreprocessorDefines.append( cache_str(str_DEFINE_ACTORDESC_TYPE));
|
||||
PreprocessorDefines.append( cache_str(str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL));
|
||||
PreprocessorDefines.append( cache_str(str_ENUM_CLASS_FLAGS));
|
||||
PreprocessorDefines.append( cache_str(str_FORCEINLINE_DEBUGGABLE));
|
||||
// PreprocessorDefines.append( get_cached_string(str_FORCEINLINE));
|
||||
PreprocessorDefines.append( cache_str(str_GENERATED_BODY));
|
||||
PreprocessorDefines.append( cache_str(str_GENERATED_UCLASS_BODY));
|
||||
PreprocessorDefines.append( cache_str(str_GENERATED_USTRUCT_BODY));
|
||||
PreprocessorDefines.append( cache_str(str_PRAGMA_DISABLE_DEPRECATION_WARNINGS));
|
||||
PreprocessorDefines.append( cache_str(str_PRAGMA_ENABLE_DEPRECATION_WARNINGS));
|
||||
PreprocessorDefines.append( cache_str(str_PROPERTY_BINDING_IMPLEMENTATION));
|
||||
PreprocessorDefines.append( cache_str(str_RESULT_DECL));
|
||||
PreprocessorDefines.append( cache_str(str_SLATE_BEGIN_ARGS));
|
||||
PreprocessorDefines.append( cache_str(str_SLATE_END_ARGS));
|
||||
PreprocessorDefines.append( cache_str(str_TEXT));
|
||||
PreprocessorDefines.append( cache_str(str_UCLASS));
|
||||
PreprocessorDefines.append( cache_str(str_UENUM));
|
||||
PreprocessorDefines.append( cache_str(str_UFUNCTION));
|
||||
PreprocessorDefines.append( cache_str(str_UMETA));
|
||||
PreprocessorDefines.append( cache_str(str_UPARAM));
|
||||
PreprocessorDefines.append( cache_str(str_UPROPERTY));
|
||||
PreprocessorDefines.append( cache_str(str_USTRUCT));
|
||||
PreprocessorDefines.append( cache_str(str_UE_REQUIRES));
|
||||
}
|
||||
register_macros( args(
|
||||
(Macro { str_DECLARE_CLASS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DELEGATE_RetVal_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DELEGATE_RetVal_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DELEGATE_SixParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_EVENT_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_EVENT_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_FUNCTION, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_LOG_CATEGORY_EXTERN, MT_Statement, MF_Functional | MF_Allow_As_Definition }),
|
||||
(Macro { str_DECLARE_MULTICAST_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_MULTICAST_DELEGATE_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_MULTICAST_DELEGATE_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_TS_MULTICAST_DELEGATE_OneParam, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DEFINE_ACTORDESC_TYPE, MT_Statement, MF_Functional }),
|
||||
(Macro { str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL, MT_Statement, MF_Functional }),
|
||||
(Macro { str_ENUM_CLASS_FLAGS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GENERATED_BODY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GENERATED_UCLASS_BODY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GENERATED_USTRUCT_BODY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_PRAGMA_DISABLE_DEPRECATION_WARNINGS, MT_Statement, MF_Null | MF_Allow_As_Attribute }),
|
||||
(Macro { str_PRAGMA_ENABLE_DEPRECATION_WARNINGS, MT_Statement, MF_Null | MF_Allow_As_Attribute }),
|
||||
(Macro { str_PROPERTY_BINDING_IMPLEMENTATION, MT_Statement, MF_Functional }),
|
||||
(Macro { str_RESULT_DECL, MT_Expression, MF_Functional }),
|
||||
(Macro { str_SLATE_BEGIN_ARGS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_SLATE_END_ARGS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_TEXT, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UCLASS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UENUM, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UFUNCTION, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UMETA, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UPARAM, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UPROPERTY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_USTRUCT, MT_Statement, MF_Functional }),
|
||||
(Macro { str_UE_REQUIRES, MT_Expression, MF_Functional }),
|
||||
(Macro { str_UE_DEPRECATED, MT_Statement, MF_Functional | MF_Allow_As_Attribute }),
|
||||
(Macro { str_ACTOR_HAS_LABELS, MT_Expression, MF_Null }),
|
||||
(Macro { str_HIDE_ACTOR_TRANSFORM_FUNCTIONS, MT_Statement, MF_Functional }),
|
||||
(Macro { str_SCENECOMPONENT_QUAT_TOLERANCE, MT_Expression, MF_Null }),
|
||||
(Macro { str_SCENECOMPONENT_ROTATOR_TOLERANCE, MT_Expression, MF_Null }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_REPNOTIFY, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_PROPERTY_GETTER, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_VALUE_GETTER, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_VALUE_SETTER, MT_Statement, MF_Functional }),
|
||||
(Macro { str_GAMEPLAYATTRIBUTE_VALUE_INITTER, MT_Statement, MF_Functional })
|
||||
));
|
||||
|
||||
// gen_UGasaAttributeSet();
|
||||
// gen_FGasaDevOptionsCache();
|
||||
|
@ -18,50 +18,58 @@ using namespace gen;
|
||||
#define path_gasa_game path_module_gasa "Game/"
|
||||
#define path_gasa_ui path_module_gasa "UI/"
|
||||
|
||||
constexpr Str str_DECLARE_CLASS = txt("DECLARE_CLASS(");
|
||||
constexpr Str str_DECLARE_DELEGATE_RetVal_OneParam = txt("DECLARE_DELEGATE_RetVal_OneParam(");
|
||||
constexpr Str str_DECLARE_DELEGATE_RetVal_ThreeParams = txt("DECLARE_DELEGATE_RetVal_ThreeParams(");
|
||||
constexpr Str str_DECLARE_DELEGATE_SixParams = txt("DECLARE_DELEGATE_SixParams(");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams(");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams(");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams(");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam(");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams(");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams(");
|
||||
constexpr Str str_DECLARE_EVENT_ThreeParams = txt("DECLARE_EVENT_ThreeParams(");
|
||||
constexpr Str str_DECLARE_EVENT_TwoParams = txt("DECLARE_EVENT_TwoParams(");
|
||||
constexpr Str str_DECLARE_FUNCTION = txt("DECLARE_FUNCTION(");
|
||||
constexpr Str str_DECLARE_LOG_CATEGORY_EXTERN = txt("DECLARE_LOG_CATEGORY_EXTERN(");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_OneParam = txt("DECLARE_MULTICAST_DELEGATE_OneParam(");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_MULTICAST_DELEGATE_ThreeParams(");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_MULTICAST_DELEGATE_TwoParams(");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_OneParam = txt("DECLARE_TS_MULTICAST_DELEGATE_OneParam(");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_TS_MULTICAST_DELEGATE_TwoParams(");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_TS_MULTICAST_DELEGATE_ThreeParams(");
|
||||
constexpr Str str_DEFINE_ACTORDESC_TYPE = txt("DEFINE_ACTORDESC_TYPE(");
|
||||
constexpr Str str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL = txt("DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(");
|
||||
constexpr Str str_ENUM_CLASS_FLAGS = txt("ENUM_CLASS_FLAGS(");
|
||||
// constexpr StrC str_FORCEINLINE = txt("FORCEINLINE");
|
||||
constexpr Str str_FORCEINLINE_DEBUGGABLE = txt("FORCEINLINE_DEBUGGABLE");
|
||||
constexpr Str str_GENERATED_BODY = txt("GENERATED_BODY(");
|
||||
constexpr Str str_GENERATED_UCLASS_BODY = txt("GENERATED_UCLASS_BODY(");
|
||||
constexpr Str str_GENERATED_USTRUCT_BODY = txt("GENERATED_USTRUCT_BODY(");
|
||||
constexpr Str str_DECLARE_CLASS = txt("DECLARE_CLASS");
|
||||
constexpr Str str_DECLARE_DELEGATE_RetVal_OneParam = txt("DECLARE_DELEGATE_RetVal_OneParam");
|
||||
constexpr Str str_DECLARE_DELEGATE_RetVal_ThreeParams = txt("DECLARE_DELEGATE_RetVal_ThreeParams");
|
||||
constexpr Str str_DECLARE_DELEGATE_SixParams = txt("DECLARE_DELEGATE_SixParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams");
|
||||
constexpr Str str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams = txt("DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams");
|
||||
constexpr Str str_DECLARE_EVENT_ThreeParams = txt("DECLARE_EVENT_ThreeParams");
|
||||
constexpr Str str_DECLARE_EVENT_TwoParams = txt("DECLARE_EVENT_TwoParams");
|
||||
constexpr Str str_DECLARE_FUNCTION = txt("DECLARE_FUNCTION");
|
||||
constexpr Str str_DECLARE_LOG_CATEGORY_EXTERN = txt("DECLARE_LOG_CATEGORY_EXTERN");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_OneParam = txt("DECLARE_MULTICAST_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_MULTICAST_DELEGATE_ThreeParams");
|
||||
constexpr Str str_DECLARE_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_MULTICAST_DELEGATE_TwoParams");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_OneParam = txt("DECLARE_TS_MULTICAST_DELEGATE_OneParam");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams = txt("DECLARE_TS_MULTICAST_DELEGATE_TwoParams");
|
||||
constexpr Str str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams = txt("DECLARE_TS_MULTICAST_DELEGATE_ThreeParams");
|
||||
constexpr Str str_DEFINE_ACTORDESC_TYPE = txt("DEFINE_ACTORDESC_TYPE");
|
||||
constexpr Str str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL = txt("DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL");
|
||||
constexpr Str str_ENUM_CLASS_FLAGS = txt("ENUM_CLASS_FLAGS");
|
||||
constexpr Str str_GENERATED_BODY = txt("GENERATED_BODY");
|
||||
constexpr Str str_GENERATED_UCLASS_BODY = txt("GENERATED_UCLASS_BODY");
|
||||
constexpr Str str_GENERATED_USTRUCT_BODY = txt("GENERATED_USTRUCT_BODY");
|
||||
constexpr Str str_PRAGMA_DISABLE_DEPRECATION_WARNINGS = txt("PRAGMA_DISABLE_DEPRECATION_WARNINGS");
|
||||
constexpr Str str_PRAGMA_ENABLE_DEPRECATION_WARNINGS = txt("PRAGMA_ENABLE_DEPRECATION_WARNINGS");
|
||||
constexpr Str str_PROPERTY_BINDING_IMPLEMENTATION = txt("PROPERTY_BINDING_IMPLEMENTATION(");
|
||||
constexpr Str str_PROPERTY_BINDING_IMPLEMENTATION = txt("PROPERTY_BINDING_IMPLEMENTATION");
|
||||
constexpr Str str_RESULT_DECL = txt("RESULT_DECL");
|
||||
constexpr Str str_SLATE_BEGIN_ARGS = txt("SLATE_BEGIN_ARGS(");
|
||||
constexpr Str str_SLATE_END_ARGS = txt("SLATE_END_ARGS(");
|
||||
constexpr Str str_TEXT = txt("TEXT(");
|
||||
constexpr Str str_UCLASS = txt("UCLASS(");
|
||||
constexpr Str str_UENUM = txt("UENUM(");
|
||||
constexpr Str str_UFUNCTION = txt("UFUNCTION(");
|
||||
constexpr Str str_UMETA = txt("UMETA(");
|
||||
constexpr Str str_UPARAM = txt("UPARAM(");
|
||||
constexpr Str str_UPROPERTY = txt("UPROPERTY(");
|
||||
constexpr Str str_USTRUCT = txt("USTRUCT(");
|
||||
constexpr Str str_UE_REQUIRES = txt("UE_REQUIRES(");
|
||||
constexpr Str str_SLATE_BEGIN_ARGS = txt("SLATE_BEGIN_ARGS");
|
||||
constexpr Str str_SLATE_END_ARGS = txt("SLATE_END_ARGS");
|
||||
constexpr Str str_TEXT = txt("TEXT");
|
||||
constexpr Str str_UCLASS = txt("UCLASS");
|
||||
constexpr Str str_UENUM = txt("UENUM");
|
||||
constexpr Str str_UFUNCTION = txt("UFUNCTION");
|
||||
constexpr Str str_UMETA = txt("UMETA");
|
||||
constexpr Str str_UPARAM = txt("UPARAM");
|
||||
constexpr Str str_UPROPERTY = txt("UPROPERTY");
|
||||
constexpr Str str_USTRUCT = txt("USTRUCT");
|
||||
constexpr Str str_UE_REQUIRES = txt("UE_REQUIRES");
|
||||
constexpr Str str_UE_DEPRECATED = txt("UE_DEPRECATED");
|
||||
constexpr Str str_ACTOR_HAS_LABELS = txt("ACTOR_HAS_LABELS");
|
||||
constexpr Str str_HIDE_ACTOR_TRANSFORM_FUNCTIONS = txt("HIDE_ACTOR_TRANSFORM_FUNCTIONS");
|
||||
constexpr Str str_SCENECOMPONENT_QUAT_TOLERANCE = txt("SCENECOMPONENT_QUAT_TOLERANCE");
|
||||
constexpr Str str_SCENECOMPONENT_ROTATOR_TOLERANCE = txt("SCENECOMPONENT_ROTATOR_TOLERANCE");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_REPNOTIFY = txt("GAMEPLAYATTRIBUTE_REPNOTIFY");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_PROPERTY_GETTER = txt("GAMEPLAYATTRIBUTE_PROPERTY_GETTER");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_VALUE_GETTER = txt("GAMEPLAYATTRIBUTE_VALUE_GETTER");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_VALUE_SETTER = txt("GAMEPLAYATTRIBUTE_VALUE_SETTER");
|
||||
constexpr Str str_GAMEPLAYATTRIBUTE_VALUE_INITTER = txt("GAMEPLAYATTRIBUTE_VALUE_INITTER");
|
||||
|
||||
constexpr Str str_GASA_API = txt("GASA_API");
|
||||
|
||||
|
@ -36,7 +36,7 @@ void ue_parse_testing()
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
// log_fmt("%s\n", class_code->to_string() );
|
||||
}
|
||||
break;
|
||||
@ -74,7 +74,7 @@ void ue_parse_testing()
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
// log_fmt("%s\n", class_code->to_string() );
|
||||
}
|
||||
break;
|
||||
@ -109,7 +109,7 @@ void ue_parse_testing()
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -143,7 +143,7 @@ void ue_parse_testing()
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -177,7 +177,7 @@ void ue_parse_testing()
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -211,7 +211,7 @@ void ue_parse_testing()
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -39,7 +39,9 @@ Builder builder_open( char const* path )
|
||||
return result;
|
||||
}
|
||||
|
||||
result.Buffer = strbuilder_make_reserve( _ctx->Allocator_Temp, _ctx->InitSize_BuilderBuffer );
|
||||
Context* ctx = get_context();
|
||||
GEN_ASSERT_NOT_NULL(ctx);
|
||||
result.Buffer = strbuilder_make_reserve( ctx->Allocator_Temp, ctx->InitSize_BuilderBuffer );
|
||||
|
||||
// log_fmt("$Builder - Opened file: %s\n", result.File.filename );
|
||||
return result;
|
||||
|
@ -3403,6 +3403,10 @@ void deinit(Context* ctx)
|
||||
-- context_counter;
|
||||
}
|
||||
|
||||
Context* get_context() {
|
||||
return _ctx;
|
||||
}
|
||||
|
||||
void reset(Context* ctx)
|
||||
{
|
||||
s32 index = 0;
|
||||
@ -3498,6 +3502,7 @@ void register_macro( Macro macro ) {
|
||||
GEN_ASSERT_NOT_NULL(macro.Name.Ptr);
|
||||
GEN_ASSERT(macro.Name.Len > 0);
|
||||
u32 key = crc32( macro.Name.Ptr, macro.Name.Len );
|
||||
macro.Name = cache_str(macro.Name);
|
||||
hashtable_set( _ctx->Macros, key, macro );
|
||||
}
|
||||
|
||||
@ -3511,6 +3516,7 @@ void register_macros( s32 num, ... )
|
||||
Macro macro = va_arg(va, Macro);
|
||||
GEN_ASSERT_NOT_NULL(macro.Name.Ptr);
|
||||
GEN_ASSERT(macro.Name.Len > 0);
|
||||
macro.Name = cache_str(macro.Name);
|
||||
|
||||
u32 key = crc32( macro.Name.Ptr, macro.Name.Len );
|
||||
hashtable_set( _ctx->Macros, key, macro );
|
||||
@ -3527,6 +3533,7 @@ void register_macros( s32 num, Macro* macros )
|
||||
Macro macro = * macros;
|
||||
GEN_ASSERT_NOT_NULL(macro.Name.Ptr);
|
||||
GEN_ASSERT(macro.Name.Len > 0);
|
||||
macro.Name = cache_str(macro.Name);
|
||||
|
||||
u32 key = crc32( macro.Name.Ptr, macro.Name.Len );
|
||||
hashtable_set( _ctx->Macros, key, macro );
|
||||
@ -6160,45 +6167,24 @@ void lex_found_token( LexContext* ctx )
|
||||
ctx->token.Type = macrotype_to_toktype(macro->Type);
|
||||
b32 is_functional = macro_is_functional(* macro);
|
||||
resolved_to_macro = has_args ? is_functional : ! is_functional;
|
||||
if ( ! resolved_to_macro ) {
|
||||
log_fmt("Info(%d, %d): %S identified as a macro but usage here does not resolve to one (interpreting as identifier)\n"
|
||||
, ctx->token.Line
|
||||
, ctx->token.Line
|
||||
, macro->Name
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( resolved_to_macro )
|
||||
{
|
||||
// TODO(Ed): When we introduce a macro AST (and expression support), we'll properly lex this section.
|
||||
// Want to ignore any arguments the define may have as they can be execution expressions.
|
||||
if ( has_args )
|
||||
{
|
||||
if ( has_args ) {
|
||||
ctx->token.Flags |= TF_Macro_Functional;
|
||||
|
||||
// move_forward();
|
||||
// ctx->token.Text.Len++;
|
||||
|
||||
// s32 level = 0;
|
||||
// while ( ctx->left && ((* ctx->scanner) != ')' || level > 0) )
|
||||
// {
|
||||
// if ( (* ctx->scanner) == '(' )
|
||||
// level++;
|
||||
|
||||
// else if ( (* ctx->scanner) == ')' && level > 0 )
|
||||
// level--;
|
||||
|
||||
// move_forward();
|
||||
// ctx->token.Text.Len++;
|
||||
// }
|
||||
|
||||
// move_forward();
|
||||
// ctx->token.Text.Len++;
|
||||
}
|
||||
|
||||
//if ( (* ctx->scanner) == '\r' && ctx->scanner[1] == '\n' )
|
||||
//{
|
||||
// move_forward();
|
||||
// ctx->token..Text.Length++;
|
||||
//}
|
||||
//else if ( (* ctx->scanner) == '\n' )
|
||||
//{
|
||||
// move_forward();
|
||||
// ctx->token..Text.Length++;
|
||||
//}
|
||||
if ( bitfield_is_set(MacroFlags, macro->Flags, MF_Allow_As_Attribute) ) {
|
||||
ctx->token.Flags |= TF_Attribute;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -7252,6 +7238,7 @@ internal CodeBody parse_global_nspace ( CodeType which
|
||||
internal Code parse_global_nspace_constructor_destructor( CodeSpecifiers specifiers );
|
||||
internal Token parse_identifier ( bool* possible_member_function );
|
||||
internal CodeInclude parse_include ();
|
||||
internal Code parse_macro_as_definiton ( CodeAttributes attributes, CodeSpecifiers specifiers );
|
||||
internal CodeOperator parse_operator_after_ret_type ( ModuleFlag mflags, CodeAttributes attributes, CodeSpecifiers specifiers, CodeTypename ret_type );
|
||||
internal Code parse_operator_function_or_variable( bool expects_function, CodeAttributes attributes, CodeSpecifiers specifiers );
|
||||
internal CodePragma parse_pragma ();
|
||||
@ -7626,7 +7613,7 @@ CodeAttributes parse_attributes()
|
||||
s32 len = 0;
|
||||
|
||||
// There can be more than one attribute. If there is flatten them to a single string.
|
||||
// TODO(Ed): Support keeping an linked list of attributes similar to parameters
|
||||
// TODO(Ed): Support chaining attributes (Use parameter linkage pattern)
|
||||
while ( left && tok_is_attribute(currtok) )
|
||||
{
|
||||
if ( check( Tok_Attribute_Open ) )
|
||||
@ -9482,6 +9469,12 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
|
||||
|
||||
Code result = InvalidCode;
|
||||
|
||||
Code macro_stmt = parse_macro_as_definiton(attributes, specifiers);
|
||||
if (macro_stmt) {
|
||||
parser_pop(& _ctx->parser);
|
||||
return macro_stmt;
|
||||
}
|
||||
|
||||
CodeTypename type = parser_parse_type( parser_not_from_template, nullptr );
|
||||
// <Attributes> <Specifiers> <ReturnType/ValueType>
|
||||
|
||||
@ -9554,6 +9547,36 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
|
||||
return result;
|
||||
}
|
||||
|
||||
internal
|
||||
Code parse_macro_as_definiton( CodeAttributes attributes, CodeSpecifiers specifiers )
|
||||
{
|
||||
push_scope();
|
||||
|
||||
if (currtok.Type != Tok_Preprocess_Macro_Stmt ) {
|
||||
parser_pop(& _ctx->parser);
|
||||
return NullCode;
|
||||
}
|
||||
Macro* macro = lookup_macro(currtok.Text);
|
||||
b32 can_resolve_to_definition = macro && bitfield_is_set(MacroFlags, macro->Flags, MF_Allow_As_Definition);
|
||||
if ( ! can_resolve_to_definition) {
|
||||
parser_pop(& _ctx->parser);
|
||||
return NullCode;
|
||||
}
|
||||
|
||||
// TODO(Ed): When AST_Macro is made, have it support attributs and specifiers for when its behaving as a declaration/definition.
|
||||
Code code = parse_simple_preprocess( Tok_Preprocess_Macro_Stmt );
|
||||
|
||||
// Attributes and sepcifiers will be collapsed into the macro's serialization.
|
||||
StrBuilder resolved_definition = strbuilder_fmt_buf(_ctx->Allocator_Temp, "%S %S %S"
|
||||
, attributes ? strbuilder_to_str( attributes_to_strbuilder(attributes)) : txt("")
|
||||
, specifiers ? strbuilder_to_str( specifiers_to_strbuilder(specifiers)) : txt("")
|
||||
, code->Content
|
||||
);
|
||||
Code result = untyped_str( strbuilder_to_str(resolved_definition) );
|
||||
parser_pop(& _ctx->parser);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal
|
||||
CodePragma parse_pragma()
|
||||
{
|
||||
@ -10809,8 +10832,11 @@ CodeEnum parser_parse_enum( bool inplace_def )
|
||||
|
||||
// Unreal UMETA macro support
|
||||
if ( currtok.Type == Tok_Preprocess_Macro_Expr ) {
|
||||
eat( Tok_Preprocess_Macro_Expr );
|
||||
Code macro = parse_simple_preprocess( Tok_Preprocess_Macro_Expr );
|
||||
// <Name> = <Expression> <Macro>
|
||||
|
||||
// We're intentially ignoring this code as its going to be serialized as an untyped string with the rest of the enum "entry".
|
||||
// TODO(Ed): We need a CodeEnumEntry, AST_EnumEntry types
|
||||
}
|
||||
|
||||
if ( currtok.Type == Tok_Comma )
|
||||
@ -11108,6 +11134,13 @@ CodeFn parser_parse_function()
|
||||
}
|
||||
// <export> <Attributes> <Specifiers>
|
||||
|
||||
// Note(Ed): We're enforcing that using this codepath requires non-macro jank.
|
||||
// Code macro_stmt = parse_macro_as_definiton(attributes, specifiers);
|
||||
// if (macro_stmt) {
|
||||
// parser_pop(& _ctx->parser);
|
||||
// return macro_stmt;
|
||||
// }
|
||||
|
||||
CodeTypename ret_type = parser_parse_type(parser_not_from_template, nullptr);
|
||||
if ( cast(Code, ret_type) == Code_Invalid ) {
|
||||
parser_pop(& _ctx->parser);
|
||||
@ -12496,6 +12529,13 @@ CodeVar parser_parse_variable()
|
||||
}
|
||||
// <ModuleFlags> <Attributes> <Specifiers>
|
||||
|
||||
// Note(Ed): We're enforcing that using this codepath requires non-macro jank.
|
||||
// Code macro_stmt = parse_macro_as_definiton(attributes, specifiers);
|
||||
// if (macro_stmt) {
|
||||
// parser_pop(& _ctx->parser);
|
||||
// return macro_stmt;
|
||||
// }
|
||||
|
||||
CodeTypename type = parser_parse_type(parser_not_from_template, nullptr);
|
||||
// <ModuleFlags> <Attributes> <Specifiers> <ValueType>
|
||||
|
||||
|
@ -883,7 +883,7 @@ template<typename Type> mem_ptr_const to_mem_ptr_const( Type ptr ) { return (mem
|
||||
// NOTE: Things that shouldn't happen with a message!
|
||||
#define GEN_PANIC( msg, ... ) GEN_ASSERT_MSG( 0, msg, ##__VA_ARGS__ )
|
||||
|
||||
#if GEN_BULD_DEBUG
|
||||
#if GEN_BUILD_DEBUG
|
||||
#define GEN_FATAL( ... ) \
|
||||
do \
|
||||
{ \
|
||||
|
@ -640,11 +640,10 @@ FORCEINLINE bool is_trailing( Specifier specifier )
|
||||
return spec_is_trailing( specifier );
|
||||
}
|
||||
|
||||
#define GEN_DEFINE_ATTRIBUTE_TOKENS \
|
||||
Entry( Tok_Attribute_API_Export, "GEN_API_Export_Code" ) Entry( Tok_Attribute_API_Import, "GEN_API_Import_Code" ) \
|
||||
Entry( Tok_Attribute_COREUOBJECT_API, "COREUOBJECT_API" ) Entry( Tok_Attribute_ENGINE_API, "ENGINE_API" ) \
|
||||
Entry( Tok_Attribute_GAMEPLAYABILITIES_API, "GAMEPLAYABILITIES_API" ) Entry( Tok_Attribute_UMG_API, "UMG_API" ) \
|
||||
Entry( Tok_Attribute_UE_DEPRECATED, "UE_DEPRECATED" )
|
||||
#define GEN_DEFINE_ATTRIBUTE_TOKENS \
|
||||
Entry( Tok_Attribute_API_Export, "GEN_API_Export_Code" ) Entry( Tok_Attribute_API_Import, "GEN_API_Import_Code" ) \
|
||||
Entry( Tok_Attribute_COREUOBJECT_API, "COREUOBJECT_API" ) Entry( Tok_Attribute_ENGINE_API, "ENGINE_API" ) \
|
||||
Entry( Tok_Attribute_GAMEPLAYABILITIES_API, "GAMEPLAYABILITIES_API" ) Entry( Tok_Attribute_UMG_API, "UMG_API" )
|
||||
|
||||
enum TokType : u32
|
||||
{
|
||||
@ -692,6 +691,7 @@ enum TokType : u32
|
||||
Tok_Operator,
|
||||
Tok_Preprocess_Hash,
|
||||
Tok_Preprocess_Define,
|
||||
Tok_Preprocess_Define_Param,
|
||||
Tok_Preprocess_If,
|
||||
Tok_Preprocess_IfDef,
|
||||
Tok_Preprocess_IfNotDef,
|
||||
@ -752,7 +752,6 @@ enum TokType : u32
|
||||
Tok_Attribute_ENGINE_API,
|
||||
Tok_Attribute_GAMEPLAYABILITIES_API,
|
||||
Tok_Attribute_UMG_API,
|
||||
Tok_Attribute_UE_DEPRECATED,
|
||||
Tok_NumTokens
|
||||
};
|
||||
|
||||
@ -803,6 +802,7 @@ inline Str toktype_to_str( TokType type )
|
||||
{ "__operator__", sizeof( "__operator__" ) - 1 },
|
||||
{ "#", sizeof( "#" ) - 1 },
|
||||
{ "define", sizeof( "define" ) - 1 },
|
||||
{ "__define_param__", sizeof( "__define_param__" ) - 1 },
|
||||
{ "if", sizeof( "if" ) - 1 },
|
||||
{ "ifdef", sizeof( "ifdef" ) - 1 },
|
||||
{ "ifndef", sizeof( "ifndef" ) - 1 },
|
||||
@ -863,7 +863,6 @@ inline Str toktype_to_str( TokType type )
|
||||
{ "ENGINE_API", sizeof( "ENGINE_API" ) - 1 },
|
||||
{ "GAMEPLAYABILITIES_API", sizeof( "GAMEPLAYABILITIES_API" ) - 1 },
|
||||
{ "UMG_API", sizeof( "UMG_API" ) - 1 },
|
||||
{ "UE_DEPRECATED", sizeof( "UE_DEPRECATED" ) - 1 },
|
||||
};
|
||||
return lookup[type];
|
||||
}
|
||||
@ -887,7 +886,7 @@ inline TokType str_to_toktype( Str str )
|
||||
|
||||
enum TokFlags : u32
|
||||
{
|
||||
TF_Operator = bit(0),
|
||||
TF_Operator = bit(0),
|
||||
TF_Assign = bit(1),
|
||||
TF_Preprocess = bit(2),
|
||||
TF_Preprocess_Cond = bit(3),
|
||||
@ -1055,8 +1054,22 @@ enum EMacroFlags : u16
|
||||
{
|
||||
MF_Functional = bit(0), // Macro has parameters (args expected to be passed)
|
||||
MF_Expects_Body = bit(1), // Expects to assign a braced scope to its body.
|
||||
MF_Allow_As_Identifier = bit(2), // lex__eat wil treat this macro as an identifier if the parser attempts to consume it as one.
|
||||
// ^^^ This is a sort of kludge because we don't support push/pop macro programs rn. ^^^
|
||||
|
||||
// lex__eat wil treat this macro as an identifier if the parser attempts to consume it as one.
|
||||
// ^^^ This is a kludge because we don't support push/pop macro pragmas rn.
|
||||
MF_Allow_As_Identifier = bit(2),
|
||||
|
||||
// lex__eat wil treat this macro as an attribute if the parser attempts to consume it as one.
|
||||
// ^^^ This a kludge because unreal has a macro that behaves as both a 'statement' and an attribute (UE_DEPRECATED, PRAGMA_ENABLE_DEPRECATION_WARNINGS, etc)
|
||||
// TODO(Ed): We can keep the MF_Allow_As_Attribute flag for macros, however, we need to add the ability of AST_Attributes to chain themselves.
|
||||
// Its thats already a thing in the standard language anyway
|
||||
// & it would allow UE_DEPRECATED, (UE_PROPERTY / UE_FUNCTION) to chain themselves as attributes of a resolved member function/varaible definition
|
||||
MF_Allow_As_Attribute = bit(3),
|
||||
|
||||
// When a macro is encountered after attributs and specifiers while parsing a function, or variable:
|
||||
// It will consume the macro and treat it as resolving the definition. (Yes this is for Unreal Engine)
|
||||
// (MUST BE OF MT_Statement TYPE)
|
||||
MF_Allow_As_Definition = bit(4),
|
||||
|
||||
MF_Null = 0,
|
||||
MF_UnderlyingType = GEN_U16_MAX,
|
||||
@ -2741,13 +2754,14 @@ struct AST_Body
|
||||
};
|
||||
static_assert( sizeof(AST_Body) == sizeof(AST), "ERROR: AST_Body is not the same size as AST");
|
||||
|
||||
// TODO(Ed): Support chaining attributes (Use parameter linkage pattern)
|
||||
struct AST_Attributes
|
||||
{
|
||||
union {
|
||||
char _PAD_[ sizeof(Specifier) * AST_ArrSpecs_Cap + sizeof(AST*) ];
|
||||
StrCached Content;
|
||||
};
|
||||
StrCached Name;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
@ -3966,6 +3980,9 @@ GEN_API void init(Context* ctx);
|
||||
// However on Windows at least, it doesn't need to occur as the OS will clean up after the process.
|
||||
GEN_API void deinit(Context* ctx);
|
||||
|
||||
// Retrieves the active context (not usually needed, but here in case...)
|
||||
GEN_API Context* get_contex();
|
||||
|
||||
// Clears the allocations, but doesn't free the memoery, then calls init() again.
|
||||
// Ease of use.
|
||||
GEN_API void reset(Context* ctx);
|
||||
|
Reference in New Issue
Block a user