Skip to content

Commit 227ba4e

Browse files
committed
Removed GenerateConstructorsForStructs and LibraryImport from experimental settings.
1 parent e15a5e8 commit 227ba4e

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

HexaGen/CsCodeGeneratorConfig.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,6 @@ public static CsCodeGeneratorConfig Load(string file)
289289

290290
if (!result.EnableExperimentalOptions)
291291
{
292-
result.GenerateConstructorsForStructs = false;
293-
if (result.UseFunctionTable)
294-
{
295-
result.ImportType = ImportType.LibraryImport;
296-
}
297292
}
298293

299294
result.Save(file);
@@ -336,7 +331,7 @@ public static CsCodeGeneratorConfig Load(string file)
336331
public bool GenerateSizeOfStructs { get; set; } = false;
337332

338333
/// <summary>
339-
/// The generator will generate default constructors for all structs. (Default: <see langword="true"/>) (EXPERIMENTAL)
334+
/// The generator will generate default constructors for all structs. (Default: <see langword="true"/>)
340335
/// </summary>
341336
public bool GenerateConstructorsForStructs { get; set; } = true;
342337

HexaGen/FunctionGeneration/StringReturnGenStep.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
/// </summary>
1010
public class StringReturnGenStep : FunctionGenStep
1111
{
12+
/// <summary>
13+
/// Allows char** or byte**
14+
/// </summary>
15+
public bool AllowMultiPointer { get; set; }
16+
1217
/// <summary>
1318
/// Determines whether the specified return type is allowed.
1419
/// </summary>
@@ -20,7 +25,30 @@ public class StringReturnGenStep : FunctionGenStep
2025
/// </returns>
2126
protected virtual bool AllowReturnType(CsFunctionOverload function, CsFunctionVariation variation, CsType returnType)
2227
{
23-
return returnType.IsPointer && (returnType.PrimitiveType == CsPrimitiveType.Byte || returnType.PrimitiveType == CsPrimitiveType.Char);
28+
if (!returnType.IsPointer || returnType.PrimitiveType != CsPrimitiveType.Byte && returnType.PrimitiveType != CsPrimitiveType.Char)
29+
{
30+
return false;
31+
}
32+
33+
if (AllowMultiPointer)
34+
{
35+
return true;
36+
}
37+
38+
int p = 0;
39+
foreach (char c in returnType.Name)
40+
{
41+
if (c == '*')
42+
{
43+
p++;
44+
if (p > 1)
45+
{
46+
return false;
47+
}
48+
}
49+
}
50+
51+
return true;
2452
}
2553

2654
/// <summary>

HexaGen/HexaGen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88

99
<AssemblyVersion>1.1.1</AssemblyVersion>
10-
<PackageVersion>1.1.9-rc1</PackageVersion>
10+
<PackageVersion>1.1.9-rc3</PackageVersion>
1111
<Description></Description>
1212
<PackageTags></PackageTags>
1313
<Authors>Juna Meinhold</Authors>

0 commit comments

Comments
 (0)