Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #972

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/gir-files
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace {Namespace.GetInternalName(callback.Namespace)}
}
catch (Exception ex)
{
Log.Warning($"Did not generate callback delegatre '{callback.Name}': {ex.Message}");
Log.Warning($"Did not generate callback delegate '{callback.Name}': {ex.Message}");

return string.Empty;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal static class CallbackParameters
new Parameter.RecordGLibPtrArray(),
new Parameter.String(),
new Parameter.Union(),
new Parameter.UnionArray(),
new Parameter.UnsignedPointer(),
new Parameter.Utf8StringArrayCallback(),
new Parameter.Void(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace Generator.Renderer.Internal.Parameter;

internal class UnionArray : ParameterConverter
{
public bool Supports(GirModel.AnyType anyType)
{
return anyType.IsArray<GirModel.Union>();
}

public RenderableParameter Convert(GirModel.Parameter parameter)
{
if (parameter.AnyTypeOrVarArgs.AsT0.AsT1.IsPointer)
return PointerArray(parameter);

return DataArray(parameter);
}

private static RenderableParameter PointerArray(GirModel.Parameter parameter)
{
return new RenderableParameter(
Attribute: string.Empty,
Direction: string.Empty,
NullableTypeName: $"ref {Model.Type.Pointer}",
Name: Model.Parameter.GetName(parameter)
);
}

private static RenderableParameter DataArray(GirModel.Parameter parameter)
{
var union = (GirModel.Union) parameter.AnyTypeOrVarArgs.AsT0.AsT1.AnyType.AsT0;

return new RenderableParameter(
Attribute: string.Empty,
Direction: string.Empty,
NullableTypeName: Model.Union.GetFullyQualifiedInternalStructName(union) + "[]",
Name: Model.Parameter.GetName(parameter)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ internal static class Parameters
new Parameter.String(),
new Parameter.StringGLibPtrArray(),
new Parameter.Union(),
new Parameter.UnionArray(),
new Parameter.UnsignedPointer(),
new Parameter.Utf8StringArray(),
new Parameter.Void(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using GirModel;

namespace Generator.Renderer.Internal.ParameterToManagedExpressions;

Expand Down Expand Up @@ -27,12 +28,31 @@ private static void ErrorRecord(ParameterToManagedData parameterData)

private static void RegularRecord(ParameterToManagedData parameterData)
{
if (parameterData.Parameter.Direction != GirModel.Direction.In)
throw new NotImplementedException($"{parameterData.Parameter.AnyTypeOrVarArgs}: record with direction != in not yet supported");

if (!parameterData.Parameter.IsPointer)
throw new NotImplementedException($"Unpointed record parameter {parameterData.Parameter.Name} ({parameterData.Parameter.AnyTypeOrVarArgs}) can not yet be converted to managed");

switch (parameterData.Parameter.Direction)
{
case Direction.In:
InRecord(parameterData);
break;
case Direction.Out:
OutRecord(parameterData);
break;
default:
throw new NotImplementedException($"{parameterData.Parameter.AnyTypeOrVarArgs}: record with direction {parameterData.Parameter.Direction} not yet supported");
}
}

private static void OutRecord(ParameterToManagedData parameterData)
{
var parameterName = Model.Parameter.GetName(parameterData.Parameter);
parameterData.SetSignatureName(parameterName);
parameterData.SetCallName("out " + parameterName);
}

private static void InRecord(ParameterToManagedData parameterData)
{
var record = (GirModel.Record) parameterData.Parameter.AnyTypeOrVarArgs.AsT0.AsT0;
var ownedHandle = parameterData.Parameter.Transfer == GirModel.Transfer.Full;
var variableName = Model.Parameter.GetConvertedName(parameterData.Parameter);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Generator.Renderer.Public.Parameter;
using System;

namespace Generator.Renderer.Public.Parameter;

internal class Record : ParameterConverter
{
Expand All @@ -8,24 +10,30 @@ public bool Supports(GirModel.AnyType anyType)
}

public ParameterTypeData Create(GirModel.Parameter parameter)
{
return parameter.Direction switch
{
GirModel.Direction.In => InRecord(parameter),
GirModel.Direction.Out => OutRecord(parameter),
_ => throw new Exception($"Unsupported record direction {parameter.Direction}")
};
}

private ParameterTypeData OutRecord(GirModel.Parameter parameter)
{
return new ParameterTypeData(
Direction: GetDirection(parameter),
NullableTypeName: GetNullableTypeName(parameter)
Direction: ParameterDirection.Out(),
NullableTypeName: Model.Type.Pointer
);
}

private static string GetNullableTypeName(GirModel.Parameter parameter)
private static ParameterTypeData InRecord(GirModel.Parameter parameter)
{
var type = (GirModel.Record) parameter.AnyTypeOrVarArgs.AsT0.AsT0;
return Model.ComplexType.GetFullyQualified(type) + Nullable.Render(parameter);
}

private static string GetDirection(GirModel.Parameter parameter) => parameter switch
{
{ Direction: GirModel.Direction.InOut } => ParameterDirection.Ref(),
{ Direction: GirModel.Direction.Out, CallerAllocates: true } => ParameterDirection.Ref(),
{ Direction: GirModel.Direction.Out } => ParameterDirection.Out(),
_ => ParameterDirection.In()
};
return new ParameterTypeData(
Direction: ParameterDirection.In(),
NullableTypeName: Model.ComplexType.GetFullyQualified(type) + Nullable.Render(parameter)
);
}
}
2 changes: 1 addition & 1 deletion src/Generation/GirModel/GirModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<RootNamespace>GirModule</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OneOf" Version="3.0.255" />
<PackageReference Include="OneOf" Version="3.0.263" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/GirCore.Logging.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project>
<ItemGroup>
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/GirCore.Testing.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
Expand Down
29 changes: 29 additions & 0 deletions src/Libs/Gdk-4.0/Internal/DragSurfaceSizeHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

namespace Gdk.Internal;

public partial class DragSurfaceSizeHandle
{
public partial DragSurfaceSizeOwnedHandle OwnedCopy()
{
throw new NotImplementedException();
}

public partial DragSurfaceSizeUnownedHandle UnownedCopy()
{
throw new NotImplementedException();
}
}

public partial class DragSurfaceSizeOwnedHandle
{
public static partial DragSurfaceSizeOwnedHandle FromUnowned(IntPtr ptr)
{
throw new NotImplementedException();
}

protected override partial bool ReleaseHandle()
{
throw new NotImplementedException();
}
}
29 changes: 29 additions & 0 deletions src/Libs/Gst-1.0/Internal/DebugMessageHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

namespace Gst.Internal;

public partial class DebugMessageHandle
{
public partial DebugMessageOwnedHandle OwnedCopy()
{
throw new NotImplementedException();
}

public partial DebugMessageUnownedHandle UnownedCopy()
{
throw new NotImplementedException();
}
}

public partial class DebugMessageOwnedHandle
{
public static partial DebugMessageOwnedHandle FromUnowned(IntPtr ptr)
{
throw new NotImplementedException();
}

protected override partial bool ReleaseHandle()
{
throw new NotImplementedException();
}
}
34 changes: 34 additions & 0 deletions src/Libs/Gst-1.0/Internal/PollHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;

namespace Gst.Internal;

public partial class PollHandle
{
public partial PollOwnedHandle OwnedCopy()
{
throw new NotImplementedException();
}

public partial PollUnownedHandle UnownedCopy()
{
throw new NotImplementedException();
}
}

public partial class PollOwnedHandle
{
[DllImport(ImportResolver.Library, EntryPoint = "gst_poll_free")]
private static extern void Free(IntPtr set);

public static partial PollOwnedHandle FromUnowned(IntPtr ptr)
{
throw new NotImplementedException();
}

protected override partial bool ReleaseHandle()
{
Free(handle);
return true;
}
}
34 changes: 34 additions & 0 deletions src/Libs/GstAudio-1.0/Internal/AudioChannelMixerHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;

namespace GstAudio.Internal;

public partial class AudioChannelMixerHandle
{
public partial AudioChannelMixerOwnedHandle OwnedCopy()
{
throw new NotImplementedException();
}

public partial AudioChannelMixerUnownedHandle UnownedCopy()
{
throw new NotImplementedException();
}
}

public partial class AudioChannelMixerOwnedHandle
{
[DllImport(ImportResolver.Library, EntryPoint = "gst_audio_channel_mixer_free")]
private static extern void Free(IntPtr data);

public static partial AudioChannelMixerOwnedHandle FromUnowned(IntPtr ptr)
{
throw new NotImplementedException();
}

protected override partial bool ReleaseHandle()
{
Free(handle);
return true;
}
}
34 changes: 34 additions & 0 deletions src/Libs/GstAudio-1.0/Internal/AudioQuantizeHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;

namespace GstAudio.Internal;

public partial class AudioQuantizeHandle
{
public partial AudioQuantizeOwnedHandle OwnedCopy()
{
throw new NotImplementedException();
}

public partial AudioQuantizeUnownedHandle UnownedCopy()
{
throw new NotImplementedException();
}
}

public partial class AudioQuantizeOwnedHandle
{
[DllImport(ImportResolver.Library, EntryPoint = "gst_audio_quantize_free")]
private static extern void Free(IntPtr data);

public static partial AudioQuantizeOwnedHandle FromUnowned(IntPtr ptr)
{
throw new NotImplementedException();
}

protected override partial bool ReleaseHandle()
{
Free(handle);
return true;
}
}
34 changes: 34 additions & 0 deletions src/Libs/GstAudio-1.0/Internal/AudioResamplerHandle.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;

namespace GstAudio.Internal;

public partial class AudioResamplerHandle
{
public partial AudioResamplerOwnedHandle OwnedCopy()
{
throw new NotImplementedException();
}

public partial AudioResamplerUnownedHandle UnownedCopy()
{
throw new NotImplementedException();
}
}

public partial class AudioResamplerOwnedHandle
{
[DllImport(ImportResolver.Library, EntryPoint = "gst_audio_resampler_free")]
private static extern void Free(IntPtr data);

public static partial AudioResamplerOwnedHandle FromUnowned(IntPtr ptr)
{
throw new NotImplementedException();
}

protected override partial bool ReleaseHandle()
{
Free(handle);
return true;
}
}
Loading
Loading