Skip to content

Commit f991aaa

Browse files
committed
Remove acronym identification in order to make all names be strictly pascal cased
Not going to commit the generated bindings until I get the vendor extension suffixes to be properly capitalized
1 parent b4cdd0e commit f991aaa

File tree

4 files changed

+5
-26
lines changed

4 files changed

+5
-26
lines changed

generator.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@
151151
]
152152
},
153153
"PrettifyNames": {
154-
"LongAcronymThreshold": 4,
155154
"GlobalPrefixHints": ["gl"],
156155
"PrefixOverrides": {
157156
"SyncObjectMask": "GL_SYNC"
@@ -233,7 +232,6 @@
233232
]
234233
},
235234
"PrettifyNames": {
236-
"LongAcronymThreshold": 4,
237235
"GlobalPrefixHints": ["alc", "al"],
238236
"NameOverrides": {
239237
"ALContext": "ALContext",
@@ -329,7 +327,6 @@
329327
"UseDSL": true
330328
},
331329
"PrettifyNames": {
332-
"LongAcronymThreshold": 4,
333330
"GlobalPrefixHints": ["vk"],
334331
"PrefixOverrides": {
335332
"VkPipelineCreateFlags2": "VK_PIPELINE_CREATE_2"

sources/SilkTouch/SilkTouch/Mods/MixKhronosData.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ public partial class MixKhronosData(
3838
IApiMetadataProvider<IEnumerable<SupportedApiProfileAttribute>>
3939
{
4040
internal ConcurrentDictionary<string, JobData> Jobs = new();
41-
private static readonly ICulturedStringTransformer _transformer = new NameUtils.NameTransformer(
42-
4
43-
);
41+
private static readonly ICulturedStringTransformer _transformer = new NameUtils.NameTransformer();
4442
private static readonly char[] _listSeparators = { ',', '|', '+' };
4543

4644
private static readonly Dictionary<string, string> _defaultEnumNativeTypeNameMaps =

sources/SilkTouch/SilkTouch/Mods/PrettifyNames.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ IEnumerable<IJobDependency<INameTrimmer>> trimmerProviders
4242
/// </summary>
4343
public Version? TrimmerBaseline { get; init; } = new(3, 0);
4444

45-
/// <summary>
46-
/// The maximum length of an all capitals string to be treated as a single acronym, rather than as an all
47-
/// capitals word.
48-
/// </summary>
49-
public int? LongAcronymThreshold { get; init; }
50-
5145
/// <summary>
5246
/// Multiple candidate name prefixes that may apply across all of the bindings generated.
5347
/// </summary>
@@ -85,7 +79,7 @@ public async Task ExecuteAsync(IModContext ctx, CancellationToken ct = default)
8579
bool IsEnum
8680
)
8781
> types = new();
88-
var translator = new NameUtils.NameTransformer(cfg.LongAcronymThreshold ?? 3);
82+
var translator = new NameUtils.NameTransformer();
8983

9084
// If we have a trimmer baseline set, that means the user wants to trim the names as well as prettify them.
9185
if (cfg.TrimmerBaseline is not null)

sources/SilkTouch/SilkTouch/Naming/NameUtils.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public static string LenientUnderscore(this string input) =>
240240
[GeneratedRegex(@"([\p{Lu}]+)([\p{Lu}][\p{Ll}])")]
241241
private static partial Regex LowerUpperLower();
242242

243-
internal partial class NameTransformer(int longAcronymThreshold) : ICulturedStringTransformer
243+
internal partial class NameTransformer : ICulturedStringTransformer
244244
{
245245
public string Transform(string input) => Transform(input, null);
246246

@@ -256,18 +256,8 @@ public string Transform(string input, CultureInfo? culture)
256256
{
257257
continue;
258258
}
259-
if (
260-
word.Length > longAcronymThreshold
261-
|| !AllCapitals(word)
262-
|| (
263-
AllCapitals(input)
264-
&& input.Length > longAcronymThreshold
265-
&& matches.Length > 1
266-
)
267-
)
268-
{
269-
word = MakeFirstLetterUpper(word, culture);
270-
}
259+
260+
word = MakeFirstLetterUpper(word, culture);
271261

272262
for (var j = i - 1; j >= 0; j--)
273263
{

0 commit comments

Comments
 (0)