Compare commits
18 Commits
f1a4a44c8d
...
master
Author | SHA1 | Date | |
---|---|---|---|
a2bcafbec6 | |||
66a15a7a02 | |||
a4969ee266 | |||
3109ea4641 | |||
c895772cff | |||
f55e96ec6a | |||
0ad0b337b3 | |||
2cf78790db | |||
6fb7aed7e8 | |||
feea8361b5 | |||
208cc67a7f | |||
eef7709fc6 | |||
0f7c51b7b8 | |||
60a4128df4 | |||
001a542521 | |||
7e27f708cf | |||
d34201e8a1 | |||
2d625967a9 |
10
.gitignore
vendored
10
.gitignore
vendored
@ -4,11 +4,14 @@ Project/.idea
|
||||
Project/.vs
|
||||
Project/.vsconfig
|
||||
|
||||
Project/Binaries
|
||||
!Project/Binaries/Win64/*
|
||||
Project/Binaries/GasaGen.exe
|
||||
Project/Binaries/GasaGen.map
|
||||
Project/Binaries/GasaGen.obj
|
||||
Project/Binaries/vc140.pdb
|
||||
Project/Binaries/GasaGen.raddbgi
|
||||
Project/Binaries/GasaGen.rdi
|
||||
# Project/Binaries/vc140.pdb
|
||||
!Project/Binaries/GasaEditor.target
|
||||
|
||||
Project/Intermediate
|
||||
|
||||
@ -37,3 +40,6 @@ Project/Saved/SourceControl
|
||||
|
||||
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.
@ -1,3 +1,7 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CppCodeStyle/OverridingFunctionStyle/@EntryValue">Override</s:String>
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe</s:String>
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/DotNetCliExePath/@EntryValue">C:\projects\Unreal\Surgo\UE\Engine\Binaries\ThirdParty\DotNet\8.0.300\win-x64\dotnet.exe</s:String>
|
||||
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1114112</s:Int64>
|
||||
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/BuildTool/RecentDotNetCliExePaths/=C_003A_005Cprojects_005CUnreal_005CSurgo_005CUE_005CEngine_005CBinaries_005CThirdParty_005CDotNet_005C8_002E0_002E300_005Cwin_002Dx64_005Cdotnet_002Eexe/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gasa/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
@ -2,10 +2,14 @@
|
||||
"ColumnWidths":
|
||||
{
|
||||
"MaxValue": 165,
|
||||
"Description": 135,
|
||||
"Description": 303,
|
||||
"Category": 96,
|
||||
"BaseValue": 106,
|
||||
"Name": 82,
|
||||
"MinAttribute": 327
|
||||
"BaseValue": 81,
|
||||
"Name": 124,
|
||||
"MinAttribute": 84,
|
||||
"bUseMaxAttribute": 112,
|
||||
"bUseMinAttribute": 114,
|
||||
"MinValue": 73,
|
||||
"MaxAttribute": 90
|
||||
}
|
||||
}
|
@ -63,6 +63,70 @@ void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMan
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxMana, PrevMaxMana );
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_Armor( FGameplayAttributeData& PrevArmor )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Armor ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Armor, PrevArmor );
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_ArmorPenentration( FGameplayAttributeData& PrevArmorPenentration )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ArmorPenentration ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
|
||||
FGameplayAttribute( UGasaAttributeSetProperty ), ArmorPenentration, PrevArmorPenentration
|
||||
);
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_BlockChance( FGameplayAttributeData& PrevBlockChance )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, BlockChance ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
|
||||
FGameplayAttribute( UGasaAttributeSetProperty ), BlockChance, PrevBlockChance
|
||||
);
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_CriticalHitChance( FGameplayAttributeData& PrevCriticalHitChance )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitChance ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
|
||||
FGameplayAttribute( UGasaAttributeSetProperty ), CriticalHitChance, PrevCriticalHitChance
|
||||
);
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_CriticalHitDamage( FGameplayAttributeData& PrevCriticalHitDamage )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitDamage ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
|
||||
FGameplayAttribute( UGasaAttributeSetProperty ), CriticalHitDamage, PrevCriticalHitDamage
|
||||
);
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_CriticalHitResistance( FGameplayAttributeData& PrevCriticalHitResistance )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty =
|
||||
FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitResistance ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
|
||||
FGameplayAttribute( UGasaAttributeSetProperty ), CriticalHitResistance, PrevCriticalHitResistance
|
||||
);
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_HealthRegeneration( FGameplayAttributeData& PrevHealthRegeneration )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty =
|
||||
FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, HealthRegeneration ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
|
||||
FGameplayAttribute( UGasaAttributeSetProperty ), HealthRegeneration, PrevHealthRegeneration
|
||||
);
|
||||
}
|
||||
void UGasaAttributeSet::Client_OnRep_ManaRegeneration( FGameplayAttributeData& PrevManaRegeneration )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ManaRegeneration ) );
|
||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
|
||||
FGameplayAttribute( UGasaAttributeSetProperty ), ManaRegeneration, PrevManaRegeneration
|
||||
);
|
||||
}
|
||||
#pragma endregion Rep Notifies
|
||||
|
||||
void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackData const& Data )
|
||||
@ -73,7 +137,7 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
|
||||
|
||||
if ( Data.EvaluatedData.Attribute == GetHealthAttribute() )
|
||||
{
|
||||
SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) );
|
||||
SetHealth( FMath::Clamp( GetHealth(), 0, 300.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetManaAttribute() )
|
||||
{
|
||||
@ -103,8 +167,38 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
|
||||
{
|
||||
SetMaxMana( FMath::Clamp( GetMaxMana(), 0, 99999.000000 ) );
|
||||
}
|
||||
|
||||
Props.Populate( Data );
|
||||
if ( Data.EvaluatedData.Attribute == GetArmorAttribute() )
|
||||
{
|
||||
SetArmor( FMath::Clamp( GetArmor(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetArmorPenentrationAttribute() )
|
||||
{
|
||||
SetArmorPenentration( FMath::Clamp( GetArmorPenentration(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetBlockChanceAttribute() )
|
||||
{
|
||||
SetBlockChance( FMath::Clamp( GetBlockChance(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetCriticalHitChanceAttribute() )
|
||||
{
|
||||
SetCriticalHitChance( FMath::Clamp( GetCriticalHitChance(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetCriticalHitDamageAttribute() )
|
||||
{
|
||||
SetCriticalHitDamage( FMath::Clamp( GetCriticalHitDamage(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetCriticalHitResistanceAttribute() )
|
||||
{
|
||||
SetCriticalHitResistance( FMath::Clamp( GetCriticalHitResistance(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetHealthRegenerationAttribute() )
|
||||
{
|
||||
SetHealthRegeneration( FMath::Clamp( GetHealthRegeneration(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetManaRegenerationAttribute() )
|
||||
{
|
||||
SetManaRegeneration( FMath::Clamp( GetManaRegeneration(), 0, 999.000000 ) );
|
||||
}
|
||||
}
|
||||
|
||||
void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute, float& NewValue )
|
||||
@ -113,7 +207,7 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
|
||||
|
||||
if ( Attribute == GetHealthAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() );
|
||||
NewValue = FMath::Clamp( NewValue, 0, 300.000000 );
|
||||
}
|
||||
if ( Attribute == GetManaAttribute() )
|
||||
{
|
||||
@ -143,6 +237,38 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
||||
}
|
||||
if ( Attribute == GetArmorAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetArmorPenentrationAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetBlockChanceAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetCriticalHitChanceAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetCriticalHitDamageAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetCriticalHitResistanceAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetHealthRegenerationAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetManaRegenerationAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
}
|
||||
|
||||
void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& OutLifetimeProps ) const
|
||||
@ -157,4 +283,12 @@ void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& O
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Vigor );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Armor );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, ArmorPenentration );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, BlockChance );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, CriticalHitChance );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, CriticalHitDamage );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, CriticalHitResistance );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, HealthRegeneration );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, ManaRegeneration );
|
||||
}
|
||||
|
@ -35,6 +35,22 @@ public:
|
||||
FGameplayAttributeData MaxHealth;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData MaxMana;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Armor, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData Armor;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_ArmorPenentration, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData ArmorPenentration;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_BlockChance, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData BlockChance;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_CriticalHitChance, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData CriticalHitChance;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_CriticalHitDamage, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData CriticalHitDamage;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_CriticalHitResistance, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData CriticalHitResistance;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_HealthRegeneration, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData HealthRegeneration;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_ManaRegeneration, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData ManaRegeneration;
|
||||
|
||||
|
||||
UFUNCTION()
|
||||
@ -53,6 +69,22 @@ public:
|
||||
void Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Armor( FGameplayAttributeData& PrevArmor );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_ArmorPenentration( FGameplayAttributeData& PrevArmorPenentration );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_BlockChance( FGameplayAttributeData& PrevBlockChance );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_CriticalHitChance( FGameplayAttributeData& PrevCriticalHitChance );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_CriticalHitDamage( FGameplayAttributeData& PrevCriticalHitDamage );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_CriticalHitResistance( FGameplayAttributeData& PrevCriticalHitResistance );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_HealthRegeneration( FGameplayAttributeData& PrevHealthRegeneration );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_ManaRegeneration( FGameplayAttributeData& PrevManaRegeneration );
|
||||
|
||||
#pragma region Getters
|
||||
static FGameplayAttribute GetHealthAttribute()
|
||||
@ -95,6 +127,52 @@ public:
|
||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetArmorAttribute()
|
||||
{
|
||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Armor ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetArmorPenentrationAttribute()
|
||||
{
|
||||
static FProperty* Prop =
|
||||
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ArmorPenentration ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetBlockChanceAttribute()
|
||||
{
|
||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, BlockChance ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetCriticalHitChanceAttribute()
|
||||
{
|
||||
static FProperty* Prop =
|
||||
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitChance ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetCriticalHitDamageAttribute()
|
||||
{
|
||||
static FProperty* Prop =
|
||||
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitDamage ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetCriticalHitResistanceAttribute()
|
||||
{
|
||||
static FProperty* Prop =
|
||||
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitResistance ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetHealthRegenerationAttribute()
|
||||
{
|
||||
static FProperty* Prop =
|
||||
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, HealthRegeneration ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetManaRegenerationAttribute()
|
||||
{
|
||||
static FProperty* Prop =
|
||||
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ManaRegeneration ) );
|
||||
return Prop;
|
||||
}
|
||||
|
||||
FORCEINLINE float GetHealth() const { return Health.GetCurrentValue(); }
|
||||
FORCEINLINE float GetMana() const { return Mana.GetCurrentValue(); }
|
||||
@ -104,6 +182,14 @@ public:
|
||||
FORCEINLINE float GetVigor() const { return Vigor.GetCurrentValue(); }
|
||||
FORCEINLINE float GetMaxHealth() const { return MaxHealth.GetCurrentValue(); }
|
||||
FORCEINLINE float GetMaxMana() const { return MaxMana.GetCurrentValue(); }
|
||||
FORCEINLINE float GetArmor() const { return Armor.GetCurrentValue(); }
|
||||
FORCEINLINE float GetArmorPenentration() const { return ArmorPenentration.GetCurrentValue(); }
|
||||
FORCEINLINE float GetBlockChance() const { return BlockChance.GetCurrentValue(); }
|
||||
FORCEINLINE float GetCriticalHitChance() const { return CriticalHitChance.GetCurrentValue(); }
|
||||
FORCEINLINE float GetCriticalHitDamage() const { return CriticalHitDamage.GetCurrentValue(); }
|
||||
FORCEINLINE float GetCriticalHitResistance() const { return CriticalHitResistance.GetCurrentValue(); }
|
||||
FORCEINLINE float GetHealthRegeneration() const { return HealthRegeneration.GetCurrentValue(); }
|
||||
FORCEINLINE float GetManaRegeneration() const { return ManaRegeneration.GetCurrentValue(); }
|
||||
#pragma endregion Getters
|
||||
|
||||
#pragma region Setters
|
||||
@ -115,6 +201,14 @@ public:
|
||||
FORCEINLINE void SetVigor( float NewVal );
|
||||
FORCEINLINE void SetMaxHealth( float NewVal );
|
||||
FORCEINLINE void SetMaxMana( float NewVal );
|
||||
FORCEINLINE void SetArmor( float NewVal );
|
||||
FORCEINLINE void SetArmorPenentration( float NewVal );
|
||||
FORCEINLINE void SetBlockChance( float NewVal );
|
||||
FORCEINLINE void SetCriticalHitChance( float NewVal );
|
||||
FORCEINLINE void SetCriticalHitDamage( float NewVal );
|
||||
FORCEINLINE void SetCriticalHitResistance( float NewVal );
|
||||
FORCEINLINE void SetHealthRegeneration( float NewVal );
|
||||
FORCEINLINE void SetManaRegeneration( float NewVal );
|
||||
#pragma endregion Setters
|
||||
|
||||
#pragma region AttributeSet
|
||||
|
@ -77,6 +77,78 @@ void UGasaAttributeSet::SetMaxMana( float NewVal )
|
||||
AbilityComp->SetNumericAttributeBase( GetMaxManaAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetArmor( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetArmorAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetArmorPenentration( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetArmorPenentrationAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetBlockChance( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetBlockChanceAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetCriticalHitChance( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetCriticalHitChanceAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetCriticalHitDamage( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetCriticalHitDamageAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetCriticalHitResistance( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetCriticalHitResistanceAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetHealthRegeneration( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetHealthRegenerationAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetManaRegeneration( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetManaRegenerationAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
#pragma endregion Attribute Setters
|
||||
|
||||
namespace Gasa
|
||||
|
35
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxHealth.cpp
Normal file
35
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxHealth.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include "MMC_MaxHealth.h"
|
||||
|
||||
#include "AbilitySystem/GasaAttributeSet.h"
|
||||
#include "Interfaces/CombatInterface.h"
|
||||
|
||||
UMMC_MaxHealth::UMMC_MaxHealth()
|
||||
{
|
||||
VigorDef.AttributeToCapture = UGasaAttributeSet::GetVigorAttribute();
|
||||
VigorDef.AttributeSource = EGameplayEffectAttributeCaptureSource::Target;
|
||||
VigorDef.bSnapshot = false;
|
||||
|
||||
RelevantAttributesToCapture.Add( VigorDef);
|
||||
}
|
||||
|
||||
float UMMC_MaxHealth::CalculateBaseMagnitude_Implementation( FGameplayEffectSpec const& Spec ) const
|
||||
{
|
||||
// Gather tags from source and target
|
||||
FGameplayTagContainer const* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags();
|
||||
FGameplayTagContainer const* TargetTags = Spec.CapturedTargetTags.GetAggregatedTags();
|
||||
|
||||
FAggregatorEvaluateParameters EvaluationParamters;
|
||||
EvaluationParamters.SourceTags = SourceTags;
|
||||
EvaluationParamters.TargetTags = TargetTags;
|
||||
|
||||
float Vigor = 0.f;
|
||||
GetCapturedAttributeMagnitude(VigorDef, Spec, EvaluationParamters, Vigor);
|
||||
Vigor = FMath::Max(Vigor, 0.f);
|
||||
|
||||
ICombat* Combat = Cast<ICombat>(Spec.GetContext().GetSourceObject());
|
||||
int32 PlayerLevel = Combat->GetPlayerLevel();
|
||||
|
||||
float Calculation = 80.f + 2.5 * Vigor + 10.f * PlayerLevel;
|
||||
return Calculation;
|
||||
}
|
||||
|
19
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxHealth.h
Normal file
19
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxHealth.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "GameplayModMagnitudeCalculation.h"
|
||||
|
||||
#include "MMC_MaxHealth.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class GASA_API UMMC_MaxHealth : public UGameplayModMagnitudeCalculation
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UMMC_MaxHealth();
|
||||
|
||||
FGameplayEffectAttributeCaptureDefinition VigorDef;
|
||||
|
||||
float CalculateBaseMagnitude_Implementation( FGameplayEffectSpec const& Spec ) const override;
|
||||
};
|
34
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxMana.cpp
Normal file
34
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxMana.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "MMC_MaxMana.h"
|
||||
|
||||
#include "AbilitySystem/GasaAttributeSet.h"
|
||||
#include "Interfaces/CombatInterface.h"
|
||||
|
||||
UMMC_MaxMana::UMMC_MaxMana()
|
||||
{
|
||||
IntelligenceDef.AttributeToCapture = UGasaAttributeSet::GetVigorAttribute();
|
||||
IntelligenceDef.AttributeSource = EGameplayEffectAttributeCaptureSource::Target;
|
||||
IntelligenceDef.bSnapshot = false;
|
||||
|
||||
RelevantAttributesToCapture.Add( IntelligenceDef);
|
||||
}
|
||||
|
||||
float UMMC_MaxMana::CalculateBaseMagnitude_Implementation( FGameplayEffectSpec const& Spec ) const
|
||||
{
|
||||
// Gather tags from source and target
|
||||
FGameplayTagContainer const* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags();
|
||||
FGameplayTagContainer const* TargetTags = Spec.CapturedTargetTags.GetAggregatedTags();
|
||||
|
||||
FAggregatorEvaluateParameters EvaluationParamters;
|
||||
EvaluationParamters.SourceTags = SourceTags;
|
||||
EvaluationParamters.TargetTags = TargetTags;
|
||||
|
||||
float Intelligence = 0.f;
|
||||
GetCapturedAttributeMagnitude(IntelligenceDef, Spec, EvaluationParamters, Intelligence);
|
||||
Intelligence = FMath::Max(Intelligence, 0.f);
|
||||
|
||||
ICombat* Combat = Cast<ICombat>(Spec.GetContext().GetSourceObject()); check(Combat);
|
||||
int32 PlayerLevel = Combat->GetPlayerLevel();
|
||||
|
||||
float Calculation = 50.f + 2.5 * Intelligence + 15.f * PlayerLevel;
|
||||
return Calculation;
|
||||
}
|
19
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxMana.h
Normal file
19
Project/Source/Gasa/AbilitySystem/MMC/MMC_MaxMana.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "GameplayModMagnitudeCalculation.h"
|
||||
|
||||
#include "MMC_MaxMana.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class GASA_API UMMC_MaxMana : public UGameplayModMagnitudeCalculation
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UMMC_MaxMana();
|
||||
|
||||
FGameplayEffectAttributeCaptureDefinition IntelligenceDef;
|
||||
|
||||
float CalculateBaseMagnitude_Implementation( FGameplayEffectSpec const& Spec ) const override;
|
||||
};
|
@ -6,4 +6,13 @@ AEnemyCharacter::AEnemyCharacter()
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
|
||||
bAutoAbilitySystem = true;
|
||||
|
||||
PlayerLevel = 1;
|
||||
}
|
||||
|
||||
#pragma region ICombat
|
||||
int32 AEnemyCharacter::GetPlayerLevel()
|
||||
{
|
||||
return PlayerLevel;
|
||||
}
|
||||
#pragma endregion ICombat
|
||||
|
@ -10,4 +10,11 @@ class GASA_API AEnemyCharacter : public AGasaCharacter
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
AEnemyCharacter();
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay")
|
||||
int32 PlayerLevel;
|
||||
|
||||
#pragma region ICombat
|
||||
int32 GetPlayerLevel() override;
|
||||
#pragma endregion ICombat
|
||||
};
|
||||
|
@ -65,14 +65,28 @@ AGasaCharacter::AGasaCharacter()
|
||||
}
|
||||
|
||||
#pragma region Ability System
|
||||
void AGasaCharacter::ApplyEffectToSelf(TSubclassOf<UGameplayEffect> GE, float Level)
|
||||
{
|
||||
UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
|
||||
ensure(ASC);
|
||||
ensure(GE);
|
||||
FGameplayEffectContextHandle Context = ASC->MakeEffectContext(); Context.AddSourceObject(this);
|
||||
FGameplayEffectSpecHandle Spec = ASC->MakeOutgoingSpec(GE, Level, Context );
|
||||
ASC->ApplyGameplayEffectSpecToTarget( * Spec.Data, ASC );
|
||||
}
|
||||
|
||||
void AGasaCharacter::InitDefaultAttributes()
|
||||
{
|
||||
UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
|
||||
ensure(ASC);
|
||||
|
||||
ensure(DefaultVitalAttributes);
|
||||
ensure(DefaultPrimaryAttributes);
|
||||
ensure(DefaultSecondaryAttributes);
|
||||
|
||||
FGameplayEffectContextHandle Context = ASC->MakeEffectContext();
|
||||
Context.AddSourceObject(this);
|
||||
|
||||
FGameplayEffectSpecHandle SpecPrimary = ASC->MakeOutgoingSpec(DefaultPrimaryAttributes, 1.0f, Context );
|
||||
FGameplayEffectSpecHandle SpecSecondary = ASC->MakeOutgoingSpec(DefaultSecondaryAttributes, 1.0f, Context );
|
||||
FGameplayEffectSpecHandle SpecVital = ASC->MakeOutgoingSpec(DefaultVitalAttributes, 1.0f, Context );
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "GasaCommon.h"
|
||||
#include "Game/GasaGameState.h"
|
||||
#include "Interfaces/CombatInterface.h"
|
||||
#include "Networking/GasaNetLibrary.h"
|
||||
|
||||
#include "GasaCharacter.generated.h"
|
||||
@ -19,6 +20,7 @@ enum class EHighlight : uint8
|
||||
UCLASS(Abstract)
|
||||
class GASA_API AGasaCharacter : public ACharacter
|
||||
, public IAbilitySystemInterface
|
||||
, public ICombat
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
@ -44,6 +46,9 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Ability System")
|
||||
TSubclassOf<UGameplayEffect> DefaultSecondaryAttributes;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void ApplyEffectToSelf(TSubclassOf<UGameplayEffect> GE, float Level);
|
||||
|
||||
void InitDefaultAttributes();
|
||||
#pragma endregion Ability System
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "PlayerCharacter.h"
|
||||
#include "PlayerCharacter.h"
|
||||
|
||||
#include "Networking/GasaNetLibrary_Inlines.h"
|
||||
#include "AbilitySystemComponent.h"
|
||||
@ -13,6 +13,14 @@ APlayerCharacter::APlayerCharacter()
|
||||
bAutoAbilitySystem = false;
|
||||
}
|
||||
|
||||
#pragma region ICombat
|
||||
int32 APlayerCharacter::GetPlayerLevel()
|
||||
{
|
||||
return GetPlayerState<AGasaPlayerState>()->PlayerLevel;
|
||||
}
|
||||
#pragma endregion ICombat
|
||||
|
||||
#pragma region Pawn
|
||||
void APlayerCharacter::PossessedBy(AController* NewController)
|
||||
{
|
||||
Super::PossessedBy(NewController);
|
||||
@ -22,3 +30,4 @@ void APlayerCharacter::OnRep_PlayerState()
|
||||
{
|
||||
Super::OnRep_PlayerState();
|
||||
}
|
||||
#pragma endregion Pawn
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "GasaCharacter.h"
|
||||
|
||||
@ -12,6 +12,10 @@ public:
|
||||
|
||||
APlayerCharacter();
|
||||
|
||||
#pragma region ICombat
|
||||
int32 GetPlayerLevel() override;
|
||||
#pragma endregion ICombat
|
||||
|
||||
#pragma region Pawn
|
||||
void PossessedBy(AController* NewController) override;
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "GasaPlayerState.h"
|
||||
#include "GasaPlayerState.h"
|
||||
|
||||
#include "Net/UnrealNetwork.h"
|
||||
|
||||
#include "Networking/GasaNetLibrary_Inlines.h"
|
||||
#include "GasaGameInstance.h"
|
||||
@ -10,6 +12,8 @@ AGasaPlayerState::AGasaPlayerState()
|
||||
{
|
||||
bAutoAbilitySystem = true;
|
||||
|
||||
PlayerLevel = 1;
|
||||
|
||||
AbilitySystem = CreateDefaultSubobject<UGasaAbilitySystemComp>("Ability System");
|
||||
AbilitySystem->SetIsReplicated(true);
|
||||
AbilitySystem->SetReplicationMode(EGameplayEffectReplicationMode::Mixed);
|
||||
@ -20,6 +24,11 @@ AGasaPlayerState::AGasaPlayerState()
|
||||
NetUpdateFrequency = 100.f;
|
||||
}
|
||||
|
||||
void AGasaPlayerState::Client_OnRep_Level(int32 OldPlayerLevel)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#pragma region GameFramework
|
||||
void AGasaPlayerState::OnGameFrameworkInitialized()
|
||||
{
|
||||
@ -87,6 +96,6 @@ void AGasaPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& Out
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||
|
||||
|
||||
DOREPLIFETIME(AGasaPlayerState, PlayerLevel);
|
||||
}
|
||||
#pragma endregion UObject
|
||||
|
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "AbilitySystemInterface.h"
|
||||
@ -17,6 +17,12 @@ class GASA_API AGasaPlayerState : public APlayerState
|
||||
public:
|
||||
AGasaPlayerState();
|
||||
|
||||
UPROPERTY(EditAnywhere, ReplicatedUsing="Client_OnRep_Level", Category="Gameplay")
|
||||
int32 PlayerLevel;
|
||||
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Level(int32 OldLevel);
|
||||
|
||||
#pragma region Ability System
|
||||
UPROPERTY(EditAnywhere, Category="Ability System")
|
||||
bool bAutoAbilitySystem;
|
||||
|
@ -26,9 +26,11 @@ 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()
|
||||
|
6
Project/Source/Gasa/Interfaces/CombatInterface.cpp
Normal file
6
Project/Source/Gasa/Interfaces/CombatInterface.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include "CombatInterface.h"
|
||||
|
||||
int32 ICombat::GetPlayerLevel()
|
||||
{
|
||||
return 0;
|
||||
}
|
20
Project/Source/Gasa/Interfaces/CombatInterface.h
Normal file
20
Project/Source/Gasa/Interfaces/CombatInterface.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "UObject/Interface.h"
|
||||
|
||||
#include "CombatInterface.generated.h"
|
||||
|
||||
|
||||
UINTERFACE(MinimalAPI)
|
||||
class UCombat : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
class GASA_API ICombat
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual int32 GetPlayerLevel();
|
||||
};
|
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,3 +1,4 @@
|
||||
using UnrealBuildTool;
|
||||
using ModuleRules = UnrealBuildTool.ModuleRules;
|
||||
using ReadOnlyTargetRules = UnrealBuildTool.ReadOnlyTargetRules;
|
||||
|
||||
@ -6,12 +7,15 @@ public class GasaEditor : ModuleRules
|
||||
public GasaEditor(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
#region Engine
|
||||
PrivateIncludePathModuleNames.AddRange(new string[] {
|
||||
|
||||
PrivateIncludePathModuleNames.AddRange(new string[]
|
||||
{
|
||||
"Core",
|
||||
"CoreUObject",
|
||||
"Engine",
|
||||
});
|
||||
PrivateDependencyModuleNames.AddRange(new string[] {
|
||||
PrivateDependencyModuleNames.AddRange(new string[]
|
||||
{
|
||||
"Core",
|
||||
"Engine",
|
||||
"CoreUObject",
|
||||
@ -22,21 +26,25 @@ public class GasaEditor : ModuleRules
|
||||
"UMG",
|
||||
"UnrealEd",
|
||||
});
|
||||
|
||||
#endregion Engine
|
||||
|
||||
PublicIncludePaths.Add("GasaEditor");
|
||||
PrivateDependencyModuleNames.Add("Gasa");
|
||||
|
||||
bWarningsAsErrors = false;
|
||||
ShadowVariableWarningLevel = UnrealBuildTool.WarningLevel.Warning;
|
||||
UndefinedIdentifierWarningLevel = UnrealBuildTool.WarningLevel.Warning;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "GasaGen_AttributeSets.h"
|
||||
#include "AttributeSets.h"
|
||||
#include "GasaGen_Common.h"
|
||||
|
||||
#include "Gasa/AbilitySystem/GasaAbilitySystem.h"
|
||||
@ -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") );
|
||||
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
|
||||
{
|
279
Project/Source/GasaEditor/GasaGen/ChangeBPActionMenu.cpp
Normal file
279
Project/Source/GasaEditor/GasaGen/ChangeBPActionMenu.cpp
Normal file
@ -0,0 +1,279 @@
|
||||
// Used in the GasaGen.cpp translation unit
|
||||
#include "ChangeBPActionMenu.h"
|
||||
#include "GasaGen_Common.h"
|
||||
|
||||
constexpr Str SBlueprintActionMenu_Construct_Replacement = txt(R"(
|
||||
void SBlueprintActionMenu::Construct( const FArguments& InArgs, TSharedPtr<FBlueprintEditor> InEditor )
|
||||
{
|
||||
bActionExecuted = false;
|
||||
|
||||
this->GraphObj = InArgs._GraphObj;
|
||||
this->DraggedFromPins = InArgs._DraggedFromPins;
|
||||
this->NewNodePosition = InArgs._NewNodePosition;
|
||||
this->OnClosedCallback = InArgs._OnClosedCallback;
|
||||
this->bAutoExpandActionMenu = InArgs._AutoExpandActionMenu;
|
||||
this->EditorPtr = InEditor;
|
||||
this->OnCloseReasonCallback = InArgs._OnCloseReason;
|
||||
|
||||
// Generate the context display; showing the user what they're picking something for
|
||||
//@TODO: Should probably be somewhere more schema-sensitive than the graph panel!
|
||||
FSlateColor TypeColor;
|
||||
FString TypeOfDisplay;
|
||||
const FSlateBrush* ContextIcon = nullptr;
|
||||
|
||||
if (DraggedFromPins.Num() == 1)
|
||||
{
|
||||
UEdGraphPin* OnePin = DraggedFromPins[0];
|
||||
|
||||
const UEdGraphSchema* Schema = OnePin->GetSchema();
|
||||
const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
|
||||
|
||||
if (!Schema->IsA(UEdGraphSchema_K2::StaticClass()) || !K2Schema->IsExecPin(*OnePin))
|
||||
{
|
||||
// Get the type color and icon
|
||||
TypeColor = Schema->GetPinTypeColor(OnePin->PinType);
|
||||
ContextIcon = FAppStyle::GetBrush( OnePin->PinType.IsArray() ? TEXT("Graph.ArrayPin.Connected") : TEXT("Graph.Pin.Connected") );
|
||||
}
|
||||
}
|
||||
|
||||
FBlueprintActionContext MenuContext;
|
||||
ConstructActionContext(MenuContext);
|
||||
|
||||
TSharedPtr<SWidget> AddImportTargetContent = SNullWidget::NullWidget;
|
||||
if (GetDefault<UBlueprintEditorSettings>()->bEnableNamespaceImportingFeatures)
|
||||
{
|
||||
SAssignNew(AddImportTargetContent, SBox)
|
||||
.ToolTipText(LOCTEXT("ImportActionLabelTooltip", "Choose a namespace to import and load additional actions."))
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(LOCTEXT("ImportActionButtonLabel", "Import Actions From:"))
|
||||
]
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
.Padding(4.f, 0.f)
|
||||
[
|
||||
SNew(SBlueprintNamespaceEntry)
|
||||
.AllowTextEntry(false)
|
||||
.OnNamespaceSelected(this, &SBlueprintActionMenu::OnNamespaceSelectedForImport)
|
||||
.OnGetNamespacesToExclude(this, &SBlueprintActionMenu::OnGetNamespacesToExcludeFromImportMenu)
|
||||
.ExcludedNamespaceTooltipText(LOCTEXT("CannotSelectNamespaceForImport", "This namespace has already been imported by this Blueprint."))
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
TSharedPtr<SComboButton> TargetContextSubMenuButton;
|
||||
// @TODO: would be nice if we could use a checkbox style for this, and have a different state for open/closed
|
||||
SAssignNew(TargetContextSubMenuButton, SComboButton)
|
||||
.MenuPlacement(MenuPlacement_MenuRight)
|
||||
.HasDownArrow(false)
|
||||
.ButtonStyle(FAppStyle::Get(), "BlueprintEditor.ContextMenu.TargetsButton")
|
||||
.ContentPadding(FMargin(5))
|
||||
.MenuContent()
|
||||
[
|
||||
SAssignNew(ContextTargetSubMenu, SBlueprintContextTargetMenu, MenuContext)
|
||||
.OnTargetMaskChanged(this, &SBlueprintActionMenu::OnContextTargetsChanged)
|
||||
.CustomTargetContent()
|
||||
[
|
||||
AddImportTargetContent.ToSharedRef()
|
||||
]
|
||||
];
|
||||
|
||||
// Build the widget layout
|
||||
TSharedRef<SBox> ContentBox = SNew(SBox);
|
||||
{
|
||||
TSharedRef<SVerticalBox> VBox = SNew(SVerticalBox);
|
||||
{
|
||||
SVerticalBox::FSlot::FSlotArguments
|
||||
SearchIndicator = SVerticalBox::Slot();
|
||||
{
|
||||
TSharedRef<SHorizontalBox> HBox = SNew(SHorizontalBox);
|
||||
{
|
||||
SHorizontalBox::FSlot::FSlotArguments
|
||||
TypePill = SHorizontalBox::Slot();
|
||||
{
|
||||
TSharedRef<SImage> PillImage = SNew(SImage);
|
||||
{
|
||||
SImage::FArguments Args;
|
||||
Args.Visibility(this, & SBlueprintActionMenu::GetTypeImageVisibility);
|
||||
PillImage->SetColorAndOpacity(TypeColor);
|
||||
PillImage->SetImage(ContextIcon);
|
||||
PillImage->Construct(Args);
|
||||
}
|
||||
SHorizontalBox::FSlot* Slot; TypePill.Expose(Slot);
|
||||
TypePill.AutoWidth();
|
||||
TypePill.VAlign(VAlign_Center);
|
||||
TypePill.Padding( FMargin(0.f, 0.f, (ContextIcon != nullptr) ? 5.f : 0.f, 0.f));
|
||||
TypePill.AttachWidget(PillImage);
|
||||
}
|
||||
|
||||
SHorizontalBox::FSlot::FSlotArguments
|
||||
SearchContextDescription = SHorizontalBox::Slot();
|
||||
{
|
||||
TSharedRef<STextBlock> TextBlock = SNew(STextBlock);
|
||||
{
|
||||
STextBlock::FArguments Args;
|
||||
Args.Text(this, & SBlueprintActionMenu::GetSearchContextDesc);
|
||||
Args.Font(FAppStyle::GetFontStyle(FName("BlueprintEditor.ActionMenu.ContextDescriptionFont")));
|
||||
Args.ToolTip(IDocumentation::Get()->CreateToolTip(
|
||||
LOCTEXT("BlueprintActionMenuContextTextTooltip", "Describes the current context of the action list"),
|
||||
NULL,
|
||||
TEXT("Shared/Editors/BlueprintEditor"),
|
||||
TEXT("BlueprintActionMenuContextText")));
|
||||
Args.AutoWrapText(true);
|
||||
TextBlock->Construct(Args);
|
||||
}
|
||||
SearchContextDescription.FillWidth(1.f);
|
||||
SearchContextDescription.VAlign(VAlign_Center);
|
||||
SearchContextDescription.AttachWidget(TextBlock);
|
||||
}
|
||||
|
||||
SHorizontalBox::FSlot::FSlotArguments
|
||||
ContextToggle = SHorizontalBox::Slot();
|
||||
{
|
||||
TSharedRef<SCheckBox> CheckBox = SNew(SCheckBox);
|
||||
{
|
||||
SCheckBox::FArguments Args;
|
||||
Args.OnCheckStateChanged(this, & SBlueprintActionMenu::OnContextToggleChanged);
|
||||
Args.IsChecked(this, & SBlueprintActionMenu::ContextToggleIsChecked);
|
||||
Args.ToolTip(IDocumentation::Get()->CreateToolTip(
|
||||
LOCTEXT("BlueprintActionMenuContextToggleTooltip"
|
||||
, "Should the list be filtered to only actions that make sense in the current context?"),
|
||||
NULL,
|
||||
TEXT("Shared/Editors/BlueprintEditor"),
|
||||
TEXT("BlueprintActionMenuContextToggle")));
|
||||
Args.Content().SlotContent.Widget = SNew(STextBlock)
|
||||
.Text(LOCTEXT("BlueprintActionMenuContextToggle", "Context Sensitive"));
|
||||
CheckBox->Construct(Args);
|
||||
}
|
||||
ContextToggle.HAlign(HAlign_Right);
|
||||
ContextToggle.VAlign(VAlign_Center);
|
||||
ContextToggle.AutoWidth();
|
||||
ContextToggle.AttachWidget( CheckBox );
|
||||
}
|
||||
|
||||
SHorizontalBox::FSlot::FSlotArguments
|
||||
ContextButton = SHorizontalBox::Slot();
|
||||
{
|
||||
ContextButton.HAlign(HAlign_Right);
|
||||
ContextButton.VAlign(VAlign_Center);
|
||||
ContextButton.AutoWidth();
|
||||
ContextButton.Padding( FMargin( 3.f, 0.f, 0.f, 0.f ));
|
||||
ContextButton.AttachWidget( TargetContextSubMenuButton.ToSharedRef() );
|
||||
}
|
||||
|
||||
SHorizontalBox::FArguments Args = SHorizontalBox::FArguments();
|
||||
Args.operator+( TypePill );
|
||||
Args.operator+( SearchContextDescription );
|
||||
Args.operator+( ContextToggle );
|
||||
Args.operator+( ContextButton );
|
||||
HBox->Construct(Args);
|
||||
}
|
||||
|
||||
SearchIndicator.AutoHeight();
|
||||
SearchIndicator.Padding( FMargin(2, 2, 2, 5));
|
||||
SearchIndicator.AttachWidget(HBox);
|
||||
}
|
||||
|
||||
SVerticalBox::FSlot::FSlotArguments
|
||||
ActionList = SVerticalBox::Slot();
|
||||
{
|
||||
SAssignNew( GraphActionMenu, SGraphActionMenu);
|
||||
|
||||
SGraphActionMenu::FArguments Args;
|
||||
Args.OnActionSelected(this, &SBlueprintActionMenu::OnActionSelected);
|
||||
Args.OnCreateWidgetForAction(SGraphActionMenu::FOnCreateWidgetForAction::CreateSP(this, &SBlueprintActionMenu::OnCreateWidgetForAction));
|
||||
Args.OnGetActionList(this, &SBlueprintActionMenu::OnGetActionList);
|
||||
Args.OnCreateCustomRowExpander_Static(&CreateCustomBlueprintActionExpander);
|
||||
Args.DraggedFromPins(DraggedFromPins);
|
||||
Args.GraphObj(GraphObj);
|
||||
GraphActionMenu->Construct(Args);
|
||||
|
||||
ActionList.AttachWidget( GraphActionMenu.ToSharedRef() );
|
||||
}
|
||||
|
||||
SVerticalBox::FSlot::FSlotArguments
|
||||
ProgressBar = SVerticalBox::Slot();
|
||||
{
|
||||
TSharedRef<SBox> Box = SNew(SBox);
|
||||
{
|
||||
TSharedRef<SProgressBar> Bar = SNew(SProgressBar);
|
||||
{
|
||||
Bar->SetBorderPadding(FVector2D( 0, 0 ));
|
||||
Bar->SetPercent( TAttribute<TOptional<float>>::CreateLambda([this]()
|
||||
{
|
||||
return ContextMenuBuilder.IsValid() ? ContextMenuBuilder->GetPendingActionsProgress() : 0.0f;
|
||||
}));
|
||||
}
|
||||
Box->SetContent( Bar );
|
||||
Box->SetHeightOverride(2);
|
||||
Box->SetVisibility(TAttribute<EVisibility>().CreateLambda([this]()
|
||||
{
|
||||
return ContextMenuBuilder.IsValid() && ContextMenuBuilder->GetNumPendingActions() > 0 ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed;
|
||||
}));
|
||||
}
|
||||
ProgressBar.AutoHeight();
|
||||
ProgressBar.AttachWidget(Box);
|
||||
}
|
||||
|
||||
SVerticalBox::FArguments Args;
|
||||
Args.operator+( SearchIndicator );
|
||||
Args.operator+( ActionList );
|
||||
Args.operator+( ProgressBar );
|
||||
VBox->Construct( Args );
|
||||
}
|
||||
|
||||
ContentBox->SetMaxDesiredWidth(500.f);
|
||||
ContentBox->SetMaxDesiredHeight(650.f);
|
||||
ContentBox->SetContent( VBox );
|
||||
|
||||
SBorder::FArguments Args;
|
||||
Args.BorderImage(FAppStyle::GetBrush("Menu.Background"));
|
||||
Args.Padding(5.0f);
|
||||
Args.operator[](ContentBox);
|
||||
SBorder::Construct(Args);
|
||||
}
|
||||
})");
|
||||
|
||||
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( 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(CT_Global_Body);
|
||||
for ( Code code : parsed_SBlueprintActionMenu )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
case CT_Function:
|
||||
CodeFn function_def = cast(CodeFn, code);
|
||||
|
||||
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 );
|
||||
log_fmt("Swapped: %S", function_def->Name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
changed_SBlueprintActionMenu.append(code);
|
||||
}
|
||||
log_fmt("\n");
|
||||
|
||||
Builder SBlueprintActionMenu_Changed = Builder::open(path_SBlueprintActionMenuCpp);
|
||||
SBlueprintActionMenu_Changed.print( def_comment(txt("This file was regenerated by GasaGen/ChangeBPActionMenu.cpp")));
|
||||
SBlueprintActionMenu_Changed.print(changed_SBlueprintActionMenu);
|
||||
SBlueprintActionMenu_Changed.write();
|
||||
format_file(path_SBlueprintActionMenuCpp, false);
|
||||
}
|
3
Project/Source/GasaEditor/GasaGen/ChangeBPActionMenu.h
Normal file
3
Project/Source/GasaEditor/GasaGen/ChangeBPActionMenu.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void change_SBlueprintActionMenu_Construct();
|
724
Project/Source/GasaEditor/GasaGen/ChangeEditorContentList.cpp
Normal file
724
Project/Source/GasaEditor/GasaGen/ChangeEditorContentList.cpp
Normal file
@ -0,0 +1,724 @@
|
||||
#include "ChangeEditorContentList.h"
|
||||
|
||||
#include "GasaGen_Common.h"
|
||||
#include "GasaEditorCommon.h"
|
||||
|
||||
constexpr Str SAssetView_Construct_Replacement = txt(R"(
|
||||
void SAssetView::Construct( const FArguments& InArgs )
|
||||
{
|
||||
ViewCorrelationGuid = FGuid::NewGuid();
|
||||
|
||||
InitialNumAmortizedTasks = 0;
|
||||
TotalAmortizeTime = 0;
|
||||
AmortizeStartTime = 0;
|
||||
MaxSecondsPerFrame = 0.015f;
|
||||
|
||||
bFillEmptySpaceInTileView = InArgs._FillEmptySpaceInTileView;
|
||||
FillScale = 1.0f;
|
||||
|
||||
bShowRedirectors = InArgs._ShowRedirectors;
|
||||
bLastShowRedirectors = bShowRedirectors.Get(false);
|
||||
|
||||
ThumbnailHintFadeInSequence.JumpToStart();
|
||||
ThumbnailHintFadeInSequence.AddCurve(0, 0.5f, ECurveEaseFunction::Linear);
|
||||
|
||||
UContentBrowserDataSubsystem* ContentBrowserData = IContentBrowserDataModule::Get().GetSubsystem();
|
||||
ContentBrowserData->OnItemDataUpdated().AddSP(this, &SAssetView::HandleItemDataUpdated);
|
||||
ContentBrowserData->OnItemDataRefreshed().AddSP(this, &SAssetView::RequestSlowFullListRefresh);
|
||||
ContentBrowserData->OnItemDataDiscoveryComplete().AddSP(this, &SAssetView::HandleItemDataDiscoveryComplete);
|
||||
FilterCacheID.Initialaze(ContentBrowserData);
|
||||
|
||||
FCollectionManagerModule& CollectionManagerModule = FCollectionManagerModule::GetModule();
|
||||
CollectionManagerModule.Get().OnAssetsAddedToCollection().AddSP( this, &SAssetView::OnAssetsAddedToCollection );
|
||||
CollectionManagerModule.Get().OnAssetsRemovedFromCollection().AddSP( this, &SAssetView::OnAssetsRemovedFromCollection );
|
||||
CollectionManagerModule.Get().OnCollectionRenamed().AddSP( this, &SAssetView::OnCollectionRenamed );
|
||||
CollectionManagerModule.Get().OnCollectionUpdated().AddSP( this, &SAssetView::OnCollectionUpdated );
|
||||
|
||||
// Listen for when view settings are changed
|
||||
UContentBrowserSettings::OnSettingChanged().AddSP(this, &SAssetView::HandleSettingChanged);
|
||||
|
||||
ThumbnailSize = InArgs._InitialThumbnailSize;
|
||||
|
||||
// Get desktop metrics
|
||||
FDisplayMetrics DisplayMetrics;
|
||||
FSlateApplication::Get().GetCachedDisplayMetrics( DisplayMetrics );
|
||||
|
||||
const FIntPoint DisplaySize(
|
||||
DisplayMetrics.PrimaryDisplayWorkAreaRect.Right - DisplayMetrics.PrimaryDisplayWorkAreaRect.Left,
|
||||
DisplayMetrics.PrimaryDisplayWorkAreaRect.Bottom - DisplayMetrics.PrimaryDisplayWorkAreaRect.Top );
|
||||
|
||||
ThumbnailScaleRangeScalar = (float)DisplaySize.Y / 2160.f;
|
||||
|
||||
// Use the shared ThumbnailPool for the rendering of thumbnails
|
||||
AssetThumbnailPool = UThumbnailManager::Get().GetSharedThumbnailPool();
|
||||
NumOffscreenThumbnails = 128;
|
||||
ListViewThumbnailResolution = 128;
|
||||
ListViewThumbnailSize = 32;
|
||||
ListViewThumbnailPadding = 2;
|
||||
TileViewThumbnailResolution = 256;
|
||||
|
||||
// Max Size for the thumbnail
|
||||
#if UE_CONTENTBROWSER_NEW_STYLE
|
||||
constexpr int32 MaxTileViewThumbnailSize = 160;
|
||||
#else
|
||||
constexpr int32 MaxTileViewThumbnailSize = 150;
|
||||
#endif
|
||||
|
||||
TileViewThumbnailSize = MaxTileViewThumbnailSize;
|
||||
|
||||
TileViewThumbnailPadding = 9;
|
||||
|
||||
TileViewNameHeight = 50;
|
||||
|
||||
UpdateThumbnailSizeValue();
|
||||
MinThumbnailScale = 0.1f * ThumbnailScaleRangeScalar;
|
||||
MaxThumbnailScale = 1.9f * ThumbnailScaleRangeScalar;
|
||||
|
||||
bCanShowClasses = InArgs._CanShowClasses;
|
||||
|
||||
bCanShowFolders = InArgs._CanShowFolders;
|
||||
|
||||
bCanShowReadOnlyFolders = InArgs._CanShowReadOnlyFolders;
|
||||
|
||||
bFilterRecursivelyWithBackendFilter = InArgs._FilterRecursivelyWithBackendFilter;
|
||||
|
||||
bCanShowRealTimeThumbnails = InArgs._CanShowRealTimeThumbnails;
|
||||
|
||||
bCanShowDevelopersFolder = InArgs._CanShowDevelopersFolder;
|
||||
|
||||
bCanShowFavorites = InArgs._CanShowFavorites;
|
||||
bCanDockCollections = InArgs._CanDockCollections;
|
||||
|
||||
SelectionMode = InArgs._SelectionMode;
|
||||
|
||||
bShowPathInColumnView = InArgs._ShowPathInColumnView;
|
||||
bShowTypeInColumnView = InArgs._ShowTypeInColumnView;
|
||||
bSortByPathInColumnView = bShowPathInColumnView && InArgs._SortByPathInColumnView;
|
||||
bShowTypeInTileView = InArgs._ShowTypeInTileView;
|
||||
bForceShowEngineContent = InArgs._ForceShowEngineContent;
|
||||
bForceShowPluginContent = InArgs._ForceShowPluginContent;
|
||||
bForceHideScrollbar = InArgs._ForceHideScrollbar;
|
||||
bShowDisallowedAssetClassAsUnsupportedItems = InArgs._ShowDisallowedAssetClassAsUnsupportedItems;
|
||||
|
||||
bPendingUpdateThumbnails = false;
|
||||
bShouldNotifyNextAssetSync = true;
|
||||
CurrentThumbnailSize = TileViewThumbnailSize;
|
||||
|
||||
SourcesData = InArgs._InitialSourcesData;
|
||||
BackendFilter = InArgs._InitialBackendFilter;
|
||||
|
||||
FrontendFilters = InArgs._FrontendFilters;
|
||||
if (FrontendFilters.IsValid())
|
||||
{
|
||||
FrontendFilters->OnChanged().AddSP(this, &SAssetView::OnFrontendFiltersChanged);
|
||||
}
|
||||
TextFilter = InArgs._TextFilter;
|
||||
if (TextFilter.IsValid())
|
||||
{
|
||||
TextFilter->OnChanged().AddSP(this, &SAssetView::OnFrontendFiltersChanged);
|
||||
}
|
||||
|
||||
OnShouldFilterAsset = InArgs._OnShouldFilterAsset;
|
||||
OnShouldFilterItem = InArgs._OnShouldFilterItem;
|
||||
|
||||
OnNewItemRequested = InArgs._OnNewItemRequested;
|
||||
OnItemSelectionChanged = InArgs._OnItemSelectionChanged;
|
||||
OnItemsActivated = InArgs._OnItemsActivated;
|
||||
OnGetItemContextMenu = InArgs._OnGetItemContextMenu;
|
||||
OnItemRenameCommitted = InArgs._OnItemRenameCommitted;
|
||||
OnAssetTagWantsToBeDisplayed = InArgs._OnAssetTagWantsToBeDisplayed;
|
||||
OnIsAssetValidForCustomToolTip = InArgs._OnIsAssetValidForCustomToolTip;
|
||||
OnGetCustomAssetToolTip = InArgs._OnGetCustomAssetToolTip;
|
||||
OnVisualizeAssetToolTip = InArgs._OnVisualizeAssetToolTip;
|
||||
OnAssetToolTipClosing = InArgs._OnAssetToolTipClosing;
|
||||
OnGetCustomSourceAssets = InArgs._OnGetCustomSourceAssets;
|
||||
HighlightedText = InArgs._HighlightedText;
|
||||
ThumbnailLabel = InArgs._ThumbnailLabel;
|
||||
AllowThumbnailHintLabel = InArgs._AllowThumbnailHintLabel;
|
||||
InitialCategoryFilter = InArgs._InitialCategoryFilter;
|
||||
AssetShowWarningText = InArgs._AssetShowWarningText;
|
||||
bAllowDragging = InArgs._AllowDragging;
|
||||
bAllowFocusOnSync = InArgs._AllowFocusOnSync;
|
||||
HiddenColumnNames = DefaultHiddenColumnNames = InArgs._HiddenColumnNames;
|
||||
CustomColumns = InArgs._CustomColumns;
|
||||
OnSearchOptionsChanged = InArgs._OnSearchOptionsChanged;
|
||||
bShowPathViewFilters = InArgs._bShowPathViewFilters;
|
||||
OnExtendAssetViewOptionsMenuContext = InArgs._OnExtendAssetViewOptionsMenuContext;
|
||||
AssetViewOptionsProfile = InArgs._AssetViewOptionsProfile;
|
||||
|
||||
if ( InArgs._InitialViewType >= 0 && InArgs._InitialViewType < EAssetViewType::MAX )
|
||||
{
|
||||
CurrentViewType = InArgs._InitialViewType;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentViewType = EAssetViewType::Tile;
|
||||
}
|
||||
|
||||
bPendingSortFilteredItems = false;
|
||||
bQuickFrontendListRefreshRequested = false;
|
||||
bSlowFullListRefreshRequested = false;
|
||||
LastSortTime = 0;
|
||||
SortDelaySeconds = 8;
|
||||
|
||||
bBulkSelecting = false;
|
||||
bAllowThumbnailEditMode = InArgs._AllowThumbnailEditMode;
|
||||
bThumbnailEditMode = false;
|
||||
bUserSearching = false;
|
||||
bPendingFocusOnSync = false;
|
||||
bWereItemsRecursivelyFiltered = false;
|
||||
|
||||
OwningContentBrowser = InArgs._OwningContentBrowser;
|
||||
|
||||
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools");
|
||||
AssetClassPermissionList = AssetToolsModule.Get().GetAssetClassPathPermissionList(EAssetClassAction::ViewAsset);
|
||||
FolderPermissionList = AssetToolsModule.Get().GetFolderPermissionList();
|
||||
WritableFolderPermissionList = AssetToolsModule.Get().GetWritableFolderPermissionList();
|
||||
|
||||
if(InArgs._AllowCustomView)
|
||||
{
|
||||
FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));
|
||||
|
||||
if(ContentBrowserModule.GetContentBrowserViewExtender().IsBound())
|
||||
{
|
||||
ViewExtender = ContentBrowserModule.GetContentBrowserViewExtender().Execute();
|
||||
|
||||
// Bind the delegates the custom view is responsible for firing
|
||||
if(ViewExtender)
|
||||
{
|
||||
ViewExtender->OnSelectionChanged().BindSP(this, &SAssetView::AssetSelectionChanged);
|
||||
ViewExtender->OnContextMenuOpened().BindSP(this, &SAssetView::OnGetContextMenuContent);
|
||||
ViewExtender->OnItemScrolledIntoView().BindSP(this, &SAssetView::ItemScrolledIntoView);
|
||||
ViewExtender->OnItemDoubleClicked().BindSP(this, &SAssetView::OnListMouseButtonDoubleClick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FEditorWidgetsModule& EditorWidgetsModule = FModuleManager::LoadModuleChecked<FEditorWidgetsModule>("EditorWidgets");
|
||||
TSharedRef<SWidget> AssetDiscoveryIndicator = EditorWidgetsModule.CreateAssetDiscoveryIndicator(EAssetDiscoveryIndicatorScaleMode::Scale_Vertical);
|
||||
|
||||
TSharedRef<SVerticalBox> VerticalBox = SNew(SVerticalBox);
|
||||
|
||||
BindCommands();
|
||||
|
||||
ChildSlot
|
||||
.Padding(0.0f)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.Padding(0.f)
|
||||
.BorderImage(FAppStyle::Get().GetBrush("Brushes.Panel"))
|
||||
[
|
||||
VerticalBox
|
||||
]
|
||||
];
|
||||
|
||||
// Assets area
|
||||
VerticalBox->AddSlot()
|
||||
.FillHeight(1.f)
|
||||
[
|
||||
SNew( SVerticalBox )
|
||||
|
||||
+ SVerticalBox::Slot()
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew( SBox )
|
||||
.Visibility_Lambda([this] { return InitialNumAmortizedTasks > 0 ? EVisibility::SelfHitTestInvisible : EVisibility::Collapsed; })
|
||||
.HeightOverride( 2.f )
|
||||
[
|
||||
SNew( SProgressBar )
|
||||
.Percent( this, &SAssetView::GetIsWorkingProgressBarState )
|
||||
.BorderPadding( FVector2D(0,0) )
|
||||
]
|
||||
]
|
||||
|
||||
+ SVerticalBox::Slot()
|
||||
.FillHeight(1.f)
|
||||
[
|
||||
SNew(SOverlay)
|
||||
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Fill)
|
||||
[
|
||||
SAssignNew(ViewContainer, SBox)
|
||||
.Padding(6.0f)
|
||||
|
||||
]
|
||||
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Center)
|
||||
.Padding(FMargin(0, 14, 0, 0))
|
||||
[
|
||||
// A warning to display when there are no assets to show
|
||||
SNew( STextBlock )
|
||||
.Justification( ETextJustify::Center )
|
||||
.Text( this, &SAssetView::GetAssetShowWarningText )
|
||||
.Visibility( this, &SAssetView::IsAssetShowWarningTextVisible )
|
||||
.AutoWrapText( true )
|
||||
]
|
||||
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Fill)
|
||||
.VAlign(VAlign_Bottom)
|
||||
.Padding(FMargin(24, 0, 24, 0))
|
||||
[
|
||||
// Asset discovery indicator
|
||||
AssetDiscoveryIndicator
|
||||
]
|
||||
|
||||
+ SOverlay::Slot()
|
||||
.HAlign(HAlign_Right)
|
||||
.VAlign(VAlign_Bottom)
|
||||
.Padding(FMargin(8, 0))
|
||||
[
|
||||
SNew(SBorder)
|
||||
.BorderImage(FAppStyle::GetBrush("ErrorReporting.EmptyBox"))
|
||||
.BorderBackgroundColor(this, &SAssetView::GetQuickJumpColor)
|
||||
.Visibility(this, &SAssetView::IsQuickJumpVisible)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(this, &SAssetView::GetQuickJumpTerm)
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// Thumbnail edit mode banner
|
||||
VerticalBox->AddSlot()
|
||||
.AutoHeight()
|
||||
.Padding(0.f, 4.f)
|
||||
[
|
||||
SNew(SBorder)
|
||||
.Visibility( this, &SAssetView::GetEditModeLabelVisibility )
|
||||
.BorderImage(FAppStyle::Get().GetBrush("Brushes.Panel"))
|
||||
.Content()
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
+SHorizontalBox::Slot()
|
||||
.VAlign(VAlign_Center)
|
||||
.Padding(4.f, 0.f, 0.f, 0.f)
|
||||
.FillWidth(1.f)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(LOCTEXT("ThumbnailEditModeLabel", "Editing Thumbnails. Drag a thumbnail to rotate it if there is a 3D environment."))
|
||||
.ColorAndOpacity(FAppStyle::Get().GetSlateColor("Colors.Primary"))
|
||||
]
|
||||
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(SPrimaryButton)
|
||||
.Text(LOCTEXT("EndThumbnailEditModeButton", "Done Editing"))
|
||||
.OnClicked(this, &SAssetView::EndThumbnailEditModeClicked)
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
if (InArgs._ShowBottomToolbar)
|
||||
{
|
||||
// Bottom panel
|
||||
VerticalBox->AddSlot()
|
||||
.AutoHeight()
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
|
||||
// Asset count
|
||||
+SHorizontalBox::Slot()
|
||||
.FillWidth(1.f)
|
||||
.VAlign(VAlign_Center)
|
||||
.Padding(8, 5)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text(this, &SAssetView::GetAssetCountText)
|
||||
]
|
||||
|
||||
// View mode combo button
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
[
|
||||
SNew(SComboButton)
|
||||
.Visibility(InArgs._ShowViewOptions ? EVisibility::Visible : EVisibility::Collapsed)
|
||||
.ContentPadding(0.f)
|
||||
.ButtonStyle( FAppStyle::Get(), "ToggleButton" ) // Use the tool bar item style for this button
|
||||
.OnGetMenuContent( this, &SAssetView::GetViewButtonContent )
|
||||
.ButtonContent()
|
||||
[
|
||||
SNew(SHorizontalBox)
|
||||
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(SImage)
|
||||
.Image( FAppStyle::GetBrush("GenericViewButton") )
|
||||
]
|
||||
|
||||
+SHorizontalBox::Slot()
|
||||
.AutoWidth()
|
||||
.Padding(2.f, 0.f, 0.f, 0.f)
|
||||
.VAlign(VAlign_Center)
|
||||
[
|
||||
SNew(STextBlock)
|
||||
.Text( LOCTEXT("ViewButton", "View Options") )
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
CreateCurrentView();
|
||||
|
||||
if( InArgs._InitialAssetSelection.IsValid() )
|
||||
{
|
||||
// sync to the initial item without notifying of selection
|
||||
bShouldNotifyNextAssetSync = false;
|
||||
SyncToLegacy( MakeArrayView(&InArgs._InitialAssetSelection, 1), TArrayView<const FString>() );
|
||||
}
|
||||
|
||||
// If currently looking at column, and you could choose to sort by path in column first and then name
|
||||
// Generalizing this is a bit difficult because the column ID is not accessible or is not known
|
||||
// Currently I assume this won't work, if this view mode is not column. Otherwise, I don't think sorting by path
|
||||
// is a good idea.
|
||||
if (CurrentViewType == EAssetViewType::Column && bSortByPathInColumnView)
|
||||
{
|
||||
SortManager.SetSortColumnId(EColumnSortPriority::Primary, SortManager.PathColumnId);
|
||||
SortManager.SetSortColumnId(EColumnSortPriority::Secondary, SortManager.NameColumnId);
|
||||
SortManager.SetSortMode(EColumnSortPriority::Primary, EColumnSortMode::Ascending);
|
||||
SortManager.SetSortMode(EColumnSortPriority::Secondary, EColumnSortMode::Ascending);
|
||||
SortList();
|
||||
}
|
||||
})");
|
||||
|
||||
constexpr Str SAssetView_GetThumbnailScale_Replacement = txt(R"(
|
||||
float SAssetView::GetThumbnailScale() const
|
||||
{
|
||||
float BaseScale;
|
||||
switch (ThumbnailSize)
|
||||
{
|
||||
case EThumbnailSize::Tiny:
|
||||
BaseScale = 0.1f;
|
||||
break;
|
||||
case EThumbnailSize::Small:
|
||||
BaseScale = 0.25f;
|
||||
break;
|
||||
case EThumbnailSize::Medium:
|
||||
BaseScale = 0.40f;
|
||||
break;
|
||||
case EThumbnailSize::Large:
|
||||
BaseScale = 0.60f;
|
||||
break;
|
||||
case EThumbnailSize::XLarge:
|
||||
BaseScale = 0.8f;
|
||||
break;
|
||||
case EThumbnailSize::Huge:
|
||||
BaseScale = 1.0f;
|
||||
break;
|
||||
default:
|
||||
BaseScale = 0.5f;
|
||||
break;
|
||||
}
|
||||
|
||||
return BaseScale * GetTickSpaceGeometry().Scale;
|
||||
})");
|
||||
|
||||
constexpr Str SPropertyMenuAssetPicker_Construct_Replacement = txt(R"(
|
||||
void SPropertyMenuAssetPicker::Construct( const FArguments& InArgs )
|
||||
{
|
||||
CurrentObject = InArgs._InitialObject;
|
||||
PropertyHandle = InArgs._PropertyHandle;
|
||||
const TArray<FAssetData>& OwnerAssetArray = InArgs._OwnerAssetArray;
|
||||
bAllowClear = InArgs._AllowClear;
|
||||
bAllowCopyPaste = InArgs._AllowCopyPaste;
|
||||
AllowedClasses = InArgs._AllowedClasses;
|
||||
DisallowedClasses = InArgs._DisallowedClasses;
|
||||
NewAssetFactories = InArgs._NewAssetFactories;
|
||||
OnShouldFilterAsset = InArgs._OnShouldFilterAsset;
|
||||
OnSet = InArgs._OnSet;
|
||||
OnClose = InArgs._OnClose;
|
||||
|
||||
const bool bForceShowEngineContent = PropertyHandle ? PropertyHandle->HasMetaData(TEXT("ForceShowEngineContent")) : false;
|
||||
const bool bForceShowPluginContent = PropertyHandle ? PropertyHandle->HasMetaData(TEXT("ForceShowPluginContent")) : false;
|
||||
|
||||
const bool bInShouldCloseWindowAfterMenuSelection = true;
|
||||
const bool bCloseSelfOnly = true;
|
||||
const bool bSearchable = false;
|
||||
|
||||
FMenuBuilder MenuBuilder(bInShouldCloseWindowAfterMenuSelection, nullptr, nullptr, bCloseSelfOnly, &FCoreStyle::Get(), bSearchable);
|
||||
|
||||
if (NewAssetFactories.Num() > 0)
|
||||
{
|
||||
MenuBuilder.BeginSection(NAME_None, LOCTEXT("CreateNewAsset", "Create New Asset"));
|
||||
{
|
||||
for (UFactory* Factory : NewAssetFactories)
|
||||
{
|
||||
TWeakObjectPtr<UFactory> FactoryPtr(Factory);
|
||||
|
||||
MenuBuilder.AddMenuEntry(
|
||||
Factory->GetDisplayName(),
|
||||
Factory->GetToolTip(),
|
||||
FSlateIconFinder::FindIconForClass(Factory->GetSupportedClass()),
|
||||
FUIAction(FExecuteAction::CreateSP(this, &SPropertyMenuAssetPicker::OnCreateNewAssetSelected, FactoryPtr))
|
||||
);
|
||||
}
|
||||
}
|
||||
MenuBuilder.EndSection();
|
||||
}
|
||||
|
||||
if (CurrentObject.IsValid() || bAllowCopyPaste || bAllowClear)
|
||||
{
|
||||
MenuBuilder.BeginSection(NAME_None, LOCTEXT("CurrentAssetOperationsHeader", "Current Asset"));
|
||||
{
|
||||
if (CurrentObject.IsValid())
|
||||
{
|
||||
MenuBuilder.AddMenuEntry(
|
||||
LOCTEXT("EditAsset", "Edit"),
|
||||
LOCTEXT("EditAsset_Tooltip", "Edit this asset"),
|
||||
FSlateIcon(FAppStyle::GetAppStyleSetName(),"Icons.Edit"),
|
||||
FUIAction(FExecuteAction::CreateSP(this, &SPropertyMenuAssetPicker::OnEdit)));
|
||||
}
|
||||
|
||||
if (bAllowCopyPaste)
|
||||
{
|
||||
MenuBuilder.AddMenuEntry(
|
||||
LOCTEXT("CopyAsset", "Copy"),
|
||||
LOCTEXT("CopyAsset_Tooltip", "Copies the asset to the clipboard"),
|
||||
FSlateIcon(FAppStyle::GetAppStyleSetName(),"GenericCommands.Copy"),
|
||||
FUIAction(FExecuteAction::CreateSP(this, &SPropertyMenuAssetPicker::OnCopy))
|
||||
);
|
||||
|
||||
MenuBuilder.AddMenuEntry(
|
||||
LOCTEXT("PasteAsset", "Paste"),
|
||||
LOCTEXT("PasteAsset_Tooltip", "Pastes an asset from the clipboard to this field"),
|
||||
FSlateIcon(FAppStyle::GetAppStyleSetName(),"GenericCommands.Paste"),
|
||||
FUIAction(
|
||||
FExecuteAction::CreateSP(this, &SPropertyMenuAssetPicker::OnPaste),
|
||||
FCanExecuteAction::CreateSP(this, &SPropertyMenuAssetPicker::CanPaste))
|
||||
);
|
||||
}
|
||||
|
||||
if (bAllowClear)
|
||||
{
|
||||
MenuBuilder.AddMenuEntry(
|
||||
LOCTEXT("ClearAsset", "Clear"),
|
||||
LOCTEXT("ClearAsset_ToolTip", "Clears the asset set on this field"),
|
||||
FSlateIcon(FAppStyle::GetAppStyleSetName(),"GenericCommands.Delete"),
|
||||
FUIAction(FExecuteAction::CreateSP(this, &SPropertyMenuAssetPicker::OnClear))
|
||||
);
|
||||
}
|
||||
}
|
||||
MenuBuilder.EndSection();
|
||||
}
|
||||
|
||||
MenuBuilder.BeginSection(NAME_None, LOCTEXT("BrowseHeader", "Browse"));
|
||||
{
|
||||
FContentBrowserModule& ContentBrowserModule = FModuleManager::Get().LoadModuleChecked<FContentBrowserModule>(TEXT("ContentBrowser"));
|
||||
|
||||
FAssetPickerConfig AssetPickerConfig;
|
||||
// Add filter classes - if we have a single filter class of "Object" then don't set a filter since it would always match everything (but slower!)
|
||||
if (AllowedClasses.Num() == 1 && AllowedClasses[0] == UObject::StaticClass())
|
||||
{
|
||||
AssetPickerConfig.Filter.ClassPaths.Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int32 i = 0; i < AllowedClasses.Num(); ++i)
|
||||
{
|
||||
AssetPickerConfig.Filter.ClassPaths.Add( AllowedClasses[i]->GetClassPathName() );
|
||||
}
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < DisallowedClasses.Num(); ++i)
|
||||
{
|
||||
AssetPickerConfig.Filter.RecursiveClassPathsExclusionSet.Add(DisallowedClasses[i]->GetClassPathName());
|
||||
}
|
||||
|
||||
// Allow child classes
|
||||
AssetPickerConfig.Filter.bRecursiveClasses = true;
|
||||
// Set a delegate for setting the asset from the picker
|
||||
AssetPickerConfig.OnAssetSelected = FOnAssetSelected::CreateSP(this, &SPropertyMenuAssetPicker::OnAssetSelected);
|
||||
// Set a delegate for setting the asset from the picker via the keyboard
|
||||
AssetPickerConfig.OnAssetEnterPressed = FOnAssetEnterPressed::CreateSP(this, &SPropertyMenuAssetPicker::OnAssetEnterPressed);
|
||||
// Use the list view by default
|
||||
AssetPickerConfig.InitialAssetViewType = EAssetViewType::List;
|
||||
// The initial selection should be the current value
|
||||
AssetPickerConfig.InitialAssetSelection = CurrentObject;
|
||||
// We'll do clearing ourselves
|
||||
AssetPickerConfig.bAllowNullSelection = false;
|
||||
// Focus search box
|
||||
AssetPickerConfig.bFocusSearchBoxWhenOpened = true;
|
||||
// Apply custom filter
|
||||
AssetPickerConfig.OnShouldFilterAsset = OnShouldFilterAsset;
|
||||
// Don't allow dragging
|
||||
AssetPickerConfig.bAllowDragging = false;
|
||||
|
||||
// Note(Ed): Personal changes
|
||||
AssetPickerConfig.ThumbnailScale = 0.25;
|
||||
AssetPickerConfig.InitialThumbnailSize = EThumbnailSize::Small;
|
||||
|
||||
// Save the settings into a special section for asset pickers for properties
|
||||
AssetPickerConfig.SaveSettingsName = TEXT("AssetPropertyPicker");
|
||||
// Populate the referencing assets via property handle
|
||||
AssetPickerConfig.PropertyHandle = PropertyHandle;
|
||||
// Populate the additional referencing assets with the Owner asset data
|
||||
AssetPickerConfig.AdditionalReferencingAssets = OwnerAssetArray;
|
||||
// Force show engine content if meta data says so
|
||||
AssetPickerConfig.bForceShowEngineContent = bForceShowEngineContent;
|
||||
// Force show plugin content if meta data says so
|
||||
AssetPickerConfig.bForceShowPluginContent = bForceShowPluginContent;
|
||||
|
||||
AssetPickerWidget = ContentBrowserModule.Get().CreateAssetPicker(AssetPickerConfig);
|
||||
|
||||
TSharedRef<SWidget> MenuContent =
|
||||
SNew(SBox)
|
||||
.WidthOverride(static_cast<float>(PropertyEditorAssetConstants::ContentBrowserWindowSize.X))
|
||||
.HeightOverride(static_cast<float>(PropertyEditorAssetConstants::ContentBrowserWindowSize.Y))
|
||||
[
|
||||
AssetPickerWidget.ToSharedRef()
|
||||
];
|
||||
|
||||
MenuBuilder.AddWidget(MenuContent, FText::GetEmpty(), true);
|
||||
}
|
||||
MenuBuilder.EndSection();
|
||||
|
||||
ChildSlot
|
||||
[
|
||||
MenuBuilder.MakeWidget()
|
||||
];
|
||||
})");
|
||||
|
||||
void change_EditorContentList()
|
||||
{
|
||||
// Change property editor constant
|
||||
{
|
||||
#define path_PropertyEditorAssetConstantsHeader \
|
||||
R"(C:\Projects\Unreal\Surgo\UE\Engine\Source\Editor\PropertyEditor\Private\UserInterface\PropertyEditor\PropertyEditorAssetConstants.h)"
|
||||
|
||||
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(CT_Global_Body);
|
||||
for ( Code code : parsed_PropertyEditorAssetConstantsHeader )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
case CT_Namespace:
|
||||
CodeNS ns = cast(CodeNS, code);
|
||||
for ( Code ns_code : ns->Body )
|
||||
{
|
||||
switch ( ns_code->Type )
|
||||
{
|
||||
case CT_Variable:
|
||||
CodeVar var = cast(CodeVar, ns_code);
|
||||
if ( var->Name.starts_with(txt("ContentBrowserWindowSize")) )
|
||||
{
|
||||
// Swap value with new value
|
||||
var->Value->Content = cache_str(txt("300.0f, 600.0f"));
|
||||
Gasa::LogEditor("Swapped: " + to_fstring(var->Name));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
changed_PropertyEditorAssetConstantsHeader.append( code );
|
||||
}
|
||||
|
||||
Builder SBlueprintActionMenu_Changed = Builder::open(path_PropertyEditorAssetConstantsHeader);
|
||||
SBlueprintActionMenu_Changed.print( def_comment(txt("This file was regenerated by GasaGen/ChangeEditorContentList.cpp")));
|
||||
SBlueprintActionMenu_Changed.print(changed_PropertyEditorAssetConstantsHeader);
|
||||
SBlueprintActionMenu_Changed.write();
|
||||
format_file(path_PropertyEditorAssetConstantsHeader, false );
|
||||
}
|
||||
|
||||
// Change SAssetView's Construct & GetThumbnailScale
|
||||
{
|
||||
#define path_SAssetView \
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Editor\ContentBrowser\Private\SAssetView.cpp)"
|
||||
|
||||
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 ) {}
|
||||
));
|
||||
CodeFn signature_GetThumbnailScale = parse_function( code(
|
||||
float SAssetView::GetThumbnailScale() const {}
|
||||
));
|
||||
|
||||
CodeBody changed_SAssetViewCpp = def_body(CT_Global_Body);
|
||||
for ( Code code : parsed_SAssetViewCpp )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
case CT_Function:
|
||||
{
|
||||
CodeFn function_def = cast(CodeFn, code);
|
||||
|
||||
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 ( 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));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
changed_SAssetViewCpp.append( code );
|
||||
}
|
||||
|
||||
Builder SBlueprintActionMenu_Changed = Builder::open(path_SAssetView);
|
||||
SBlueprintActionMenu_Changed.print( def_comment(txt("This file was regenerated by GasaGen/ChangeEditorContentList.cpp")));
|
||||
SBlueprintActionMenu_Changed.print(changed_SAssetViewCpp);
|
||||
SBlueprintActionMenu_Changed.write();
|
||||
format_file(path_SAssetView, false );
|
||||
}
|
||||
|
||||
// Change SAssetView's Construct & GetThumbnailScale
|
||||
{
|
||||
#define path_SPropertyMenuAssetPicker \
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Editor\PropertyEditor\Private\UserInterface\PropertyEditor\SPropertyMenuAssetPicker.cpp)"
|
||||
|
||||
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(CT_Global_Body);
|
||||
for ( Code code : parsed )
|
||||
{
|
||||
switch ( code->Type )
|
||||
{
|
||||
case CT_Function:
|
||||
{
|
||||
CodeFn function_def = cast(CodeFn, code);
|
||||
|
||||
if ( str_are_equal(function_def->Name, signature->Name)
|
||||
&& function_def->Params.is_equal(signature->Params))
|
||||
{
|
||||
code = parse_function( SPropertyMenuAssetPicker_Construct_Replacement );
|
||||
Gasa::LogEditor("Swapped: " + to_fstring(function_def->Name));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
changed.append( code );
|
||||
}
|
||||
|
||||
Builder SBlueprintActionMenu_Changed = Builder::open(path_SPropertyMenuAssetPicker);
|
||||
SBlueprintActionMenu_Changed.print( def_comment(txt("This file was regenerated by GasaGen/ChangeEditorContentList.cpp")));
|
||||
SBlueprintActionMenu_Changed.print(changed);
|
||||
SBlueprintActionMenu_Changed.write();
|
||||
format_file(path_SPropertyMenuAssetPicker, false );
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void change_EditorContentList();
|
@ -1,4 +1,4 @@
|
||||
#include "GasaGen_DevOptionsCache.h"
|
||||
#include "DevOptionsCache.h"
|
||||
#include "GasaGen_Common.h"
|
||||
|
||||
#pragma push_macro("GASA_API")
|
||||
@ -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")
|
||||
|
@ -1,15 +1,17 @@
|
||||
#include "GasaGen.h"
|
||||
#include "GasaGen_Common.h"
|
||||
#include "GasaGen_AttributeSets.h"
|
||||
#include "GasaGen_DevOptionsCache.h"
|
||||
#include "AttributeSets.h"
|
||||
#include "ChangeBPActionMenu.h"
|
||||
#include "DevOptionsCache.h"
|
||||
|
||||
// Editor Module
|
||||
#include "ChangeEditorContentList.h"
|
||||
#include "GasaEditorCommon.h"
|
||||
|
||||
#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;
|
||||
@ -17,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..."));
|
||||
@ -26,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);
|
||||
@ -36,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
|
||||
{
|
||||
@ -64,60 +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 })
|
||||
));
|
||||
|
||||
// register_macros()
|
||||
|
||||
generate_AttributeSets();
|
||||
//generate_DevOptionsCache();
|
||||
//generate_HostWidgetController();
|
||||
generate_DevOptionsCache();
|
||||
// generate_HostWidgetController();
|
||||
// change_SBlueprintActionMenu_Construct();
|
||||
// change_EditorContentList();
|
||||
|
||||
gen::deinit();
|
||||
gen::deinit( & gen_ctx);
|
||||
});
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
UE_DISABLE_OPTIMIZATION
|
||||
#include "gencpp/gen.hpp"
|
||||
#include "gencpp/gen.builder.hpp"
|
||||
UE_ENABLE_OPTIMIZATION
|
||||
using namespace gen;
|
||||
|
||||
// Codegen assumes its working directory is the project
|
||||
@ -16,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;
|
||||
@ -71,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 );
|
||||
}
|
||||
@ -97,13 +111,15 @@ Builder builder_open(char const* path) {
|
||||
// CodeConstructor find_constructor( StrC parent_name, )
|
||||
|
||||
inline
|
||||
void format_file( char const* path )
|
||||
void format_file( char const* path, bool relative_path = true )
|
||||
{
|
||||
String
|
||||
resolved_path = String::make(GlobalAllocator, StrC(Project_Path));
|
||||
StrBuilder
|
||||
resolved_path = StrBuilder::make_reserve(gen_ctx.Allocator_Temp, Project_Path.Len);
|
||||
if (relative_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 ");
|
||||
|
||||
@ -111,7 +127,7 @@ void format_file( char const* path )
|
||||
#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 );
|
||||
@ -126,13 +142,19 @@ void format_file( char const* path )
|
||||
}
|
||||
|
||||
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( Str string )
|
||||
{
|
||||
return FString::ConstructFromPtrSize( string.Ptr, string.Len );
|
||||
}
|
||||
|
59
Project/Source/GasaEditor/GasaGen/gencpp/AST_Design.md
Normal file
59
Project/Source/GasaEditor/GasaGen/gencpp/AST_Design.md
Normal file
@ -0,0 +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*`.
|
||||
In order to abstract away constant use of `AST*` its wrapped in a Code type which can be either:
|
||||
|
||||
When its the [C generated variant of the library](../gen_c_library/)
|
||||
```c
|
||||
typedef AST* Code;
|
||||
tyepdef AST_<name>* Code<name>;
|
||||
...
|
||||
```
|
||||
|
||||
**or**
|
||||
|
||||
For C++:
|
||||
```cpp
|
||||
struct Code {
|
||||
AST* ast;
|
||||
};
|
||||
struct Code<name> {
|
||||
...
|
||||
|
||||
AST_<name>* ast;
|
||||
};
|
||||
```
|
||||
|
||||
The full definitions of all asts are within:
|
||||
|
||||
* [`ast.hpp`](../base/components/ast.hpp)
|
||||
* [`ast_types.hpp`](../base/components/ast_types.hpp)
|
||||
* [`code_types.hpp`](../base/components/code_types.hpp)
|
||||
|
||||
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.
|
788
Project/Source/GasaEditor/GasaGen/gencpp/AST_Types.md
Normal file
788
Project/Source/GasaEditor/GasaGen/gencpp/AST_Types.md
Normal file
@ -0,0 +1,788 @@
|
||||
## 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 `CodeType` type:
|
||||
|
||||
* Class_Body
|
||||
* Enum_Body
|
||||
* Export_Body
|
||||
* Extern_Linkage_Body
|
||||
* Function_Body
|
||||
* Global_Body
|
||||
* Namespace_Body
|
||||
* Struct_Body
|
||||
* Union_Body
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
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 CodeType type for the type of defintion used.
|
||||
|
||||
Serialization:
|
||||
|
||||
Will output only the entries, the braces are handled by the parent.
|
||||
|
||||
```cpp
|
||||
<Front>
|
||||
...
|
||||
<Back>
|
||||
```
|
||||
|
||||
## Attributes
|
||||
|
||||
Represent standard or vendor specific C/C++ attributes.
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<Content>
|
||||
```
|
||||
|
||||
While the parser supports the `__declspec` and `__attribute__` syntax, the upfront constructor ( def_attributes ) must have the user specify the entire attribute, including the `[[]]`, `__declspec` or `__attribute__` parts.
|
||||
|
||||
## Comment
|
||||
|
||||
Stores a comment.
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<Content>
|
||||
```
|
||||
|
||||
The parser will perserve comments found if residing with a body or in accepted inline-to-definition locations.
|
||||
Otherwise they will be skipped by the TokArray::__eat and TokArray::current( skip foramtting enabled ) functions.
|
||||
|
||||
The upfront constructor: `def_comment` expects to recieve a comment without the `//` or `/* */` parts. It will add them during construction.
|
||||
|
||||
## Class & Struct
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt; // Only supported by forward declarations
|
||||
CodeAttributes Attributes;
|
||||
CodeType ParentType;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
CodeType Prev;
|
||||
CodeType Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
AccessSpec ParentAccess;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Class_Fwd
|
||||
<ModuleFlags> <class/struct> <Name>; <InlineCmt>
|
||||
|
||||
// Class
|
||||
<ModuleFlags> <class/struct> <Attributes> <Name> : <ParentAccess> <ParentType>, public <ParentType->Next>, ... <InlineCmt>
|
||||
{
|
||||
<Body>
|
||||
};
|
||||
```
|
||||
|
||||
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;
|
||||
CodeParams Params;
|
||||
Code Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Constructor_Fwd
|
||||
<Specs> <Parent->Name>( <Params> ); <InlineCmt>
|
||||
|
||||
// Constructor
|
||||
<Specs> <Parent->Name>( <Params> ) <InlineCmt>
|
||||
: <InitializerList>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
|
||||
// Constructor Source Implementation
|
||||
<Specs> <Parent>::~<Parent->Name>( <Params> ) <Specs>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Define
|
||||
|
||||
Represents a preprocessor define
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeDefineParams Params;
|
||||
Code Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
#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:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
CodeSpecifiers Specs;
|
||||
Code Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Destructor_Fwd
|
||||
<Specs> ~<Parent->Name>( <Params> ) <Specs>; <InlineCmt>
|
||||
|
||||
// Destructor
|
||||
<Specs> ~<Parent->Name>( <Params> ) <Specs>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
|
||||
// Destructor Source Implementation
|
||||
<Specs> <Parent>::~<Parent->Name>( <Params> ) <Specs>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Enum
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeType UnderlyingType;
|
||||
Code UnderlyingTypeMacro;
|
||||
CodeBody Body;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
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> or <UnderlyingTypeMacro> ; <InlineCmt>
|
||||
|
||||
// Enum
|
||||
<ModuleFlags> <enum or enum class> <Name> : <UnderlyingType> or <UnderlyingTypeMacro>
|
||||
{
|
||||
<Body>
|
||||
};
|
||||
```
|
||||
|
||||
## Execution
|
||||
|
||||
Just represents an execution body. Equivalent to an untyped body.
|
||||
Will be obsolute when function body parsing is implemented.
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<Content>
|
||||
```
|
||||
|
||||
## External Linkage (Extern)
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
extern "<Name>"
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Include
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Code Parent;
|
||||
Token* Tok;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
#include <Content>
|
||||
```
|
||||
|
||||
## Friend
|
||||
|
||||
This library (until its necessary become some third-party library to do otherwise) does not support friend declarations with in-statment function definitions.
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
Code Declaration;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
friend <Declaration>; <InlineCmt>
|
||||
```
|
||||
|
||||
## Function
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeSpecifiers Specs;
|
||||
CodeType ReturnType;
|
||||
CodeParams Params;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Function_Fwd
|
||||
<ModuleFlags> <Attributes> <Specs> <ReturnType> <Name>( <Params> ) <Specs>; <InlineCmt>
|
||||
|
||||
// Function
|
||||
<ModuleFlags> <Attributes> <Specs> <ReturnType> <Name>( <Params> ) <Specs>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Module
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<ModuleFlags> module <Name>;
|
||||
```
|
||||
|
||||
## Namespace
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<ModuleFlags> namespace <Name>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Operator Overload (Operator)
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeSpecifiers Specs;
|
||||
CodeType ReturnType;
|
||||
CodeParams Params;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
OperatorT Op;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Operator_Fwd
|
||||
<ModuleFlags> <Attributes> <Specs> <ReturnType> operator <Op>( <Params> ) <Specs>; <InlineCmt>
|
||||
|
||||
// Operator
|
||||
<ModuleFlags> <Attributes> <Specs> <ReturnType> <Name>operator <Op>( <Params> ) <Specs>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Operator Cast Overload ( User-Defined Type Conversion, OpCast )
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
CodeSpecifiers Specs;
|
||||
CodeType ValueType;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Operator_Cast_Fwd
|
||||
<Specs> operator <ValueType>() <Specs>; <InlineCmt>
|
||||
|
||||
// Operator_Cast
|
||||
<Specs> <Name>operator <ValueType>() <Specs>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters (AST_Params)
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeType ValueType;
|
||||
Code Macro;
|
||||
Code Value;
|
||||
Code PostNameMacro;
|
||||
StrCached Name;
|
||||
CodeParams Last;
|
||||
CodeParams Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
s32 NumEntries;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<Macro>, <Next> ... <Last>
|
||||
|
||||
<Macro> <ValueType> <Name> <PostNameMacro> = <Value>, <Next>... <Last>
|
||||
```
|
||||
|
||||
## Pragma
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
#pragma <Content>
|
||||
```
|
||||
|
||||
## Preprocessor Conditional
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
StrCached Content;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
#<based off Type> <Content>
|
||||
```
|
||||
|
||||
## Specifiers
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
SpecifierT ArrSpecs[ AST_ArrSpecs_Cap ];
|
||||
CodeSpecifiers NextSpecs;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
s32 NumEntries;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<Spec>, ...
|
||||
```
|
||||
|
||||
## Template
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeParams Params;
|
||||
Code Declaration;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<ModuleFlags>
|
||||
template< <Params> >
|
||||
<Declaration>
|
||||
```
|
||||
|
||||
## Typename
|
||||
|
||||
Typenames represent the type "symbol".
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeAttributes Attributes;
|
||||
CodeSpecifiers Specs;
|
||||
CodeReturnType ReturnType;
|
||||
CodeParams Params;
|
||||
Code ArrExpr;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
StrCached Name;
|
||||
CodeType Type;
|
||||
b32 IsParamPack;
|
||||
ETypenameTag TypeTag;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<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.
|
||||
Those (macros) don't use the underlying type field as everything was serialized under the Name field.
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
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> <UnderlyingType-ArrExpr>; <InlineCmt>
|
||||
|
||||
// Functions
|
||||
|
||||
// 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
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeAttributes Attributes;
|
||||
CodeBody Body;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
<ModuleFlags> union <Attributes> <Name>
|
||||
{
|
||||
<Body>
|
||||
}
|
||||
```
|
||||
|
||||
## Using
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeType UnderlyingType;
|
||||
StrCached Name;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Regular
|
||||
<ModuleFlags> using <Attributes> <Name> = <UnderlyingType>; <InlineCmt>
|
||||
|
||||
// Namespace
|
||||
<ModuleFlags> using namespace <Name>; <InlineCmt>
|
||||
```
|
||||
|
||||
## Variable
|
||||
|
||||
[Algo](./Parser_Algo.md:)
|
||||
|
||||
Fields:
|
||||
|
||||
```cpp
|
||||
CodeComment InlineCmt;
|
||||
CodeAttributes Attributes;
|
||||
CodeSpecifiers Specs;
|
||||
CodeType ValueType;
|
||||
Code BitfieldSize;
|
||||
Code Value;
|
||||
StrCached Name;
|
||||
CodeVar NextVar;
|
||||
Code Prev;
|
||||
Code Next;
|
||||
Token* Tok;
|
||||
Code Parent;
|
||||
CodeType Type;
|
||||
ModuleFlag ModuleFlags;
|
||||
s32 VarParenthesizedInit;
|
||||
```
|
||||
|
||||
Serialization:
|
||||
|
||||
```cpp
|
||||
// Regular
|
||||
<ModuleFlags> <Attributes> <Specs> <ValueType> <Name> = <Value>, NextVar ...; <InlineCmt>
|
||||
|
||||
// Bitfield
|
||||
<ModuleFlags> <Attributes> <Specs> <ValueType> <Name> : <BitfieldSize> = <Value>, NextVar ...; <InlineCmt>
|
||||
|
||||
// VarParenthesizedInit
|
||||
<Attributes> <Specs> <ValueType> <Name>( <Value>, NextVar ... ); <InlineCmt>
|
||||
```
|
44
Project/Source/GasaEditor/GasaGen/gencpp/LICENSE
Normal file
44
Project/Source/GasaEditor/GasaGen/gencpp/LICENSE
Normal file
@ -0,0 +1,44 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2023, Edward R. Gonzalez
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
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.
|
1221
Project/Source/GasaEditor/GasaGen/gencpp/Parser_Algo.md
Normal file
1221
Project/Source/GasaEditor/GasaGen/gencpp/Parser_Algo.md
Normal file
File diff suppressed because it is too large
Load Diff
159
Project/Source/GasaEditor/GasaGen/gencpp/Parsing.md
Normal file
159
Project/Source/GasaEditor/GasaGen/gencpp/Parsing.md
Normal file
@ -0,0 +1,159 @@
|
||||
## Navigation
|
||||
|
||||
[Top](../Readme.md)
|
||||
|
||||
<- [docs - General](Readme.md)
|
||||
|
||||
# Parsing
|
||||
|
||||
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 ~7000 loc. I hope to keep it under 10-15k loc worst case.
|
||||
|
||||
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 ( 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.
|
||||
|
||||
***Parsing will aggregate any tokens within a function body or expression statement to an untyped Code AST.***
|
||||
|
||||
Everything is done in one pass for both the preprocessor directives and the rest of the language.
|
||||
The parser performs no macro expansion as the scope of gencpp feature-set is to only support the preprocessor for the goal of having rudimentary awareness of preprocessor ***conditionals***, ***defines***, ***includes***, and ***pragmas***.
|
||||
|
||||
The keywords supported for the preprocessor are:
|
||||
|
||||
* include
|
||||
* define
|
||||
* if
|
||||
* ifdef
|
||||
* elif
|
||||
* endif
|
||||
* pragma
|
||||
|
||||
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 ).
|
||||
***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:
|
||||
|
||||
* 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 contains some egregious preprocessor abuse.*
|
||||
|
||||
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. (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.
|
||||
|
||||
**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).**
|
34
Project/Source/GasaEditor/GasaGen/gencpp/Readme.md
Normal file
34
Project/Source/GasaEditor/GasaGen/gencpp/Readme.md
Normal file
@ -0,0 +1,34 @@
|
||||
## Navigation
|
||||
|
||||
# base
|
||||
|
||||
[Top](../Readme.md)
|
||||
|
||||
* [docs](../docs/Readme.md)
|
||||
|
||||
# Unreal Engine Version Generator
|
||||
|
||||
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.
|
||||
|
||||
If using the library's provided build scripts:
|
||||
|
||||
```ps1
|
||||
.\build.ps1 <compiler> <debug or omit> unreal
|
||||
```
|
||||
|
||||
## Notables
|
||||
|
||||
For the most part this follows the same conventions as `gen_segmented`.
|
||||
|
||||
This generator uses a separate enumeration definitions for the following:
|
||||
|
||||
* [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.
|
||||
|
||||
A separate [parser_case_macros.cpp](./components/parser_case_macros.cpp) is used to accomodate for the new forceinline specifiers.
|
||||
|
||||
The `global` macro the library uses is redefined as an empty substiution.
|
||||
|
||||
|
||||
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.
|
453
Project/Source/GasaEditor/GasaGen/gencpp/Readme_Docs.md
Normal file
453
Project/Source/GasaEditor/GasaGen/gencpp/Readme_Docs.md
Normal file
@ -0,0 +1,453 @@
|
||||
# General Docs
|
||||
|
||||
[Top](../Readme.md)
|
||||
|
||||
Contains:
|
||||
|
||||
* [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.
|
||||
|
||||
### *CURRENTLY UNSUPPORTED*
|
||||
|
||||
**There is no support for validating expressions.**
|
||||
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.
|
||||
This means that the typename entry for the parameter AST would be either:
|
||||
|
||||
* `class`
|
||||
* `typename`
|
||||
* A fundamental type, function, or pointer type.
|
||||
|
||||
***Concepts and Constraints are not supported***
|
||||
Its a [todo](https://github.com/Ed94/gencpp/issues/21)
|
||||
|
||||
### 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 todos)](../base/components/ast.hpp#L396-461)
|
||||
|
||||
https://github.com/Ed94/gencpp/blob/967a044637f1615c709cb723dc61118fcc08dcdb/base/components/ast.hpp#L369-L435
|
||||
|
||||
*`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`*
|
||||
*`StrBuilder` is the dynamically allocating string builder type for the library*
|
||||
|
||||
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
|
||||
int AST_ArrSpecs_Cap =
|
||||
(
|
||||
AST_POD_Size
|
||||
- sizeof(Code)
|
||||
- sizeof(StrCached)
|
||||
- sizeof(Code) * 2
|
||||
- sizeof(Token*)
|
||||
- sizeof(Code)
|
||||
- sizeof(CodeType)
|
||||
- sizeof(ModuleFlag)
|
||||
- sizeof(u32)
|
||||
)
|
||||
/ sizeof(Specifier) - 1;
|
||||
```
|
||||
Data Notes:
|
||||
|
||||
* ASTs are wrapped for the user in a Code struct which is a wrapper for a AST* type.
|
||||
* 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.
|
||||
* Strings used for serialization and file buffers are not contained by those used for cached strings.
|
||||
* `_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.
|
||||
* 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.
|
||||
* CodeAttributes
|
||||
* CodeComment
|
||||
* CodeClass
|
||||
* CodeConstructor
|
||||
* CodeDefine
|
||||
* CodeDefineParams
|
||||
* CodeDestructor
|
||||
* CodeEnum
|
||||
* CodeExec
|
||||
* CodeExtern
|
||||
* CodeInclude
|
||||
* CodeFriend
|
||||
* CodeFn
|
||||
* CodeModule
|
||||
* CodeNS
|
||||
* CodeOperator
|
||||
* 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.
|
||||
* CodeStruct
|
||||
* CodeTemplate
|
||||
* CodeTypename
|
||||
* CodeTypedef
|
||||
* CodeUnion
|
||||
* CodeUsing
|
||||
* CodeVar
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
* Untyped
|
||||
|
||||
### Upfront Construction
|
||||
|
||||
All component ASTs must be previously constructed, and provided on creation of the code AST.
|
||||
The construction will fail and return CodeInvalid otherwise.
|
||||
|
||||
Interface :``
|
||||
|
||||
* def_attributes
|
||||
* *This is pre-appended right before the function symbol, or placed after the class or struct keyword for any flavor of attributes used.*
|
||||
* *Its up to the user to use the desired attribute formatting: `[[]]` (standard), `__declspec` (Microsoft), or `__attribute__` (GNU).*
|
||||
* def_comment
|
||||
* def_class
|
||||
* def_constructor
|
||||
* def_define
|
||||
* def_define_params
|
||||
* def_destructor
|
||||
* def_enum
|
||||
* def_execution
|
||||
* *This is equivalent to untyped_str, except that its intended for use only in execution scopes.*
|
||||
* def_extern_link
|
||||
* def_friend
|
||||
* def_function
|
||||
* def_include
|
||||
* def_module
|
||||
* def_namespace
|
||||
* def_operator
|
||||
* def_operator_cast
|
||||
* def_param
|
||||
* def_params
|
||||
* def_pragma
|
||||
* def_preprocess_cond
|
||||
* def_specifier
|
||||
* def_specifiers
|
||||
* def_struct
|
||||
* def_template
|
||||
* def_type
|
||||
* def_typedef
|
||||
* def_union
|
||||
* def_using
|
||||
* def_using_namespace
|
||||
* def_variable
|
||||
|
||||
Bodies:
|
||||
|
||||
* def_body
|
||||
* def_class_body
|
||||
* def_enum_body
|
||||
* def_export_body
|
||||
* def_extern_link_body
|
||||
* def_function_body
|
||||
* *Use this for operator bodies as well*
|
||||
* def_global_body
|
||||
* def_namespace_body
|
||||
* def_struct_body
|
||||
* def_union_body
|
||||
|
||||
Usage:
|
||||
|
||||
```cpp
|
||||
<name> = def_<function type>( ... );
|
||||
|
||||
Code <name>
|
||||
{
|
||||
...
|
||||
<name> = def_<function 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 ));
|
||||
|
||||
// instead of:
|
||||
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: `code_validate_body` to verify that the members are valid entires for that type.
|
||||
|
||||
### Parse construction
|
||||
|
||||
A string provided to the API is parsed for the intended language construct.
|
||||
|
||||
Interface :
|
||||
|
||||
* parse_class
|
||||
* parse_constructor
|
||||
* parse_define
|
||||
* parse_destructor
|
||||
* parse_enum
|
||||
* parse_export_body
|
||||
* parse_extern_link
|
||||
* parse_friend
|
||||
* parse_function
|
||||
* parse_global_body
|
||||
* parse_namespace
|
||||
* parse_operator
|
||||
* parse_operator_cast
|
||||
* parse_struct
|
||||
* parse_template
|
||||
* parse_type
|
||||
* parse_typedef
|
||||
* parse_union
|
||||
* parse_using
|
||||
* parse_variable
|
||||
|
||||
Usage:
|
||||
|
||||
```cpp
|
||||
Code <name> = parse_<function name>( string with code );
|
||||
|
||||
Code <name> = def_<function name>( ..., parse_<function name>(
|
||||
<string with code>
|
||||
));
|
||||
```
|
||||
|
||||
### Untyped constructions
|
||||
|
||||
Code ASTs are constructed using unvalidated strings.
|
||||
|
||||
Interface :
|
||||
|
||||
* token_fmt_va
|
||||
* token_fmt
|
||||
* untyped_str
|
||||
* 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.
|
||||
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.
|
||||
* Untyped code can only be a child of a parent of body AST, or for values of an assignment (ex: variable assignment).
|
||||
|
||||
These restrictions help prevent abuse of untyped code to some extent.
|
||||
|
||||
Usage Conventions:
|
||||
|
||||
```cpp
|
||||
Code <name> = def_variable( <type>, <name>, untyped_<function name>(
|
||||
<string with code>
|
||||
));
|
||||
|
||||
Code <name> = untyped_str( code(
|
||||
<some code without "" quotes>
|
||||
));
|
||||
```
|
||||
|
||||
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 > )
|
||||
```
|
||||
|
||||
Template metaprogramming in the traditional sense becomes possible with the use of `token_fmt` and parse constructors:
|
||||
|
||||
```cpp
|
||||
Str value = txt("Something");
|
||||
|
||||
char const* template_str = txt(
|
||||
Code with <key> to replace with token_values
|
||||
...
|
||||
);
|
||||
char const* gen_code_str = token_fmt( "key", value, template_str );
|
||||
Code <name> = parse_<function name>( gen_code_str );
|
||||
```
|
||||
|
||||
## Predefined Codes
|
||||
|
||||
The following are provided predefined by the library as they are commonly used:
|
||||
|
||||
* `enum_underlying_macro`
|
||||
* `access_public`
|
||||
* `access_protected`
|
||||
* `access_private`
|
||||
* `attrib_api_export`
|
||||
* `attrib_api_import`
|
||||
* `module_global_fragment`
|
||||
* `module_private_fragment`
|
||||
* `fmt_newline`
|
||||
* `pragma_once`
|
||||
* `param_varaidc` (Used for varadic definitions)
|
||||
* `preprocess_else`
|
||||
* `preprocess_endif`
|
||||
* `spec_const`
|
||||
* `spec_consteval`
|
||||
* `spec_constexpr`
|
||||
* `spec_constinit`
|
||||
* `spec_extern_linkage` (extern)
|
||||
* `spec_final`
|
||||
* `spec_forceinline`
|
||||
* `spec_global` (global macro)
|
||||
* `spec_inline`
|
||||
* `spec_internal_linkage` (internal macro)
|
||||
* `spec_local_persist` (local_persist macro)
|
||||
* `spec_mutable`
|
||||
* `spec_neverinline`
|
||||
* `spec_noexcept`
|
||||
* `spec_override`
|
||||
* `spec_ptr`
|
||||
* `spec_pure`
|
||||
* `spec_ref`
|
||||
* `spec_register`
|
||||
* `spec_rvalue`
|
||||
* `spec_static_member` (static)
|
||||
* `spec_thread_local`
|
||||
* `spec_virtual`
|
||||
* `spec_volatile`
|
||||
* `t_empty` (Used for varaidc macros)
|
||||
* `t_auto`
|
||||
* `t_void`
|
||||
* `t_int`
|
||||
* `t_bool`
|
||||
* `t_char`
|
||||
* `t_wchar_t`
|
||||
* `t_class`
|
||||
* `t_typename`
|
||||
|
||||
Optionally the following may be defined if `GEN_DEFINE_LIBRARY_CODE_CONSTANTS` is defined
|
||||
|
||||
* `t_b32`
|
||||
* `t_s8`
|
||||
* `t_s16`
|
||||
* `t_s32`
|
||||
* `t_s64`
|
||||
* `t_u8`
|
||||
* `t_u16`
|
||||
* `t_u32`
|
||||
* `t_u64`
|
||||
* `t_ssize` (ssize_t)
|
||||
* `t_usize` (size_t)
|
||||
* `t_f32`
|
||||
* `t_f64`
|
||||
|
||||
## Extent of operator overload validation
|
||||
|
||||
The AST and constructors will be able to validate that the arguments provided for the operator type match the expected form:
|
||||
|
||||
* If return type must match a parameter
|
||||
* If number of parameters is correct
|
||||
* If added as a member symbol to a class or struct, that operator matches the requirements for the class (types match up)
|
||||
* There is no support for validating new & delete operations (yet)
|
||||
|
||||
The user is responsible for making sure the code types provided are correct
|
||||
and have the desired specifiers assigned to them beforehand.
|
||||
|
||||
## Code generation and modification
|
||||
|
||||
There are two provided auxillary interfaces:
|
||||
|
||||
* Builder
|
||||
* Scanner
|
||||
|
||||
### 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.
|
||||
* The code is provided via print( code ) function will be serialized to its buffer.
|
||||
* When all serialization is finished, use the write() command to write the buffer to the file.
|
||||
|
||||
### Scanner Auxillary Interface
|
||||
|
||||
* 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`
|
@ -1,88 +1,95 @@
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#include "gen.builder.hpp"
|
||||
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
#pragma clang diagnostic ignored "-Wswitch"
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wvarargs"
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# 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__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma GCC diagnostic ignored "-Wcomment"
|
||||
#pragma GCC diagnostic ignored "-Wswitch"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#include "gen.builder.hpp"
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
Builder Builder::open( char const* path )
|
||||
#pragma region Builder
|
||||
|
||||
Builder builder_open( char const* path )
|
||||
{
|
||||
Builder result;
|
||||
|
||||
FileError error = file_open_mode( &result.File, EFileMode_WRITE, path );
|
||||
FileError error = file_open_mode( & result.File, EFileMode_WRITE, path );
|
||||
if ( error != EFileError_NONE )
|
||||
{
|
||||
log_failure( "gen::File::open - Could not open file: %s", path );
|
||||
log_failure( "gen::File::open - Could not open file: %s", 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();
|
||||
// const sw len = str.length();
|
||||
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 )
|
||||
{
|
||||
sw res;
|
||||
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
||||
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__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -1,50 +1,93 @@
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# 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__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gen.hpp"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
#pragma clang diagnostic ignored "-Wswitch"
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wvarargs"
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma GCC diagnostic ignored "-Wcomment"
|
||||
#pragma GCC diagnostic ignored "-Wswitch"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
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__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
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
@ -1,619 +1,69 @@
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gen.hpp"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
#pragma clang diagnostic ignored "-Wswitch"
|
||||
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wvarargs"
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# 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__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma GCC diagnostic ignored "-Wcomment"
|
||||
#pragma GCC diagnostic ignored "-Wswitch"
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#include "gen.hpp"
|
||||
|
||||
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, sw 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, sw 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;
|
||||
|
||||
GEN_DEF_INLINE 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 );
|
||||
|
||||
GEN_DEF_INLINE void csv_write( FileInfo* file, CSV_Object* obj );
|
||||
GEN_DEF_INLINE 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 */
|
||||
|
||||
GEN_IMPL_INLINE u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header )
|
||||
{
|
||||
return csv_parse_delimiter( root, text, allocator, has_header, ',' );
|
||||
}
|
||||
|
||||
GEN_IMPL_INLINE void csv_write( FileInfo* file, CSV_Object* obj )
|
||||
{
|
||||
csv_write_delimiter( file, obj, ',' );
|
||||
}
|
||||
|
||||
GEN_IMPL_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.
|
||||
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 );
|
||||
|
||||
sw 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__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -3,6 +3,7 @@
|
||||
#define GEN_EXPOSE_BACKEND
|
||||
// #define GEN_DEFINE_ATTRIBUTE_TOKENS
|
||||
#define GEN_IMPLEMENTATION
|
||||
#include "gen.dep.cpp"
|
||||
#include "gen.cpp"
|
||||
#include "gen.builder.cpp"
|
||||
// #include "gen.scanner.hpp"
|
||||
@ -22,7 +23,8 @@ using namespace gen;
|
||||
|
||||
int gen_main()
|
||||
{
|
||||
gen::init();
|
||||
ctx = {};
|
||||
gen::init(& ctx);
|
||||
log_fmt("Generating code for the Gasa module\n");
|
||||
|
||||
// Initialize Globals
|
||||
@ -35,63 +37,71 @@ int gen_main()
|
||||
}
|
||||
|
||||
// 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 }),
|
||||
(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();
|
||||
gen_UHostWidgetController();
|
||||
// gen_UGasaAttributeSet();
|
||||
// gen_FGasaDevOptionsCache();
|
||||
// gen_UHostWidgetController();
|
||||
// gen_netslime_interfaces();
|
||||
|
||||
// One offs
|
||||
if (0)
|
||||
if (1)
|
||||
{
|
||||
// ue_parse_testing();
|
||||
swap_SBlueprintActionMenu_Construct();
|
||||
ue_parse_testing();
|
||||
//swap_SBlueprintActionMenu_Construct();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,52 +18,60 @@ 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 StrC str_GASA_API = txt("GASA_API");
|
||||
constexpr Str str_GASA_API = txt("GASA_API");
|
||||
|
||||
#pragma region Globals
|
||||
// These Code objects are created before anything else after gencpp does its initializatioon
|
||||
@ -74,10 +82,12 @@ global Code UHT_USTRUCT;
|
||||
global Code UModule_GASA_API;
|
||||
#pragma endregion Globals
|
||||
|
||||
global Context ctx;
|
||||
|
||||
inline
|
||||
CodeBody parse_file( char const* path ) {
|
||||
FileContents content = file_read_contents( GlobalAllocator, true, path );
|
||||
CodeBody code = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
FileContents content = file_read_contents( ctx.Allocator_Temp, file_zero_terminate, path );
|
||||
CodeBody code = parse_global_body( Str {(char const*)content.data, content.size });
|
||||
return code;
|
||||
}
|
||||
|
||||
@ -92,7 +102,7 @@ void format_file( char const* path )
|
||||
#define cf_format_inplace "-i "
|
||||
#define cf_style "-style=file:" "./scripts/.clang-format "
|
||||
#define cf_verbose "-verbose "
|
||||
String command = String::make( GlobalAllocator, clang_format );
|
||||
StrBuilder command = StrBuilder::make( ctx.Allocator_Temp, clang_format );
|
||||
command.append( cf_format_inplace );
|
||||
command.append( cf_style );
|
||||
command.append( cf_verbose );
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "GasaGenCommon.cpp"
|
||||
#endif
|
||||
|
||||
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;
|
||||
@ -249,23 +249,22 @@ void swap_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( 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 );
|
||||
|
@ -10,36 +10,36 @@ using namespace gen;
|
||||
|
||||
void gen_FGasaDevOptionsCache()
|
||||
{
|
||||
Array<CodeVar> GasaDevOptions_UPROPERTIES = Array<CodeVar>::init(GlobalAllocator);
|
||||
Array<CodeVar> GasaDevOptions_UPROPERTIES = Array<CodeVar>::init(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" );
|
||||
{
|
||||
@ -52,7 +52,7 @@ void gen_FGasaDevOptionsCache()
|
||||
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);
|
||||
@ -74,7 +74,7 @@ void gen_FGasaDevOptionsCache()
|
||||
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", (Str)body.to_strbuilder(), stringize(
|
||||
struct GASA_API FGasaDevOptionsCache {
|
||||
<body>
|
||||
};
|
||||
@ -88,13 +88,13 @@ void gen_FGasaDevOptionsCache()
|
||||
|
||||
Builder source = Builder::open( path_module_gasa "GasaDevOptionsCache.cpp" );
|
||||
{
|
||||
Array<CodeInclude> GasaDevOptions_Includes = Array<CodeInclude>::init(GlobalAllocator);
|
||||
Array<CodeInclude> GasaDevOptions_Includes = Array<CodeInclude>::init(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) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,17 +107,17 @@ void gen_FGasaDevOptionsCache()
|
||||
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.to_strbuilder().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() );
|
||||
@ -134,7 +134,7 @@ void gen_FGasaDevOptionsCache()
|
||||
|
||||
#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++"));
|
||||
));
|
||||
@ -146,7 +146,7 @@ void gen_FGasaDevOptionsCache()
|
||||
}
|
||||
|
||||
CodeFn CachedDevOptions = parse_function( token_fmt(
|
||||
"cached_property_assignments", (StrC)cached_property_assignments.to_string(),
|
||||
"cached_property_assignments", (Str)cached_property_assignments.to_strbuilder(),
|
||||
stringize(
|
||||
void FGasaDevOptionsCache::CachedDevOptions()
|
||||
{
|
||||
|
@ -13,10 +13,10 @@ void gen_UHostWidgetController()
|
||||
|
||||
CodeBody ori_HostWidgetController_header = parse_file(path_gasa_ui "HostWidgetController.h");
|
||||
{
|
||||
CodeBody header_body = def_body(ECode::Global_Body);
|
||||
CodeBody header_body = def_body(CT_Global_Body);
|
||||
|
||||
StrC str_UHostWidgetController = txt("UHostWidgetController");
|
||||
CodeClass ori_UHostWidgetController = NoCode;
|
||||
Str str_UHostWidgetController = txt("UHostWidgetController");
|
||||
CodeClass ori_UHostWidgetController = NullCode;
|
||||
|
||||
Code file_code = ori_HostWidgetController_header.begin();
|
||||
for ( ; file_code != ori_HostWidgetController_header.end(); ++ file_code )
|
||||
@ -30,14 +30,14 @@ void gen_UHostWidgetController()
|
||||
header_body.append(file_code);
|
||||
continue;
|
||||
|
||||
case ECode::Class:
|
||||
case CT_Class:
|
||||
if ( ! file_code->Name.starts_with(str_UHostWidgetController))
|
||||
continue;
|
||||
ori_UHostWidgetController = file_code.cast<CodeClass>();
|
||||
ori_UHostWidgetController = cast(CodeClass, file_code);
|
||||
++ file_code;
|
||||
goto found;
|
||||
|
||||
case ECode::Preprocess_Include:
|
||||
case CT_Preprocess_Include:
|
||||
header_body.append(file_code);
|
||||
|
||||
if ( file_code->Content.starts_with(txt("HostWidgetController.generated.h")))
|
||||
@ -47,7 +47,7 @@ void gen_UHostWidgetController()
|
||||
}
|
||||
continue;
|
||||
|
||||
case ECode::Untyped:
|
||||
case CT_Untyped:
|
||||
header_body.append(file_code);
|
||||
|
||||
if (file_code->Content.starts_with( txt("DECLARE_"))
|
||||
@ -58,7 +58,7 @@ void gen_UHostWidgetController()
|
||||
}
|
||||
}
|
||||
|
||||
CodeBody attribute_events = def_body(ECode::Class_Body);
|
||||
CodeBody attribute_events = def_body(CT_Class_Body);
|
||||
{
|
||||
attribute_events.append( def_comment( txt("Attribute Events are generated by GasaGen/GasaGen_HostWidgetController.cpp")));
|
||||
attribute_events.append(fmt_newline);
|
||||
@ -72,23 +72,23 @@ void gen_UHostWidgetController()
|
||||
));
|
||||
attribute_events.append(fmt_newline);
|
||||
attribute_events.append( parse_variable(
|
||||
token_fmt( "field", (StrC) attribute_field.Name, stringize( FAttributeChangedSig Event_On<field>Changed; ))
|
||||
token_fmt( "field", attribute_field.Name, stringize( FAttributeChangedSig Event_On<field>Changed; ))
|
||||
));
|
||||
attribute_events.append(fmt_newline);
|
||||
}
|
||||
|
||||
for ( s32 id = 0; id < attribute_fields.num(); ++id )
|
||||
{
|
||||
StringCached attribute_field = attribute_fields[id].Name;
|
||||
StrCached attribute_field = attribute_fields[id].Name;
|
||||
|
||||
attribute_events.append( parse_function(
|
||||
token_fmt( "field", (StrC) attribute_field, stringize( void <field>Changed(FOnAttributeChangeData const& Data); ))
|
||||
token_fmt( "field", attribute_field, stringize( void <field>Changed(FOnAttributeChangeData const& Data); ))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
CodeClass new_UHostWidgetController = ori_UHostWidgetController.duplicate().cast<CodeClass>();
|
||||
CodeBody new_body = def_body(ECode::Class_Body);
|
||||
CodeClass new_UHostWidgetController = cast(CodeClass, ori_UHostWidgetController.duplicate());
|
||||
CodeBody new_body = def_body(CT_Class_Body);
|
||||
for (Code code = ori_UHostWidgetController->Body.begin();
|
||||
code != ori_UHostWidgetController->Body.end();
|
||||
++ code )
|
||||
@ -99,7 +99,7 @@ void gen_UHostWidgetController()
|
||||
new_body.append(code);
|
||||
continue;
|
||||
|
||||
case ECode::Preprocess_Pragma:
|
||||
case CT_Preprocess_Pragma:
|
||||
{
|
||||
local_persist bool found = false;
|
||||
if (found)
|
||||
@ -108,7 +108,7 @@ void gen_UHostWidgetController()
|
||||
continue;
|
||||
}
|
||||
|
||||
CodePragma pragma = code.cast<CodePragma>();
|
||||
CodePragma pragma = cast(CodePragma, code);
|
||||
if ( pragma->Content.starts_with(txt("region Attribute Events")) )
|
||||
{
|
||||
new_body.append(pragma);
|
||||
@ -116,7 +116,7 @@ void gen_UHostWidgetController()
|
||||
|
||||
new_body.append(attribute_events);
|
||||
|
||||
while (code->Type != ECode::Preprocess_Pragma
|
||||
while (code->Type != CT_Preprocess_Pragma
|
||||
|| ! code->Content.starts_with(txt("endregion Attribute Events")))
|
||||
++ code;
|
||||
|
||||
@ -126,7 +126,7 @@ void gen_UHostWidgetController()
|
||||
}
|
||||
break;
|
||||
|
||||
case ECode::Untyped:
|
||||
case CT_Untyped:
|
||||
new_body.append(code);
|
||||
|
||||
if (code->Content.starts_with( txt("GENERATED_BODY")))
|
||||
@ -150,20 +150,20 @@ void gen_UHostWidgetController()
|
||||
|
||||
CodeBody ori_HostWidgetController_source = parse_file(path_gasa_ui "HostWidgetController.cpp");
|
||||
{
|
||||
CodeBody source_body = def_body(ECode::Global_Body);
|
||||
CodeBody source_body = def_body(CT_Global_Body);
|
||||
|
||||
CodeFn BroadcastInitialValues = NoCode;
|
||||
CodeFn BroadcastInitialValues = NullCode;
|
||||
{
|
||||
CodeBody broadcast_calls = def_body(ECode::Function_Body);
|
||||
CodeBody broadcast_calls = def_body(CT_Function_Body);
|
||||
for (GAS_AttributeEntry field : attribute_fields)
|
||||
{
|
||||
broadcast_calls.append( code_fmt( "field", (StrC)field.Name,
|
||||
broadcast_calls.append( code_fmt( "field", field.Name,
|
||||
stringize( Event_On<field>Changed.Broadcast( GasaAttribs->Get<field>() ); )
|
||||
));
|
||||
}
|
||||
|
||||
BroadcastInitialValues = parse_function( token_fmt(
|
||||
"broadcast_calls", (StrC)broadcast_calls.to_string(),
|
||||
"broadcast_calls", (Str)broadcast_calls.to_strbuilder(),
|
||||
"generation_notice", txt("\n// This function is managed by: GenGasa/GenGasa_HostWidgetController.cpp\n\n"),
|
||||
stringize(
|
||||
void UHostWidgetController::BroadcastInitialValues()
|
||||
@ -181,14 +181,14 @@ void gen_UHostWidgetController()
|
||||
));
|
||||
}
|
||||
|
||||
CodeFn BindCallbacksToDependencies = NoCode;
|
||||
CodeFn BindCallbacksToDependencies = NullCode;
|
||||
{
|
||||
CodeBody bindings = def_body(ECode::Function_Body);
|
||||
CodeBody bindings = def_body(CT_Function_Body);
|
||||
bindings.append(fmt_newline);
|
||||
bindings.append(fmt_newline);
|
||||
for (GAS_AttributeEntry field : attribute_fields)
|
||||
{
|
||||
bindings.append( code_fmt( "field", (StrC)field.Name,
|
||||
bindings.append( code_fmt( "field", field.Name,
|
||||
stringize(
|
||||
FOnGameplayAttributeValueChange& <field>AttributeChangedDelegate = AbilitySystem->GetGameplayAttributeValueChangeDelegate(GasaAttribs->Get<field>Attribute());
|
||||
<field>AttributeChangedDelegate.AddUObject(this, &ThisClass::<field>Changed);
|
||||
@ -199,7 +199,7 @@ void gen_UHostWidgetController()
|
||||
|
||||
BindCallbacksToDependencies = parse_function( token_fmt(
|
||||
"generation_notice", txt("\n// This function is managed by: GenGasa/GenGasa_HostWidgetController.cpp\n\n"),
|
||||
"bindings", (StrC)bindings.to_string(),
|
||||
"bindings", (Str)bindings.to_strbuilder(),
|
||||
stringize(
|
||||
void UHostWidgetController::BindCallbacksToDependencies()
|
||||
{
|
||||
@ -215,17 +215,17 @@ void gen_UHostWidgetController()
|
||||
));
|
||||
}
|
||||
|
||||
CodeBody attribute_callbacks = def_body(ECode::Global_Body);
|
||||
CodeBody attribute_callbacks = def_body(CT_Global_Body);
|
||||
{
|
||||
attribute_callbacks.append( def_comment(txt("Attribute Changed Callbacks are generated by GasaGen/GasaGen_HostWidgetController.cpp")));
|
||||
attribute_callbacks.append(fmt_newline);
|
||||
|
||||
for ( s32 id = 0; id < attribute_fields.num(); )
|
||||
{
|
||||
StringCached attribute_field = attribute_fields[id].Name;
|
||||
StrCached attribute_field = attribute_fields[id].Name;
|
||||
|
||||
attribute_callbacks.append( parse_function( token_fmt(
|
||||
"field", (StrC) attribute_field,
|
||||
"field", (Str) attribute_field,
|
||||
stringize(
|
||||
void UHostWidgetController::<field>Changed(FOnAttributeChangeData const& Attribute)
|
||||
{
|
||||
@ -248,7 +248,7 @@ void gen_UHostWidgetController()
|
||||
{
|
||||
switch (code->Type)
|
||||
{
|
||||
case ECode::Preprocess_Pragma:
|
||||
case CT_Preprocess_Pragma:
|
||||
{
|
||||
local_persist bool found = false;
|
||||
if (found)
|
||||
@ -258,7 +258,7 @@ void gen_UHostWidgetController()
|
||||
continue;
|
||||
}
|
||||
|
||||
CodePragma pragma = code.cast<CodePragma>();
|
||||
CodePragma pragma = cast(CodePragma, code);
|
||||
if ( pragma->Content.starts_with(txt("region Attribute Changed Callbacks")) )
|
||||
{
|
||||
source_body.append(fmt_newline);
|
||||
@ -267,7 +267,7 @@ void gen_UHostWidgetController()
|
||||
|
||||
source_body.append(attribute_callbacks);
|
||||
|
||||
while (code->Type != ECode::Preprocess_Pragma
|
||||
while (code->Type != CT_Preprocess_Pragma
|
||||
|| ! code->Content.starts_with(txt("endregion Attribute Changed Callbacks")))
|
||||
++ code;
|
||||
|
||||
@ -276,17 +276,17 @@ void gen_UHostWidgetController()
|
||||
}
|
||||
break;
|
||||
|
||||
case ECode::Function:
|
||||
CodeFn function_def = code.cast<CodeFn>();
|
||||
case CT_Function:
|
||||
CodeFn function_def = cast(CodeFn, code);
|
||||
|
||||
if ( String::are_equal(function_def->Name, BroadcastInitialValues->Name)
|
||||
if ( str_are_equal(function_def->Name, BroadcastInitialValues->Name)
|
||||
&& function_def->Params.is_equal(BroadcastInitialValues->Params))
|
||||
{
|
||||
source_body.append(BroadcastInitialValues);
|
||||
log_fmt("Swapped: %S\n", BroadcastInitialValues->Name);
|
||||
continue;
|
||||
}
|
||||
else if (String::are_equal(function_def->Name, BindCallbacksToDependencies->Name)
|
||||
else if (str_are_equal(function_def->Name, BindCallbacksToDependencies->Name)
|
||||
&& function_def->Params.is_equal(BindCallbacksToDependencies->Params))
|
||||
{
|
||||
source_body.append(BindCallbacksToDependencies);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
void gen_netslime_interface(CodeClass aclass)
|
||||
{
|
||||
CodeBody net_slime_class_interface = def_body(ECode::Class_Body);
|
||||
CodeBody net_slime_class_interface = def_body(CT_Class_Body);
|
||||
{
|
||||
#pragma push_macro("FORCEINLINE")
|
||||
#undef FORCEINLINE
|
||||
@ -44,7 +44,7 @@ void gen_netslime_interface(CodeClass aclass)
|
||||
net_slime_class_interface.append(NetLog);
|
||||
}
|
||||
|
||||
CodeBody new_body = def_body(ECode::Class_Body);
|
||||
CodeBody new_body = def_body(CT_Class_Body);
|
||||
for(Code code = aclass->Body.begin(); code != aclass->Body.end(); ++ code )
|
||||
{
|
||||
switch (code->Type)
|
||||
@ -55,7 +55,7 @@ void gen_netslime_interface(CodeClass aclass)
|
||||
|
||||
// TODO(Ed): Could this be turned into a singly? void find_and_swap_region_pragma(CodeClass, StrC region)
|
||||
// IT could return void if its assumed that the Code passed will have destructive edits to the body.
|
||||
case ECode::Preprocess_Pragma:
|
||||
case CT_Preprocess_Pragma:
|
||||
{
|
||||
local_persist bool found = false;
|
||||
if (found || ! code->Content.starts_with( txt("region NetSlime")))
|
||||
@ -71,7 +71,7 @@ void gen_netslime_interface(CodeClass aclass)
|
||||
new_body.append( def_comment( txt("NetSlime interface is generated by GasaGen/GasaGen_NetSlime.cpp")));
|
||||
new_body.append(net_slime_class_interface);
|
||||
|
||||
while (code->Type != ECode::Preprocess_Pragma
|
||||
while (code->Type != CT_Preprocess_Pragma
|
||||
|| ! code->Content.starts_with(txt("endregion NetSlime")))
|
||||
++ code;
|
||||
|
||||
@ -85,23 +85,23 @@ void gen_netslime_interface(CodeClass aclass)
|
||||
|
||||
void gen_netslime_interfaces()
|
||||
{
|
||||
Array<StringCached> header_paths = Array<StringCached>::init_reserve(GlobalAllocator, 32);
|
||||
Array<StrCached> header_paths = Array<StrCached>::init_reserve(ctx.Allocator_Temp, 32);
|
||||
// header_paths.append(get_cached_string(txt( path_module_gasa "GasaObject.h")));
|
||||
// header_paths.append(get_cached_string(txt( path_gasa_actors "GasaActor.h")));
|
||||
// header_paths.append(get_cached_string(txt( path_gasa_characters "GasaCharacter.h")));
|
||||
// header_paths.append(get_cached_string(txt( path_gasa_game "GasaGameMode.h")));
|
||||
// header_paths.append(get_cached_string(txt( path_gasa_game "GasaGameState.h")));
|
||||
|
||||
for (StringCached path : header_paths)
|
||||
for (StrCached path : header_paths)
|
||||
{
|
||||
CodeBody original_header = parse_file(path);
|
||||
CodeBody header_body = def_body(ECode::Global_Body);
|
||||
CodeBody header_body = def_body(CT_Global_Body);
|
||||
for (Code code : original_header)
|
||||
{
|
||||
switch (code->Type) {
|
||||
case ECode::Class:
|
||||
case CT_Class:
|
||||
{
|
||||
CodeClass aclass = code.cast<CodeClass>();
|
||||
CodeClass aclass = cast(CodeClass, code);
|
||||
gen_netslime_interface(aclass);
|
||||
header_body.append(aclass);
|
||||
}
|
||||
|
@ -9,35 +9,35 @@
|
||||
|
||||
struct GAS_AttributeEntry
|
||||
{
|
||||
StringCached Name;
|
||||
StrCached Name;
|
||||
// StringCached Description;
|
||||
// StringCached Category;
|
||||
StringCached MinName;
|
||||
StringCached MaxName;
|
||||
StrCached MinName;
|
||||
StrCached MaxName;
|
||||
float Min;
|
||||
float Max;
|
||||
};
|
||||
|
||||
void def_attribute_properties ( CodeBody body, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_on_reps ( CodeBody body, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_property_getters ( CodeBody body, StrC class_name, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_property_getters ( CodeBody body, Str class_name, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_value_getters ( CodeBody body, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_value_setters ( CodeBody body, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_property_setter_inlines( CodeBody body, StrC class_name, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_property_setter_inlines( CodeBody body, Str class_name, Array<GAS_AttributeEntry> properties );
|
||||
void def_attribute_field_initers ( CodeBody body, Array<GAS_AttributeEntry> properties );
|
||||
void impl_attribute_fields ( CodeBody body, StrC class_name, Array<GAS_AttributeEntry> properties );
|
||||
void impl_attribute_fields ( CodeBody body, Str class_name, Array<GAS_AttributeEntry> properties );
|
||||
|
||||
Array<GAS_AttributeEntry> get_gasa_primary_attribute_fields()
|
||||
{
|
||||
local_persist
|
||||
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, 64);
|
||||
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(ctx.Allocator_Temp, 64);
|
||||
|
||||
for (local_persist s32 do_once = 0; do_once == 0; ++ do_once)
|
||||
{
|
||||
StringCached str_Strength = get_cached_string(txt("Strength"));
|
||||
StringCached str_Intelligence = get_cached_string(txt("Intelligence"));
|
||||
StringCached str_Resilience = get_cached_string(txt("Resilience"));
|
||||
StringCached str_Vigor = get_cached_string(txt("Vigor"));
|
||||
StrCached str_Strength = cache_str(txt("Strength"));
|
||||
StrCached str_Intelligence = cache_str(txt("Intelligence"));
|
||||
StrCached str_Resilience = cache_str(txt("Resilience"));
|
||||
StrCached str_Vigor = cache_str(txt("Vigor"));
|
||||
|
||||
GAS_AttributeEntry Strength = { str_Strength, {nullptr}, {nullptr}, 0, 999.f };
|
||||
GAS_AttributeEntry Intelligence = { str_Intelligence, {nullptr}, {nullptr}, 0, 999.f };
|
||||
@ -55,14 +55,14 @@ Array<GAS_AttributeEntry> get_gasa_primary_attribute_fields()
|
||||
Array<GAS_AttributeEntry> get_gasa_secondary_attribute_fields()
|
||||
{
|
||||
local_persist
|
||||
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, 64);
|
||||
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(ctx.Allocator_Temp, 64);
|
||||
|
||||
for (local_persist s32 do_once = 0; do_once == 0; ++ do_once)
|
||||
{
|
||||
// StringCached str_Strength = get_cached_string(txt("Strength"));
|
||||
// StringCached str_Intelligence = get_cached_string(txt("Intelligence"));
|
||||
// StringCached str_Resilience = get_cached_string(txt("Resilience"));
|
||||
// StringCached str_Vigor = get_cached_string(txt("Vigor"));
|
||||
// StrCached str_Strength = cache_str(txt("Strength"));
|
||||
// StrCached str_Intelligence = cache_str(txt("Intelligence"));
|
||||
// StrCached str_Resilience = cache_str(txt("Resilience"));
|
||||
// StrCached str_Vigor = cache_str(txt("Vigor"));
|
||||
//
|
||||
// GAS_AttributeEntry Health = { str_Health, {nullptr}, str_MaxHealth, 0, 100.f };
|
||||
// GAS_AttributeEntry MaxHealth = { str_MaxHealth, {nullptr}, {nullptr}, 0, 99999.f };
|
||||
@ -75,14 +75,14 @@ Array<GAS_AttributeEntry> get_gasa_secondary_attribute_fields()
|
||||
Array<GAS_AttributeEntry> get_gasa_vital_attribute_fields()
|
||||
{
|
||||
local_persist
|
||||
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, 64);
|
||||
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(ctx.Allocator_Temp, 64);
|
||||
|
||||
for (local_persist s32 do_once = 0; do_once == 0; ++ do_once)
|
||||
{
|
||||
StringCached str_Health = get_cached_string(txt("Health"));
|
||||
StringCached str_MaxHealth = get_cached_string(txt("MaxHealth"));
|
||||
StringCached str_Mana = get_cached_string(txt("Mana"));
|
||||
StringCached str_MaxMana = get_cached_string(txt("MaxMana"));
|
||||
StrCached str_Health = cache_str(txt("Health"));
|
||||
StrCached str_MaxHealth = cache_str(txt("MaxHealth"));
|
||||
StrCached str_Mana = cache_str(txt("Mana"));
|
||||
StrCached str_MaxMana = cache_str(txt("MaxMana"));
|
||||
|
||||
GAS_AttributeEntry Health = { str_Health, {nullptr}, str_MaxHealth, 0, 100.f };
|
||||
GAS_AttributeEntry MaxHealth = { str_MaxHealth, {nullptr}, {nullptr}, 0, 99999.f };
|
||||
@ -99,7 +99,7 @@ Array<GAS_AttributeEntry> get_gasa_vital_attribute_fields()
|
||||
|
||||
void gen_UGasaAttributeSet()
|
||||
{
|
||||
CodeType type_UAttributeSet = def_type( txt("UAttributeSet") );
|
||||
CodeTypename type_UAttributeSet = def_type( txt("UAttributeSet") );
|
||||
CodeComment generation_notice = def_comment(txt("Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp"));
|
||||
|
||||
Array<GAS_AttributeEntry> primary_attribute_fields = get_gasa_primary_attribute_fields();
|
||||
@ -109,12 +109,12 @@ void gen_UGasaAttributeSet()
|
||||
s32 all_attrib_count = primary_attribute_fields.num() + secondary_attribute_fields.num() + vital_attribute_fields.num();
|
||||
|
||||
Array< GAS_AttributeEntry>
|
||||
all_attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, all_attrib_count);
|
||||
all_attribute_fields = Array<GAS_AttributeEntry>::init_reserve(ctx.Allocator_Temp, all_attrib_count);
|
||||
all_attribute_fields.append( primary_attribute_fields);
|
||||
all_attribute_fields.append( secondary_attribute_fields);
|
||||
all_attribute_fields.append( vital_attribute_fields);
|
||||
|
||||
StrC class_name = txt("UGasaAttributeSet");
|
||||
Str class_name = txt("UGasaAttributeSet");
|
||||
|
||||
Builder header = Builder::open( path_gasa_ability_system "GasaAttributeSet.h");
|
||||
{
|
||||
@ -132,7 +132,7 @@ void gen_UGasaAttributeSet()
|
||||
|
||||
CodeClass GasaAttributeSet = {};
|
||||
{
|
||||
CodeBody body = def_body( CodeT::Class_Body );
|
||||
CodeBody body = def_body( CT_Class_Body );
|
||||
{
|
||||
body.append( UHT_GENERATED_BODY);
|
||||
body.append( access_public );
|
||||
@ -201,9 +201,9 @@ void gen_UGasaAttributeSet()
|
||||
body.append( GetLifetimeOfReplicatedProps );
|
||||
body.append( def_pragma( txt("endregion UObject")));
|
||||
}
|
||||
GasaAttributeSet = def_class( class_name, body
|
||||
, type_UAttributeSet, AccessSpec::Public
|
||||
, api_attribute
|
||||
GasaAttributeSet = def_class( class_name, { body
|
||||
, type_UAttributeSet, AccessSpec_Public
|
||||
, api_attribute }
|
||||
);
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ void gen_UGasaAttributeSet()
|
||||
inlines.print( def_include(txt("AbilitySystemComponent.h")));
|
||||
inlines.print(fmt_newline);
|
||||
|
||||
CodeBody body = def_body(CodeT::Global_Body);
|
||||
CodeBody body = def_body(CT_Global_Body);
|
||||
{
|
||||
def_attribute_field_property_setter_inlines( body, class_name, all_attribute_fields );
|
||||
}
|
||||
@ -259,7 +259,7 @@ void gen_UGasaAttributeSet()
|
||||
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,32 +278,32 @@ void gen_UGasaAttributeSet()
|
||||
CodeFn PostGameplayEffectExecute;
|
||||
CodeFn PreAttributeChange;
|
||||
{
|
||||
CodeBody pre_attribute_clamps = def_body( CodeT::Function_Body );
|
||||
CodeBody pre_attribute_clamps = def_body( CT_Function_Body );
|
||||
pre_attribute_clamps.append(fmt_newline);
|
||||
pre_attribute_clamps.append(fmt_newline);
|
||||
|
||||
CodeBody post_attribute_clamps = def_body( CodeT::Function_Body );
|
||||
CodeBody post_attribute_clamps = def_body( CT_Function_Body );
|
||||
post_attribute_clamps.append(fmt_newline);
|
||||
post_attribute_clamps.append(fmt_newline);
|
||||
|
||||
for (GAS_AttributeEntry field : all_attribute_fields)
|
||||
{
|
||||
String clamp_min;
|
||||
if (field.MinName.Data)
|
||||
clamp_min = get_cached_string(token_fmt( "MinName", (StrC)field.MinName, "Get<MinName>()"));
|
||||
Str clamp_min;
|
||||
if (field.MinName)
|
||||
clamp_min = cache_str(token_fmt( "MinName", field.MinName, "Get<MinName>()"));
|
||||
else
|
||||
clamp_min = String::fmt_buf(GlobalAllocator, "%f", field.Min);
|
||||
clamp_min = StrBuilder::fmt_buf(ctx.Allocator_Temp, "%f", field.Min).to_str();
|
||||
|
||||
String clamp_max;
|
||||
if (field.MaxName.Data)
|
||||
clamp_max = get_cached_string(token_fmt( "MaxName", (StrC)field.MaxName, "Get<MaxName>()"));
|
||||
Str clamp_max;
|
||||
if (field.MaxName)
|
||||
clamp_max = cache_str(token_fmt( "MaxName", field.MaxName, "Get<MaxName>()"));
|
||||
else
|
||||
clamp_max = String::fmt_buf(GlobalAllocator, "%f", field.Max);
|
||||
clamp_max = StrBuilder::fmt_buf(ctx.Allocator_Temp, "%f", field.Max).to_str();
|
||||
|
||||
pre_attribute_clamps.append( code_fmt(
|
||||
"field", (StrC)field.Name,
|
||||
"clamp_min", (StrC)clamp_min,
|
||||
"clamp_max", (StrC)clamp_max,
|
||||
"field", field.Name,
|
||||
"clamp_min", clamp_min,
|
||||
"clamp_max", clamp_max,
|
||||
stringize(
|
||||
if (Attribute == Get<field>Attribute())
|
||||
{
|
||||
@ -312,9 +312,9 @@ void gen_UGasaAttributeSet()
|
||||
)));
|
||||
|
||||
post_attribute_clamps.append( code_fmt(
|
||||
"field", (StrC)field.Name,
|
||||
"clamp_min", (StrC)clamp_min,
|
||||
"clamp_max", (StrC)clamp_max,
|
||||
"field", field.Name,
|
||||
"clamp_min", clamp_min,
|
||||
"clamp_max", clamp_max,
|
||||
stringize(
|
||||
if ( Data.EvaluatedData.Attribute == Get<field>Attribute() )
|
||||
{
|
||||
@ -328,7 +328,7 @@ void gen_UGasaAttributeSet()
|
||||
post_attribute_clamps.append(fmt_newline);
|
||||
post_attribute_clamps.append(fmt_newline);
|
||||
|
||||
PreAttributeChange = parse_function( token_fmt( "attribute_clamps", (StrC)pre_attribute_clamps.to_string(), stringize(
|
||||
PreAttributeChange = parse_function( token_fmt( "attribute_clamps", (Str)pre_attribute_clamps.to_strbuilder(), stringize(
|
||||
void UGasaAttributeSet::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue)
|
||||
{
|
||||
Super::PreAttributeChange(Attribute, NewValue);
|
||||
@ -337,7 +337,7 @@ void gen_UGasaAttributeSet()
|
||||
}
|
||||
)));
|
||||
|
||||
PostGameplayEffectExecute = parse_function( token_fmt( "attribute_clamps", (StrC)post_attribute_clamps.to_string(), stringize(
|
||||
PostGameplayEffectExecute = parse_function( token_fmt( "attribute_clamps", (Str)post_attribute_clamps.to_strbuilder(), stringize(
|
||||
void UGasaAttributeSet::PostGameplayEffectExecute(FGameplayEffectModCallbackData const& Data)
|
||||
{
|
||||
Super::PostGameplayEffectExecute(Data);
|
||||
@ -356,17 +356,17 @@ void gen_UGasaAttributeSet()
|
||||
|
||||
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 (GAS_AttributeEntry field : all_attribute_fields)
|
||||
{
|
||||
field_lifetimes.append( code_fmt( "field", (StrC)field.Name, stringize(
|
||||
field_lifetimes.append( code_fmt( "field", field.Name, stringize(
|
||||
DOREPLIFETIME_DEFAULT_GAS(UGasaAttributeSet, <field>);
|
||||
)));
|
||||
}
|
||||
|
||||
GetLifetimeOfReplicatedProps = parse_function( token_fmt( "field_lifetimes", (StrC)(field_lifetimes.to_string()), stringize(
|
||||
GetLifetimeOfReplicatedProps = parse_function( token_fmt( "field_lifetimes", (Str)(field_lifetimes.to_strbuilder()), stringize(
|
||||
void UGasaAttributeSet::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||
@ -387,7 +387,7 @@ void def_attribute_properties( CodeBody body, Array<GAS_AttributeEntry> properti
|
||||
{
|
||||
for ( GAS_AttributeEntry property : properties )
|
||||
{
|
||||
Code field_uproperty = code_fmt( "property", (StrC)property.Name, stringize(
|
||||
Code field_uproperty = code_fmt( "property", property.Name, stringize(
|
||||
UPROPERTY(ReplicatedUsing=Client_OnRep_<property>, EditAnywhere, BlueprintReadWrite, Category="Attributes")
|
||||
FGameplayAttributeData <property>;
|
||||
));
|
||||
@ -404,18 +404,18 @@ void def_attribute_field_on_reps( CodeBody body, Array<GAS_AttributeEntry> prope
|
||||
body.append(fmt_newline);
|
||||
body.append( umeta_UFUNCTION );
|
||||
body.append(fmt_newline);
|
||||
body.append( code_fmt( "property", (StrC)property.Name, stringize(
|
||||
body.append( code_fmt( "property", property.Name, stringize(
|
||||
void Client_OnRep_<property>(FGameplayAttributeData& Prev<property>);
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
void def_attribute_field_property_getters( CodeBody body, StrC class_name, Array<GAS_AttributeEntry> properties )
|
||||
void def_attribute_field_property_getters( CodeBody body, Str class_name, Array<GAS_AttributeEntry> properties )
|
||||
{
|
||||
for ( GAS_AttributeEntry property : properties )
|
||||
{
|
||||
CodeFn generated_get_attribute = parse_function(
|
||||
token_fmt( "class_name", class_name, "property", (StrC)property.Name,
|
||||
token_fmt( "class_name", class_name, "property", property.Name,
|
||||
stringize(
|
||||
static FGameplayAttribute Get<property>Attribute()
|
||||
{
|
||||
@ -433,7 +433,7 @@ void def_attribute_field_value_getters( CodeBody body, Array<GAS_AttributeEntry>
|
||||
{
|
||||
for ( GAS_AttributeEntry property : properties )
|
||||
{
|
||||
body.append( code_fmt( "property", (StrC)property.Name,
|
||||
body.append( code_fmt( "property", property.Name,
|
||||
stringize(
|
||||
FORCEINLINE float Get<property>() const
|
||||
{
|
||||
@ -447,20 +447,20 @@ void def_attribute_field_value_setters( CodeBody body, Array<GAS_AttributeEntry>
|
||||
{
|
||||
for ( GAS_AttributeEntry property : properties )
|
||||
{
|
||||
body.append( code_fmt( "property", (StrC)property.Name,
|
||||
body.append( code_fmt( "property", property.Name,
|
||||
stringize(
|
||||
FORCEINLINE void Set<property>(float NewVal);
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
void def_attribute_field_property_setter_inlines( CodeBody body, StrC class_name, Array<GAS_AttributeEntry> properties )
|
||||
void def_attribute_field_property_setter_inlines( CodeBody body, Str class_name, Array<GAS_AttributeEntry> properties )
|
||||
{
|
||||
body.append(def_pragma( txt("region Attribute Setters")));
|
||||
for ( GAS_AttributeEntry property : properties )
|
||||
{
|
||||
CodeFn generated_get_attribute = parse_function(
|
||||
token_fmt( "class_name", class_name, "property", (StrC)property.Name,
|
||||
token_fmt( "class_name", class_name, "property", property.Name,
|
||||
stringize(
|
||||
FORCEINLINE void <class_name>::Set<property>(float NewVal)
|
||||
{
|
||||
@ -480,7 +480,7 @@ void def_attribute_field_initers ( CodeBody body, Array<GAS_AttributeEntry> prop
|
||||
{
|
||||
for ( GAS_AttributeEntry property : properties )
|
||||
{
|
||||
body.append( code_fmt( "property", (StrC)property.Name,
|
||||
body.append( code_fmt( "property", property.Name,
|
||||
stringize(
|
||||
FORCEINLINE void Init<property>(float NewVal)
|
||||
{
|
||||
@ -491,14 +491,14 @@ void def_attribute_field_initers ( CodeBody body, Array<GAS_AttributeEntry> prop
|
||||
}
|
||||
}
|
||||
|
||||
void impl_attribute_fields( CodeBody body, StrC class_name, Array<GAS_AttributeEntry> properties )
|
||||
void impl_attribute_fields( CodeBody body, Str class_name, Array<GAS_AttributeEntry> properties )
|
||||
{
|
||||
body.append(fmt_newline);
|
||||
body.append(def_pragma( txt("region Rep Notifies")));
|
||||
for ( GAS_AttributeEntry property : properties )
|
||||
{
|
||||
CodeFn field_impl = parse_function( token_fmt(
|
||||
"class_name", class_name, "property", (StrC)property.Name, "from_notice", txt("\n// From GAMEPLAYATTRIBUTE_REPNOTIFY\n"),
|
||||
"class_name", class_name, "property", property.Name, "from_notice", txt("\n// From GAMEPLAYATTRIBUTE_REPNOTIFY\n"),
|
||||
stringize(
|
||||
void <class_name>::Client_OnRep_<property>(FGameplayAttributeData& Prev<property>)
|
||||
{
|
||||
@ -515,7 +515,7 @@ void impl_attribute_fields( CodeBody body, StrC class_name, Array<GAS_AttributeE
|
||||
}
|
||||
|
||||
inline
|
||||
Code gen_GAMEPLAYATTRIBUTE_REPNOTIFY(StrC class_name, StrC property_name, StrC old_value)
|
||||
Code gen_GAMEPLAYATTRIBUTE_REPNOTIFY(Str class_name, Str property_name, Str old_value)
|
||||
{
|
||||
Code rep_notify = code_fmt(
|
||||
"class_name", class_name
|
||||
|
@ -15,28 +15,28 @@ void ue_parse_testing()
|
||||
"C:/projects/Unreal/Surgo/UE/Engine/Source/Runtime/UMG/Public/Components/ProgressBar.h"
|
||||
|
||||
#if 1
|
||||
content = file_read_contents( GlobalAllocator, true, path_UProgressBar );
|
||||
CodeBody parsed_uprogressbar = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
content = file_read_contents( ctx.Allocator_Temp, true, path_UProgressBar );
|
||||
CodeBody parsed_uprogressbar = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
log_fmt("\n\n");
|
||||
for ( Code gcode : parsed_uprogressbar )
|
||||
{
|
||||
if ( gcode->Type == CodeT::Class )
|
||||
if ( gcode->Type == CT_Class )
|
||||
{
|
||||
log_fmt("Class %S - Definitions:\n", gcode->Name);
|
||||
|
||||
if (gcode->Body->Type != CodeT::Class_Body)
|
||||
if (gcode->Body->Type != CT_Class_Body)
|
||||
continue;
|
||||
for ( Code class_code : gcode->Body->cast<CodeBody>() )
|
||||
for ( Code class_code : cast(CodeBody, gcode->Body) )
|
||||
{
|
||||
switch ( class_code->Type )
|
||||
{
|
||||
case CodeT::Variable:
|
||||
case CodeT::Function:
|
||||
case CodeT::Function_Fwd:
|
||||
case CT_Variable:
|
||||
case CT_Function:
|
||||
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;
|
||||
@ -50,31 +50,31 @@ void ue_parse_testing()
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Runtime\CoreUObject\Public\UObject\Object.h)"
|
||||
|
||||
#if 1
|
||||
content = file_read_contents( GlobalAllocator, true, path_UObject );
|
||||
CodeBody parsed_uobject = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
content = file_read_contents( ctx.Allocator_Temp, true, path_UObject );
|
||||
CodeBody parsed_uobject = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
log_fmt("\n\n");
|
||||
for ( Code gcode : parsed_uobject )
|
||||
{
|
||||
if ( gcode->Type == CodeT::Class )
|
||||
if ( gcode->Type == CT_Class )
|
||||
{
|
||||
log_fmt("Class %S - Definitions:\n", gcode->Name);
|
||||
// log_fmt("%s\n", gcode->to_string() );
|
||||
|
||||
if (gcode->Body->Type != CodeT::Class_Body)
|
||||
if (gcode->Body->Type != CT_Class_Body)
|
||||
continue;
|
||||
for ( Code class_code : gcode->Body->cast<CodeBody>() )
|
||||
for ( Code class_code : cast(CodeBody, gcode->Body) )
|
||||
{
|
||||
switch ( class_code->Type )
|
||||
{
|
||||
case CodeT::Constructor:
|
||||
case CodeT::Constructor_Fwd:
|
||||
case CodeT::Variable:
|
||||
case CodeT::Function:
|
||||
case CodeT::Function_Fwd:
|
||||
case CT_Constructor:
|
||||
case CT_Constructor_Fwd:
|
||||
case CT_Variable:
|
||||
case CT_Function:
|
||||
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;
|
||||
@ -88,28 +88,28 @@ void ue_parse_testing()
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Runtime\Engine\Classes\GameFramework\Actor.h)"
|
||||
|
||||
#if 1
|
||||
content = file_read_contents( GlobalAllocator, true, path_AActor );
|
||||
CodeBody parsed_aactor = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
content = file_read_contents( ctx.Allocator_Temp, true, path_AActor );
|
||||
CodeBody parsed_aactor = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
log_fmt("\n\n");
|
||||
for ( Code gcode : parsed_aactor )
|
||||
{
|
||||
if ( gcode->Type == CodeT::Class )
|
||||
if ( gcode->Type == CT_Class )
|
||||
{
|
||||
log_fmt("Class %S - Definitions:\n", gcode->Name);
|
||||
|
||||
if (gcode->Body->Type != CodeT::Class_Body)
|
||||
if (gcode->Body->Type != CT_Class_Body)
|
||||
continue;
|
||||
for ( Code class_code : gcode->Body->cast<CodeBody>() )
|
||||
for ( Code class_code : cast(CodeBody, gcode->Body) )
|
||||
{
|
||||
switch ( class_code->Type )
|
||||
{
|
||||
// case CodeT::Variable:
|
||||
case CodeT::Function:
|
||||
case CodeT::Function_Fwd:
|
||||
case CT_Function:
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -122,28 +122,28 @@ void ue_parse_testing()
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Runtime\Engine\Classes\Components\ActorComponent.h)"
|
||||
|
||||
#if 1
|
||||
content = file_read_contents( GlobalAllocator, true, path_ActorComponent );
|
||||
CodeBody parsed_actor_component = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
content = file_read_contents( ctx.Allocator_Temp, true, path_ActorComponent );
|
||||
CodeBody parsed_actor_component = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
for ( Code gcode : parsed_actor_component )
|
||||
{
|
||||
if ( gcode->Type == CodeT::Class )
|
||||
if ( gcode->Type == CT_Class )
|
||||
{
|
||||
log_fmt("\n\n");
|
||||
log_fmt("Class %S - Definitions:\n", gcode->Name);
|
||||
|
||||
if (gcode->Body->Type != CodeT::Class_Body)
|
||||
if (gcode->Body->Type != CT_Class_Body)
|
||||
continue;
|
||||
for ( Code class_code : gcode->Body->cast<CodeBody>() )
|
||||
for ( Code class_code : cast(CodeBody, gcode->Body) )
|
||||
{
|
||||
switch ( class_code->Type )
|
||||
{
|
||||
case CodeT::Variable:
|
||||
case CodeT::Function:
|
||||
case CodeT::Function_Fwd:
|
||||
case CT_Variable:
|
||||
case CT_Function:
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -156,28 +156,28 @@ void ue_parse_testing()
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Source\Runtime\Engine\Classes\Components\SceneComponent.h)"
|
||||
|
||||
#if 1
|
||||
content = file_read_contents( GlobalAllocator, true, path_SceneComponent );
|
||||
CodeBody parsed_scene_component = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
content = file_read_contents( ctx.Allocator_Temp, true, path_SceneComponent );
|
||||
CodeBody parsed_scene_component = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
for ( Code gcode : parsed_scene_component )
|
||||
{
|
||||
if ( gcode->Type == CodeT::Class )
|
||||
if ( gcode->Type == CT_Class )
|
||||
{
|
||||
log_fmt("\n\n");
|
||||
log_fmt("Class %S - Definitions:\n", gcode->Name);
|
||||
|
||||
if (gcode->Body->Type != CodeT::Class_Body)
|
||||
if (gcode->Body->Type != CT_Class_Body)
|
||||
continue;
|
||||
for ( Code class_code : gcode->Body->cast<CodeBody>() )
|
||||
for ( Code class_code : cast(CodeBody, gcode->Body) )
|
||||
{
|
||||
switch ( class_code->Type )
|
||||
{
|
||||
case CodeT::Variable:
|
||||
case CodeT::Function:
|
||||
case CodeT::Function_Fwd:
|
||||
case CT_Variable:
|
||||
case CT_Function:
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -190,28 +190,28 @@ void ue_parse_testing()
|
||||
R"(C:\projects\Unreal\Surgo\UE\Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Public\AttributeSet.h)"
|
||||
|
||||
#if 1
|
||||
content = file_read_contents( GlobalAllocator, true, path_AttributeSet );
|
||||
CodeBody parsed_attribute_set = parse_global_body( StrC { content.size, (char const*)content.data });
|
||||
content = file_read_contents( ctx.Allocator_Temp, true, path_AttributeSet );
|
||||
CodeBody parsed_attribute_set = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
for ( Code gcode : parsed_attribute_set )
|
||||
{
|
||||
if ( gcode->Type == CodeT::Class )
|
||||
if ( gcode->Type == CT_Class )
|
||||
{
|
||||
log_fmt("\n\n");
|
||||
log_fmt("Class %S - Definitions:\n", gcode->Name);
|
||||
|
||||
if (gcode->Body->Type != CodeT::Class_Body)
|
||||
if (gcode->Body->Type != CT_Class_Body)
|
||||
continue;
|
||||
for ( Code class_code : gcode->Body->cast<CodeBody>() )
|
||||
for ( Code class_code : cast(CodeBody, gcode->Body) )
|
||||
{
|
||||
switch ( class_code->Type )
|
||||
{
|
||||
case CodeT::Variable:
|
||||
case CodeT::Function:
|
||||
case CodeT::Function_Fwd:
|
||||
case CT_Variable:
|
||||
case CT_Function:
|
||||
case CT_Function_Fwd:
|
||||
if ( class_code->Name )
|
||||
{
|
||||
log_fmt("%s\n", class_code->Name );
|
||||
log_fmt("%S\n", class_code->Name );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1,62 +1,95 @@
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# 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__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#include "gen.builder.hpp"
|
||||
|
||||
GEN_NS_BEGIN
|
||||
|
||||
Builder Builder::open( char const* path )
|
||||
#pragma region Builder
|
||||
|
||||
Builder builder_open( char const* path )
|
||||
{
|
||||
Builder result;
|
||||
|
||||
FileError error = file_open_mode( &result.File, EFileMode_WRITE, path );
|
||||
FileError error = file_open_mode( & result.File, EFileMode_WRITE, path );
|
||||
if ( error != EFileError_NONE )
|
||||
{
|
||||
log_failure( "gen::File::open - Could not open file: %s", path );
|
||||
log_failure( "gen::File::open - Could not open file: %s", 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();
|
||||
// const sw len = str.length();
|
||||
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 )
|
||||
{
|
||||
sw res;
|
||||
char buf[GEN_PRINTF_MAXLEN] = { 0 };
|
||||
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)
|
||||
{
|
||||
bool 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__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -1,4 +1,26 @@
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# 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__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -6,19 +28,65 @@
|
||||
|
||||
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_print_fmt ( Builder* builder, char const* fmt, ... ) {
|
||||
va_list va;
|
||||
va_start( va, fmt );
|
||||
builder_print_fmt_va( builder, fmt, va );
|
||||
va_end( va );
|
||||
}
|
||||
void builder_write( Builder* builder );
|
||||
|
||||
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
|
||||
void builder_pad_lines( Builder& builder, s32 num ) { return builder_pad_lines(& builder, num); }
|
||||
void builder_print ( Builder& builder, Code code ) { return builder_print(& builder, code); }
|
||||
void builder_write ( Builder& builder ) { return builder_write(& builder ); }
|
||||
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__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
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
@ -1,4 +1,26 @@
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# 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__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#include "gen.scanner.hpp"
|
||||
|
||||
@ -9,7 +31,7 @@ GEN_NS_BEGIN
|
||||
#define _adt_fprintf( s_, fmt_, ... ) \
|
||||
do \
|
||||
{ \
|
||||
if ( str_fmt_file( s_, fmt_, ##__VA_ARGS__ ) < 0 ) \
|
||||
if ( c_str_fmt_file( s_, fmt_, ##__VA_ARGS__ ) < 0 ) \
|
||||
return EADT_ERROR_OUT_OF_MEMORY; \
|
||||
} while ( 0 )
|
||||
|
||||
@ -25,7 +47,7 @@ u8 adt_make_branch( ADT_Node* node, AllocatorInfo backing, char const* name, b32
|
||||
node->type = type;
|
||||
node->name = name;
|
||||
node->parent = parent;
|
||||
node->nodes = Array<ADT_Node>::init( backing );
|
||||
node->nodes = array_init(ADT_Node, backing );
|
||||
|
||||
if ( ! node->nodes )
|
||||
return EADT_ERROR_OUT_OF_MEMORY;
|
||||
@ -38,12 +60,12 @@ u8 adt_destroy_branch( ADT_Node* node )
|
||||
GEN_ASSERT_NOT_NULL( node );
|
||||
if ( ( node->type == EADT_TYPE_OBJECT || node->type == EADT_TYPE_ARRAY ) && node->nodes )
|
||||
{
|
||||
for ( sw i = 0; i < node->nodes.num(); ++i )
|
||||
for ( ssize i = 0; i < scast(ssize, array_num(node->nodes)); ++i )
|
||||
{
|
||||
adt_destroy_branch( node->nodes + i );
|
||||
}
|
||||
|
||||
node->nodes.free();
|
||||
array_free(node->nodes);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -68,9 +90,9 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for ( sw i = 0; i < node->nodes.num(); i++ )
|
||||
for ( ssize i = 0; i < scast(ssize, array_num(node->nodes)); i++ )
|
||||
{
|
||||
if ( ! str_compare( node->nodes[i].name, name ) )
|
||||
if ( ! c_str_compare( node->nodes[ i ].name, name ) )
|
||||
{
|
||||
return ( node->nodes + i );
|
||||
}
|
||||
@ -78,7 +100,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search )
|
||||
|
||||
if ( deep_search )
|
||||
{
|
||||
for ( sw i = 0; i < node->nodes.num(); i++ )
|
||||
for ( ssize i = 0; i < scast(ssize, array_num(node->nodes)); i++ )
|
||||
{
|
||||
ADT_Node* res = adt_find( node->nodes + i, name, deep_search );
|
||||
|
||||
@ -97,7 +119,7 @@ internal ADT_Node* _adt_get_value( ADT_Node* node, char const* value )
|
||||
case EADT_TYPE_MULTISTRING :
|
||||
case EADT_TYPE_STRING :
|
||||
{
|
||||
if ( node->string && ! str_compare( node->string, value ) )
|
||||
if ( node->string && ! c_str_compare( node->string, value ) )
|
||||
{
|
||||
return node;
|
||||
}
|
||||
@ -106,17 +128,17 @@ internal ADT_Node* _adt_get_value( ADT_Node* node, char const* value )
|
||||
case EADT_TYPE_INTEGER :
|
||||
case EADT_TYPE_REAL :
|
||||
{
|
||||
char back[4096] = { 0 };
|
||||
char back[ 4096 ] = { 0 };
|
||||
FileInfo tmp;
|
||||
|
||||
/* allocate a file descriptor for a memory-mapped number to string conversion, input source buffer is not cloned, however. */
|
||||
file_stream_open( &tmp, heap(), (u8*)back, size_of( back ), EFileStream_WRITABLE );
|
||||
file_stream_open( &tmp, heap(), ( u8* )back, size_of( back ), EFileStream_WRITABLE );
|
||||
adt_print_number( &tmp, node );
|
||||
|
||||
sw fsize = 0;
|
||||
ssize fsize = 0;
|
||||
u8* buf = file_stream_buf( &tmp, &fsize );
|
||||
|
||||
if ( ! str_compare( (char const*)buf, value ) )
|
||||
if ( ! c_str_compare( ( char const* )buf, value ) )
|
||||
{
|
||||
file_close( &tmp );
|
||||
return node;
|
||||
@ -134,11 +156,11 @@ internal ADT_Node* _adt_get_value( ADT_Node* node, char const* value )
|
||||
|
||||
internal ADT_Node* _adt_get_field( ADT_Node* node, char* name, char* value )
|
||||
{
|
||||
for ( sw i = 0; i < node->nodes.num(); i++ )
|
||||
for ( ssize i = 0; i < scast(ssize, array_num(node->nodes)); i++ )
|
||||
{
|
||||
if ( ! str_compare( node->nodes[i].name, name ) )
|
||||
if ( ! c_str_compare( node->nodes[ i ].name, name ) )
|
||||
{
|
||||
ADT_Node* child = &node->nodes[i];
|
||||
ADT_Node* child = &node->nodes[ i ];
|
||||
if ( _adt_get_value( child, value ) )
|
||||
{
|
||||
return node; /* this object does contain a field of a specified value! */
|
||||
@ -169,22 +191,22 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
|
||||
}
|
||||
|
||||
#if defined EADT_URI_DEBUG || 0
|
||||
str_fmt_out( "uri: %s\n", uri );
|
||||
c_str_fmt_out( "uri: %s\n", uri );
|
||||
#endif
|
||||
|
||||
char * p = (char*)uri, *b = p, *e = p;
|
||||
char * p = ( char* )uri, *b = p, *e = p;
|
||||
ADT_Node* found_node = NULL;
|
||||
|
||||
b = p;
|
||||
p = e = (char*)str_skip( p, '/' );
|
||||
char* buf = str_fmt_buf( "%.*s", (int)( e - b ), b );
|
||||
p = e = ( char* )c_str_skip( p, '/' );
|
||||
char* buf = c_str_fmt_buf( "%.*s", ( int )( e - b ), b );
|
||||
|
||||
/* handle field value lookup */
|
||||
if ( *b == '[' )
|
||||
{
|
||||
char *l_p = buf + 1, *l_b = l_p, *l_e = l_p, *l_b2 = l_p, *l_e2 = l_p;
|
||||
l_e = (char*)str_skip( l_p, '=' );
|
||||
l_e2 = (char*)str_skip( l_p, ']' );
|
||||
l_e = ( char* )c_str_skip( l_p, '=' );
|
||||
l_e2 = ( char* )c_str_skip( l_p, ']' );
|
||||
|
||||
if ( ( ! *l_e && node->type != EADT_TYPE_ARRAY ) || ! *l_e2 )
|
||||
{
|
||||
@ -209,9 +231,9 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
|
||||
/* run a value comparison against any child that is an object node */
|
||||
else if ( node->type == EADT_TYPE_ARRAY )
|
||||
{
|
||||
for ( sw i = 0; i < node->nodes.num(); i++ )
|
||||
for ( ssize i = 0; i < scast(ssize, array_num(node->nodes)); i++ )
|
||||
{
|
||||
ADT_Node* child = &node->nodes[i];
|
||||
ADT_Node* child = &node->nodes[ i ];
|
||||
if ( child->type != EADT_TYPE_OBJECT )
|
||||
{
|
||||
continue;
|
||||
@ -227,9 +249,9 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
|
||||
/* [value] */
|
||||
else
|
||||
{
|
||||
for ( sw i = 0; i < node->nodes.num(); i++ )
|
||||
for ( ssize i = 0; i < scast(ssize, array_num(node->nodes)); i++ )
|
||||
{
|
||||
ADT_Node* child = &node->nodes[i];
|
||||
ADT_Node* child = &node->nodes[ i ];
|
||||
if ( _adt_get_value( child, l_b2 ) )
|
||||
{
|
||||
found_node = child;
|
||||
@ -258,10 +280,10 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
|
||||
/* handle array index lookup */
|
||||
else
|
||||
{
|
||||
sw idx = (sw)str_to_i64( buf, NULL, 10 );
|
||||
if ( idx >= 0 && idx < node->nodes.num() )
|
||||
ssize idx = ( ssize )c_str_to_i64( buf, NULL, 10 );
|
||||
if ( idx >= 0 && idx < scast(ssize, array_num(node->nodes)) )
|
||||
{
|
||||
found_node = &node->nodes[idx];
|
||||
found_node = &node->nodes[ idx ];
|
||||
|
||||
/* go deeper if uri continues */
|
||||
if ( *e )
|
||||
@ -274,7 +296,7 @@ ADT_Node* adt_query( ADT_Node* node, char const* uri )
|
||||
return found_node;
|
||||
}
|
||||
|
||||
ADT_Node* adt_alloc_at( ADT_Node* parent, sw index )
|
||||
ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index )
|
||||
{
|
||||
if ( ! parent || ( parent->type != EADT_TYPE_OBJECT && parent->type != EADT_TYPE_ARRAY ) )
|
||||
{
|
||||
@ -284,15 +306,16 @@ ADT_Node* adt_alloc_at( ADT_Node* parent, sw index )
|
||||
if ( ! parent->nodes )
|
||||
return NULL;
|
||||
|
||||
if ( index < 0 || index > parent->nodes.num() )
|
||||
if ( index < 0 || index > scast(ssize, array_num(parent->nodes)) )
|
||||
return NULL;
|
||||
|
||||
ADT_Node o = { 0 };
|
||||
o.parent = parent;
|
||||
if ( ! parent->nodes.append_at( o, index ) )
|
||||
if ( ! array_append_at( parent->nodes, o, index ) )
|
||||
return NULL;
|
||||
|
||||
return parent->nodes + index;
|
||||
ADT_Node* node = & parent->nodes[index];
|
||||
return node;
|
||||
}
|
||||
|
||||
ADT_Node* adt_alloc( ADT_Node* parent )
|
||||
@ -305,7 +328,7 @@ ADT_Node* adt_alloc( ADT_Node* parent )
|
||||
if ( ! parent->nodes )
|
||||
return NULL;
|
||||
|
||||
return adt_alloc_at( parent, parent->nodes.num() );
|
||||
return adt_alloc_at( parent, array_num(parent->nodes) );
|
||||
}
|
||||
|
||||
b8 adt_set_obj( ADT_Node* obj, char const* name, AllocatorInfo backing )
|
||||
@ -339,7 +362,7 @@ b8 adt_set_int( ADT_Node* obj, char const* name, s64 value )
|
||||
return true;
|
||||
}
|
||||
|
||||
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, sw index )
|
||||
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index )
|
||||
{
|
||||
GEN_ASSERT_NOT_NULL( node );
|
||||
GEN_ASSERT_NOT_NULL( new_parent );
|
||||
@ -359,7 +382,7 @@ ADT_Node* adt_move_node( ADT_Node* node, ADT_Node* new_parent )
|
||||
GEN_ASSERT_NOT_NULL( node );
|
||||
GEN_ASSERT_NOT_NULL( new_parent );
|
||||
GEN_ASSERT( new_parent->type == EADT_TYPE_ARRAY || new_parent->type == EADT_TYPE_OBJECT );
|
||||
return adt_move_node_at( node, new_parent, new_parent->nodes.num() );
|
||||
return adt_move_node_at( node, new_parent, array_num(new_parent->nodes) );
|
||||
}
|
||||
|
||||
void adt_swap_nodes( ADT_Node* node, ADT_Node* other_node )
|
||||
@ -368,13 +391,13 @@ void adt_swap_nodes( ADT_Node* node, ADT_Node* other_node )
|
||||
GEN_ASSERT_NOT_NULL( other_node );
|
||||
ADT_Node* parent = node->parent;
|
||||
ADT_Node* other_parent = other_node->parent;
|
||||
sw index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
|
||||
sw index2 = ( pointer_diff( other_parent->nodes, other_node ) / size_of( ADT_Node ) );
|
||||
ADT_Node temp = parent->nodes[index];
|
||||
ssize index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
|
||||
ssize index2 = ( pointer_diff( other_parent->nodes, other_node ) / size_of( ADT_Node ) );
|
||||
ADT_Node temp = parent->nodes[ index ];
|
||||
temp.parent = other_parent;
|
||||
other_parent->nodes[index2].parent = parent;
|
||||
parent->nodes[index] = other_parent->nodes[index2];
|
||||
other_parent->nodes[index2] = temp;
|
||||
other_parent->nodes[ index2 ].parent = parent;
|
||||
parent->nodes[ index ] = other_parent->nodes[ index2 ];
|
||||
other_parent->nodes[ index2 ] = temp;
|
||||
}
|
||||
|
||||
void adt_remove_node( ADT_Node* node )
|
||||
@ -382,8 +405,8 @@ void adt_remove_node( ADT_Node* node )
|
||||
GEN_ASSERT_NOT_NULL( node );
|
||||
GEN_ASSERT_NOT_NULL( node->parent );
|
||||
ADT_Node* parent = node->parent;
|
||||
sw index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
|
||||
parent->nodes.remove_at( index );
|
||||
ssize index = ( pointer_diff( parent->nodes, node ) / size_of( ADT_Node ) );
|
||||
array_remove_at( parent->nodes, index );
|
||||
}
|
||||
|
||||
ADT_Node* adt_append_obj( ADT_Node* parent, char const* name )
|
||||
@ -391,7 +414,7 @@ ADT_Node* adt_append_obj( ADT_Node* parent, char const* name )
|
||||
ADT_Node* o = adt_alloc( parent );
|
||||
if ( ! o )
|
||||
return NULL;
|
||||
if ( adt_set_obj( o, name, parent->nodes.get_header()->Allocator ) )
|
||||
if ( adt_set_obj( o, name, array_get_header(parent->nodes)->Allocator ) )
|
||||
{
|
||||
adt_remove_node( o );
|
||||
return NULL;
|
||||
@ -404,7 +427,9 @@ ADT_Node* adt_append_arr( ADT_Node* parent, char const* name )
|
||||
ADT_Node* o = adt_alloc( parent );
|
||||
if ( ! o )
|
||||
return NULL;
|
||||
if ( adt_set_arr( o, name, parent->nodes.get_header()->Allocator ) )
|
||||
|
||||
ArrayHeader* node_header = array_get_header(parent->nodes);
|
||||
if ( adt_set_arr( o, name, node_header->Allocator ) )
|
||||
{
|
||||
adt_remove_node( o );
|
||||
return NULL;
|
||||
@ -449,7 +474,7 @@ char* adt_parse_number_strict( ADT_Node* node, char* base_str )
|
||||
while ( *e )
|
||||
++e;
|
||||
|
||||
while ( *p && ( str_find( "eE.+-", *p ) || char_is_hex_digit( *p ) ) )
|
||||
while ( *p && ( char_first_occurence( "eE.+-", *p ) || char_is_hex_digit( *p ) ) )
|
||||
{
|
||||
++p;
|
||||
}
|
||||
@ -478,7 +503,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
u8 node_props = 0;
|
||||
|
||||
/* skip false positives and special cases */
|
||||
if ( ! ! str_find( "eE", *p ) || ( ! ! str_find( ".+-", *p ) && ! char_is_hex_digit( *( p + 1 ) ) && *( p + 1 ) != '.' ) )
|
||||
if ( ! ! char_first_occurence( "eE", *p ) || ( ! ! char_first_occurence( ".+-", *p ) && ! char_is_hex_digit( *( p + 1 ) ) && *( p + 1 ) != '.' ) )
|
||||
{
|
||||
return ++base_str;
|
||||
}
|
||||
@ -486,14 +511,14 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
node_type = EADT_TYPE_INTEGER;
|
||||
neg_zero = false;
|
||||
|
||||
sw ib = 0;
|
||||
char buf[48] = { 0 };
|
||||
ssize ib = 0;
|
||||
char buf[ 48 ] = { 0 };
|
||||
|
||||
if ( *e == '+' )
|
||||
++e;
|
||||
else if ( *e == '-' )
|
||||
{
|
||||
buf[ib++] = *e++;
|
||||
buf[ ib++ ] = *e++;
|
||||
}
|
||||
|
||||
if ( *e == '.' )
|
||||
@ -501,15 +526,15 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
node_type = EADT_TYPE_REAL;
|
||||
node_props = EADT_PROPS_IS_PARSED_REAL;
|
||||
lead_digit = false;
|
||||
buf[ib++] = '0';
|
||||
buf[ ib++ ] = '0';
|
||||
do
|
||||
{
|
||||
buf[ib++] = *e;
|
||||
buf[ ib++ ] = *e;
|
||||
} while ( char_is_digit( *++e ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! str_compare( e, "0x", 2 ) || ! str_compare( e, "0X", 2 ) )
|
||||
if ( ! c_str_compare_len( e, "0x", 2 ) || ! c_str_compare_len( e, "0X", 2 ) )
|
||||
{
|
||||
node_props = EADT_PROPS_IS_HEX;
|
||||
}
|
||||
@ -522,7 +547,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
|
||||
while ( char_is_hex_digit( *e ) || char_to_lower( *e ) == 'x' )
|
||||
{
|
||||
buf[ib++] = *e++;
|
||||
buf[ ib++ ] = *e++;
|
||||
}
|
||||
|
||||
if ( *e == '.' )
|
||||
@ -533,13 +558,13 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
|
||||
do
|
||||
{
|
||||
buf[ib++] = *e;
|
||||
buf[ ib++ ] = *e;
|
||||
++step;
|
||||
} while ( char_is_digit( *++e ) );
|
||||
|
||||
if ( step < 2 )
|
||||
{
|
||||
buf[ib++] = '0';
|
||||
buf[ ib++ ] = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -551,10 +576,10 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
}
|
||||
|
||||
f32 eb = 10;
|
||||
char expbuf[6] = { 0 };
|
||||
sw expi = 0;
|
||||
char expbuf[ 6 ] = { 0 };
|
||||
ssize expi = 0;
|
||||
|
||||
if ( *e && ! ! str_find( "eE", *e ) )
|
||||
if ( *e && ! ! char_first_occurence( "eE", *e ) )
|
||||
{
|
||||
++e;
|
||||
if ( *e == '+' || *e == '-' || char_is_digit( *e ) )
|
||||
@ -569,43 +594,43 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
}
|
||||
while ( char_is_digit( *e ) )
|
||||
{
|
||||
expbuf[expi++] = *e++;
|
||||
expbuf[ expi++ ] = *e++;
|
||||
}
|
||||
}
|
||||
|
||||
orig_exp = exp = (u8)str_to_i64( expbuf, NULL, 10 );
|
||||
orig_exp = exp = ( u8 )c_str_to_i64( expbuf, NULL, 10 );
|
||||
}
|
||||
|
||||
if ( node_type == EADT_TYPE_INTEGER )
|
||||
{
|
||||
node->integer = str_to_i64( buf, 0, 0 );
|
||||
node->integer = c_str_to_i64( buf, 0, 0 );
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
/* special case: negative zero */
|
||||
if ( node->integer == 0 && buf[0] == '-' )
|
||||
if ( node->integer == 0 && buf[ 0 ] == '-' )
|
||||
{
|
||||
neg_zero = true;
|
||||
}
|
||||
#endif
|
||||
while ( orig_exp-- > 0 )
|
||||
{
|
||||
node->integer *= (s64)eb;
|
||||
node->integer *= ( s64 )eb;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node->real = str_to_f64( buf, 0 );
|
||||
node->real = c_str_to_f64( buf, 0 );
|
||||
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
char *q = buf, *base_string = q, *base_string2 = q;
|
||||
base_string = zpl_cast( char* ) str_skip( base_string, '.' );
|
||||
base_string = ccast( char*, c_str_skip( base_string, '.' ));
|
||||
*base_string = '\0';
|
||||
base_string2 = base_string + 1;
|
||||
char* base_string_off = base_string2;
|
||||
while ( *base_string_off++ == '0' )
|
||||
char* base_strbuilder_off = base_string2;
|
||||
while ( *base_strbuilder_off++ == '0' )
|
||||
base2_offset++;
|
||||
|
||||
base = (s32)str_to_i64( q, 0, 0 );
|
||||
base2 = (s32)str_to_i64( base_string2, 0, 0 );
|
||||
base = ( s32 )c_str_to_i64( q, 0, 0 );
|
||||
base2 = ( s32 )c_str_to_i64( base_string2, 0, 0 );
|
||||
if ( exp )
|
||||
{
|
||||
exp = exp * ( ! ( eb == 10.0f ) ? -1 : 1 );
|
||||
@ -613,7 +638,7 @@ char* adt_parse_number( ADT_Node* node, char* base_str )
|
||||
}
|
||||
|
||||
/* special case: negative zero */
|
||||
if ( base == 0 && buf[0] == '-' )
|
||||
if ( base == 0 && buf[ 0 ] == '-' )
|
||||
{
|
||||
neg_zero = true;
|
||||
}
|
||||
@ -667,11 +692,11 @@ ADT_Error adt_print_number( FileInfo* file, ADT_Node* node )
|
||||
{
|
||||
if ( node->props == EADT_PROPS_IS_HEX )
|
||||
{
|
||||
_adt_fprintf( file, "0x%llx", (long long)node->integer );
|
||||
_adt_fprintf( file, "0x%llx", ( long long )node->integer );
|
||||
}
|
||||
else
|
||||
{
|
||||
_adt_fprintf( file, "%lld", (long long)node->integer );
|
||||
_adt_fprintf( file, "%lld", ( long long )node->integer );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -709,14 +734,14 @@ ADT_Error adt_print_number( FileInfo* file, ADT_Node* node )
|
||||
}
|
||||
else if ( node->props == EADT_PROPS_IS_EXP )
|
||||
{
|
||||
_adt_fprintf( file, "%lld.%0*d%llde%lld", (long long)node->base, node->base2_offset, 0, (long long)node->base2, (long long)node->exp );
|
||||
_adt_fprintf( file, "%lld.%0*d%llde%lld", ( long long )node->base, node->base2_offset, 0, ( long long )node->base2, ( long long )node->exp );
|
||||
}
|
||||
else if ( node->props == EADT_PROPS_IS_PARSED_REAL )
|
||||
{
|
||||
if ( ! node->lead_digit )
|
||||
_adt_fprintf( file, ".%0*d%lld", node->base2_offset, 0, (long long)node->base2 );
|
||||
_adt_fprintf( file, ".%0*d%lld", node->base2_offset, 0, ( long long )node->base2 );
|
||||
else
|
||||
_adt_fprintf( file, "%lld.%0*d%lld", (long long int)node->base2_offset, 0, (int)node->base, (long long)node->base2 );
|
||||
_adt_fprintf( file, "%lld.%0*d%lld", ( long long int )node->base2_offset, 0, ( int )node->base, ( long long )node->base2 );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -748,9 +773,9 @@ ADT_Error adt_print_string( FileInfo* file, ADT_Node* node, char const* escaped_
|
||||
|
||||
do
|
||||
{
|
||||
p = str_skip_any( p, escaped_chars );
|
||||
p = c_str_skip_any( p, escaped_chars );
|
||||
_adt_fprintf( file, "%.*s", pointer_diff( b, p ), b );
|
||||
if ( *p && ! ! str_find( escaped_chars, *p ) )
|
||||
if ( *p && ! ! char_first_occurence( escaped_chars, *p ) )
|
||||
{
|
||||
_adt_fprintf( file, "%s%c", escape_symbol, *p );
|
||||
p++;
|
||||
@ -761,7 +786,7 @@ ADT_Error adt_print_string( FileInfo* file, ADT_Node* node, char const* escaped_
|
||||
return EADT_ERROR_NONE;
|
||||
}
|
||||
|
||||
ADT_Error adt_str_to_number( ADT_Node* node )
|
||||
ADT_Error adt_c_str_to_number( ADT_Node* node )
|
||||
{
|
||||
GEN_ASSERT( node );
|
||||
|
||||
@ -772,12 +797,12 @@ ADT_Error adt_str_to_number( ADT_Node* node )
|
||||
return EADT_ERROR_INVALID_TYPE;
|
||||
}
|
||||
|
||||
adt_parse_number( node, (char*)node->string );
|
||||
adt_parse_number( node, ( char* )node->string );
|
||||
|
||||
return EADT_ERROR_NONE;
|
||||
}
|
||||
|
||||
ADT_Error adt_str_to_number_strict( ADT_Node* node )
|
||||
ADT_Error adt_c_str_to_number_strict( ADT_Node* node )
|
||||
{
|
||||
GEN_ASSERT( node );
|
||||
|
||||
@ -788,7 +813,7 @@ ADT_Error adt_str_to_number_strict( ADT_Node* node )
|
||||
return EADT_ERROR_INVALID_TYPE;
|
||||
}
|
||||
|
||||
adt_parse_number_strict( node, (char*)node->string );
|
||||
adt_parse_number_strict( node, ( char* )node->string );
|
||||
|
||||
return EADT_ERROR_NONE;
|
||||
}
|
||||
@ -800,9 +825,9 @@ ADT_Error adt_str_to_number_strict( ADT_Node* node )
|
||||
#pragma region CSV
|
||||
|
||||
#ifdef GEN_CSV_DEBUG
|
||||
#define GEN_CSV_ASSERT( msg ) GEN_PANIC( msg )
|
||||
# define GEN_CSV_ASSERT( msg ) GEN_PANIC( msg )
|
||||
#else
|
||||
#define GEN_CSV_ASSERT( msg )
|
||||
# define GEN_CSV_ASSERT( msg )
|
||||
#endif
|
||||
|
||||
u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header, char delim )
|
||||
@ -818,13 +843,13 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
char* beginChar;
|
||||
char* endChar;
|
||||
|
||||
sw columnIndex = 0;
|
||||
sw totalColumnIndex = 0;
|
||||
ssize columnIndex = 0;
|
||||
ssize totalColumnIndex = 0;
|
||||
|
||||
do
|
||||
{
|
||||
char delimiter = 0;
|
||||
currentChar = zpl_cast( char* ) str_trim( currentChar, false );
|
||||
currentChar = ccast( char*, c_str_trim( currentChar, false ));
|
||||
|
||||
if ( *currentChar == 0 )
|
||||
break;
|
||||
@ -832,9 +857,9 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
ADT_Node rowItem = { 0 };
|
||||
rowItem.type = EADT_TYPE_STRING;
|
||||
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
rowItem.name_style = EADT_NAME_STYLE_NO_QUOTES;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* handle string literals */
|
||||
if ( *currentChar == '"' )
|
||||
@ -843,12 +868,12 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
beginChar = currentChar;
|
||||
endChar = currentChar;
|
||||
rowItem.string = beginChar;
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
rowItem.name_style = EADT_NAME_STYLE_DOUBLE_QUOTE;
|
||||
#endif
|
||||
#endif
|
||||
do
|
||||
{
|
||||
endChar = zpl_cast( char* ) str_skip( endChar, '"' );
|
||||
endChar = ccast( char*, c_str_skip( endChar, '"' ));
|
||||
|
||||
if ( *endChar && *( endChar + 1 ) == '"' )
|
||||
{
|
||||
@ -856,7 +881,8 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
}
|
||||
else
|
||||
break;
|
||||
} while ( *endChar );
|
||||
}
|
||||
while ( *endChar );
|
||||
|
||||
if ( *endChar == 0 )
|
||||
{
|
||||
@ -866,8 +892,8 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
}
|
||||
|
||||
*endChar = 0;
|
||||
currentChar = zpl_cast( char* ) str_trim( endChar + 1, true );
|
||||
delimiter = *currentChar;
|
||||
currentChar = ccast( char*, c_str_trim( endChar + 1, true ));
|
||||
delimiter = * currentChar;
|
||||
|
||||
/* unescape escaped quotes (so that unescaped text escapes :) */
|
||||
{
|
||||
@ -876,15 +902,16 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
{
|
||||
if ( *escapedChar == '"' && *( escapedChar + 1 ) == '"' )
|
||||
{
|
||||
mem_move( escapedChar, escapedChar + 1, str_len( escapedChar ) );
|
||||
mem_move( escapedChar, escapedChar + 1, c_str_len( escapedChar ) );
|
||||
}
|
||||
escapedChar++;
|
||||
} while ( *escapedChar );
|
||||
}
|
||||
while ( *escapedChar );
|
||||
}
|
||||
}
|
||||
else if ( *currentChar == delim )
|
||||
{
|
||||
delimiter = *currentChar;
|
||||
delimiter = * currentChar;
|
||||
rowItem.string = "";
|
||||
}
|
||||
else if ( *currentChar )
|
||||
@ -897,19 +924,20 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
do
|
||||
{
|
||||
endChar++;
|
||||
} while ( *endChar && *endChar != delim && *endChar != '\n' );
|
||||
}
|
||||
while ( * endChar && * endChar != delim && * endChar != '\n' );
|
||||
|
||||
if ( *endChar )
|
||||
if ( * endChar )
|
||||
{
|
||||
currentChar = zpl_cast( char* ) str_trim( endChar, true );
|
||||
currentChar = ccast( char*, c_str_trim( endChar, true ));
|
||||
|
||||
while ( char_is_space( *( endChar - 1 ) ) )
|
||||
{
|
||||
endChar--;
|
||||
}
|
||||
|
||||
delimiter = *currentChar;
|
||||
*endChar = 0;
|
||||
delimiter = * currentChar;
|
||||
* endChar = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -922,35 +950,35 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
char* num_p = beginChar;
|
||||
|
||||
// We only consider hexadecimal values if they start with 0x
|
||||
if ( str_len( num_p ) > 2 && num_p[0] == '0' && ( num_p[1] == 'x' || num_p[1] == 'X' ) )
|
||||
if ( c_str_len(num_p) > 2 && num_p[0] == '0' && (num_p[1] == 'x' || num_p[1] == 'X') )
|
||||
{
|
||||
num_p += 2; // skip '0x' prefix
|
||||
do
|
||||
{
|
||||
if ( ! char_is_hex_digit( *num_p ) )
|
||||
if (!char_is_hex_digit(*num_p))
|
||||
{
|
||||
skip_number = true;
|
||||
break;
|
||||
}
|
||||
} while ( *num_p++ );
|
||||
} while (*num_p++);
|
||||
}
|
||||
else
|
||||
{
|
||||
skip_number = true;
|
||||
}
|
||||
|
||||
if ( ! skip_number )
|
||||
if (!skip_number)
|
||||
{
|
||||
adt_str_to_number( &rowItem );
|
||||
adt_c_str_to_number(&rowItem);
|
||||
}
|
||||
}
|
||||
|
||||
if ( columnIndex >= root->nodes.num() )
|
||||
if ( columnIndex >= scast(ssize, array_num(root->nodes)) )
|
||||
{
|
||||
adt_append_arr( root, NULL );
|
||||
}
|
||||
|
||||
root->nodes[columnIndex].nodes.append( rowItem );
|
||||
array_append( root->nodes[ columnIndex ].nodes, rowItem );
|
||||
|
||||
if ( delimiter == delim )
|
||||
{
|
||||
@ -975,9 +1003,10 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
if ( delimiter != 0 )
|
||||
currentChar++;
|
||||
}
|
||||
} while ( *currentChar );
|
||||
}
|
||||
while ( *currentChar );
|
||||
|
||||
if ( root->nodes.num() == 0 )
|
||||
if (array_num( root->nodes) == 0 )
|
||||
{
|
||||
GEN_CSV_ASSERT( "unexpected end of input. stream is empty." );
|
||||
error = ECSV_Error__UNEXPECTED_END_OF_INPUT;
|
||||
@ -987,12 +1016,12 @@ u8 csv_parse_delimiter( CSV_Object* root, char* text, AllocatorInfo allocator, b
|
||||
/* consider first row as a header. */
|
||||
if ( has_header )
|
||||
{
|
||||
for ( sw i = 0; i < root->nodes.num(); i++ )
|
||||
for ( ssize i = 0; i < scast(ssize, array_num(root->nodes)); i++ )
|
||||
{
|
||||
CSV_Object* col = root->nodes + i;
|
||||
CSV_Object* hdr = col->nodes;
|
||||
col->name = hdr->string;
|
||||
col->nodes.remove_at( 0 );
|
||||
array_remove_at(col->nodes, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1015,16 +1044,16 @@ void _csv_write_record( FileInfo* file, CSV_Object* node )
|
||||
{
|
||||
case EADT_NAME_STYLE_DOUBLE_QUOTE :
|
||||
{
|
||||
str_fmt_file( file, "\"" );
|
||||
c_str_fmt_file( file, "\"" );
|
||||
adt_print_string( file, node, "\"", "\"" );
|
||||
str_fmt_file( file, "\"" );
|
||||
c_str_fmt_file( file, "\"" );
|
||||
}
|
||||
break;
|
||||
|
||||
case EADT_NAME_STYLE_NO_QUOTES :
|
||||
{
|
||||
#endif
|
||||
str_fmt_file( file, "%s", node->string );
|
||||
c_str_fmt_file( file, "%s", node->string );
|
||||
#ifndef GEN_PARSER_DISABLE_ANALYSIS
|
||||
}
|
||||
break;
|
||||
@ -1055,55 +1084,66 @@ void csv_write_delimiter( FileInfo* file, CSV_Object* obj, char delimiter )
|
||||
GEN_ASSERT_NOT_NULL( file );
|
||||
GEN_ASSERT_NOT_NULL( obj );
|
||||
GEN_ASSERT( obj->nodes );
|
||||
sw cols = obj->nodes.num();
|
||||
ssize cols = array_num(obj->nodes);
|
||||
if ( cols == 0 )
|
||||
return;
|
||||
|
||||
sw rows = obj->nodes[0].nodes.num();
|
||||
ssize rows = array_num(obj->nodes[ 0 ].nodes);
|
||||
if ( rows == 0 )
|
||||
return;
|
||||
|
||||
b32 has_headers = obj->nodes[0].name != NULL;
|
||||
b32 has_headers = obj->nodes[ 0 ].name != NULL;
|
||||
|
||||
if ( has_headers )
|
||||
{
|
||||
for ( sw i = 0; i < cols; i++ )
|
||||
for ( ssize i = 0; i < cols; i++ )
|
||||
{
|
||||
_csv_write_header( file, &obj->nodes[i] );
|
||||
_csv_write_header( file, &obj->nodes[ i ] );
|
||||
if ( i + 1 != cols )
|
||||
{
|
||||
str_fmt_file( file, "%c", delimiter );
|
||||
c_str_fmt_file( file, "%c", delimiter );
|
||||
}
|
||||
}
|
||||
str_fmt_file( file, "\n" );
|
||||
c_str_fmt_file( file, "\n" );
|
||||
}
|
||||
|
||||
for ( sw r = 0; r < rows; r++ )
|
||||
for ( ssize r = 0; r < rows; r++ )
|
||||
{
|
||||
for ( sw i = 0; i < cols; i++ )
|
||||
for ( ssize i = 0; i < cols; i++ )
|
||||
{
|
||||
_csv_write_record( file, &obj->nodes[i].nodes[r] );
|
||||
_csv_write_record( file, &obj->nodes[ i ].nodes[ r ] );
|
||||
if ( i + 1 != cols )
|
||||
{
|
||||
str_fmt_file( file, "%c", delimiter );
|
||||
c_str_fmt_file( file, "%c", delimiter );
|
||||
}
|
||||
}
|
||||
str_fmt_file( file, "\n" );
|
||||
c_str_fmt_file( file, "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delimiter )
|
||||
StrBuilder csv_write_strbuilder_delimiter( AllocatorInfo a, CSV_Object* obj, char delimiter )
|
||||
{
|
||||
FileInfo tmp;
|
||||
file_stream_new( &tmp, a );
|
||||
csv_write_delimiter( &tmp, obj, delimiter );
|
||||
sw fsize;
|
||||
|
||||
ssize fsize;
|
||||
u8* buf = file_stream_buf( &tmp, &fsize );
|
||||
String output = String::make_length( a, (char*)buf, fsize );
|
||||
StrBuilder output = strbuilder_make_length( a, ( char* )buf, fsize );
|
||||
file_close( &tmp );
|
||||
return output;
|
||||
}
|
||||
|
||||
#undef _adt_fprintf
|
||||
|
||||
#pragma endregion CSV
|
||||
|
||||
GEN_NS_END
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -1,7 +1,29 @@
|
||||
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
// This file was generated automatially by gencpp's unreal.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-const-variable"
|
||||
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
|
||||
# pragma clang diagnostic ignored "-Wswitch"
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
# 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__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
# pragma GCC diagnostic ignored "-Wcomment"
|
||||
# pragma GCC diagnostic ignored "-Wswitch"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#include "gen.hpp"
|
||||
|
||||
GEN_NS_BEGIN
|
||||
@ -87,7 +109,7 @@ struct ADT_Node
|
||||
union
|
||||
{
|
||||
char const* string;
|
||||
Array<ADT_Node> nodes; ///< zpl_array
|
||||
Array(ADT_Node) nodes; ///< zpl_array
|
||||
|
||||
struct
|
||||
{
|
||||
@ -182,7 +204,7 @@ ADT_Node* adt_find( ADT_Node* node, char const* name, b32 deep_search );
|
||||
* @param index
|
||||
* @return zpl_adt_node * node
|
||||
*/
|
||||
ADT_Node* adt_alloc_at( ADT_Node* parent, sw index );
|
||||
ADT_Node* adt_alloc_at( ADT_Node* parent, ssize index );
|
||||
|
||||
/**
|
||||
* @brief Allocate an unitialised node within a container.
|
||||
@ -200,7 +222,7 @@ ADT_Node* adt_alloc( ADT_Node* parent );
|
||||
* @param index
|
||||
* @return zpl_adt_node * node
|
||||
*/
|
||||
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, sw index );
|
||||
ADT_Node* adt_move_node_at( ADT_Node* node, ADT_Node* new_parent, ssize index );
|
||||
|
||||
/**
|
||||
* @brief Move an existing node to a new container.
|
||||
@ -353,7 +375,7 @@ char* adt_parse_number_strict( ADT_Node* node, char* base_str );
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
ADT_Error adt_str_to_number( ADT_Node* node );
|
||||
ADT_Error adt_c_str_to_number( ADT_Node* node );
|
||||
|
||||
/**
|
||||
* @brief Parses and converts an existing string node into a number.
|
||||
@ -362,7 +384,7 @@ ADT_Error adt_str_to_number( ADT_Node* node );
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
ADT_Error adt_str_to_number_strict( ADT_Node* node );
|
||||
ADT_Error adt_c_str_to_number_strict( ADT_Node* node );
|
||||
|
||||
/**
|
||||
* @brief Prints a number into a file stream.
|
||||
@ -404,190 +426,73 @@ enum CSV_Error : u32
|
||||
|
||||
typedef ADT_Node CSV_Object;
|
||||
|
||||
GEN_DEF_INLINE u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header );
|
||||
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 );
|
||||
|
||||
GEN_DEF_INLINE void csv_write( FileInfo* file, CSV_Object* obj );
|
||||
GEN_DEF_INLINE String csv_write_string( AllocatorInfo a, CSV_Object* obj );
|
||||
void csv_write( FileInfo* file, CSV_Object* obj );
|
||||
StrBuilder 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 );
|
||||
StrBuilder csv_write_strbuilder_delimiter( AllocatorInfo a, CSV_Object* obj, char delim );
|
||||
|
||||
/* inline */
|
||||
|
||||
GEN_IMPL_INLINE u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header )
|
||||
inline
|
||||
u8 csv_parse( CSV_Object* root, char* text, AllocatorInfo allocator, b32 has_header )
|
||||
{
|
||||
return csv_parse_delimiter( root, text, allocator, has_header, ',' );
|
||||
}
|
||||
|
||||
GEN_IMPL_INLINE void csv_write( FileInfo* file, CSV_Object* obj )
|
||||
inline
|
||||
void csv_write( FileInfo* file, CSV_Object* obj )
|
||||
{
|
||||
csv_write_delimiter( file, obj, ',' );
|
||||
}
|
||||
|
||||
GEN_IMPL_INLINE String csv_write_string( AllocatorInfo a, CSV_Object* obj )
|
||||
inline
|
||||
StrBuilder csv_write_string( AllocatorInfo a, CSV_Object* obj )
|
||||
{
|
||||
return csv_write_string_delimiter( a, obj, ',' );
|
||||
return csv_write_strbuilder_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.
|
||||
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 );
|
||||
|
||||
sw 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__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -195,11 +195,11 @@ if ( $vendor -match "clang" )
|
||||
$compiler_args += $flag_no_optimization
|
||||
}
|
||||
if ( $debug ) {
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=1' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=1' )
|
||||
$compiler_args += $flag_debug, $flag_debug_codeview, $flag_profiling_debug
|
||||
}
|
||||
else {
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=0' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=0' )
|
||||
}
|
||||
|
||||
$warning_ignores | ForEach-Object {
|
||||
@ -275,11 +275,11 @@ if ( $vendor -match "clang" )
|
||||
$compiler_args += $flag_no_optimization
|
||||
}
|
||||
if ( $debug ) {
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=1' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=1' )
|
||||
$compiler_args += $flag_debug, $flag_debug_codeview, $flag_profiling_debug
|
||||
}
|
||||
else {
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=0' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=0' )
|
||||
}
|
||||
|
||||
$warning_ignores | ForEach-Object {
|
||||
@ -399,7 +399,7 @@ if ( $vendor -match "msvc" )
|
||||
if ( $debug )
|
||||
{
|
||||
$compiler_args += $flag_debug
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=1' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=1' )
|
||||
$compiler_args += ( $flag_path_debug + $path_output + '\' )
|
||||
$compiler_args += $flag_link_win_rt_static_debug
|
||||
|
||||
@ -408,7 +408,7 @@ if ( $vendor -match "msvc" )
|
||||
}
|
||||
}
|
||||
else {
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=0' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=0' )
|
||||
$compiler_args += $flag_link_win_rt_static
|
||||
}
|
||||
$compiler_args += $includes | ForEach-Object { $flag_include + $_ }
|
||||
@ -485,7 +485,7 @@ if ( $vendor -match "msvc" )
|
||||
if ( $debug )
|
||||
{
|
||||
$compiler_args += $flag_debug
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=1' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=1' )
|
||||
$compiler_args += ( $flag_path_debug + $path_output + '\' )
|
||||
$compiler_args += $flag_link_win_rt_static_debug
|
||||
|
||||
@ -494,7 +494,7 @@ if ( $vendor -match "msvc" )
|
||||
}
|
||||
}
|
||||
else {
|
||||
$compiler_args += ( $flag_define + 'Build_Debug=0' )
|
||||
$compiler_args += ( $flag_define + 'GEN_BUILD_DEBUG=0' )
|
||||
$compiler_args += $flag_link_win_rt_static
|
||||
}
|
||||
$compiler_args += $includes | ForEach-Object { $flag_include + $_ }
|
||||
|
Reference in New Issue
Block a user