Open BehroozAmoozad opened 2 months ago
I did something. but now the internal function is not generated. I have no idea where that one is.
if (parameter.Parameter.Direction == GirModel.Direction.In)
{
var record = (GirModel.Record) parameter.Parameter.AnyTypeOrVarArgs.AsT0.AsT0;
var typeHandle = Model.TypedRecord.GetFullyQuallifiedHandle(record);
var nullHandle = Model.TypedRecord.GetFullyQuallifiedNullHandle(record);
var signatureName = Model.Parameter.GetName(parameter.Parameter);
var callName = parameter.Parameter switch
{
{ Nullable: true, Transfer: GirModel.Transfer.None } => $"({typeHandle}?) {signatureName}?.Handle ?? {nullHandle}",
{ Nullable: false, Transfer: GirModel.Transfer.None } => $"{signatureName}.Handle",
{ Nullable: true, Transfer: GirModel.Transfer.Full } => $"{signatureName}?.Handle.UnownedCopy() ?? {nullHandle}",
{ Nullable: false, Transfer: GirModel.Transfer.Full } => $"{signatureName}.Handle.UnownedCopy()",
_ => throw new Exception($"Can't detect call name for parameter record parameter {parameter.Parameter.Name}")
};
parameter.SetSignatureName(() => signatureName);
parameter.SetCallName(() => callName);
}
else if (parameter.Parameter.Direction == GirModel.Direction.Out)
{
if (parameter.Parameter.Transfer != Transfer.Full)
throw new NotImplementedException($"{parameter.Parameter.AnyTypeOrVarArgs}: record parameter '{parameter.Parameter.Name}' with direction == out and transfer != full not yet supported");
var record = (GirModel.Record) parameter.Parameter.AnyTypeOrVarArgs.AsT0.AsT0;
var type = Model.TypedRecord.GetFullyQualifiedPublicClassName(record);
var typeHandle = Model.TypedRecord.GetFullyQuallifiedOwnedHandle(record);
var signatureName = Model.Parameter.GetName(parameter.Parameter);
var callName = $"out {typeHandle} _handle_{signatureName}";
string? postCallExpression;
if (parameter.Parameter is { Nullable: true, Transfer: GirModel.Transfer.Full })
{
postCallExpression = $"{signatureName} = _handle_{signatureName}.IsInvalid ? default : new {type} (_handle_{signatureName});";
}
else if (parameter.Parameter is { Nullable: false, Transfer: GirModel.Transfer.Full })
{
postCallExpression = $"{signatureName} = new {type} (_handle_{signatureName});";
}
else
{
throw new Exception($"Can't detect call name for parameter record parameter {parameter.Parameter.Name}");
}
parameter.SetSignatureName(() => signatureName);
parameter.SetCallName(() => callName);
parameter.SetPostCallExpression(() => postCallExpression);
}
else
throw new NotImplementedException($"{parameter.Parameter.AnyTypeOrVarArgs}: record parameter '{parameter.Parameter.Name}' with direction != in not yet supported");
Hi, thanks for stopping by and the offer to contribute. I would be very grateful for any contribution from your side.
Unfortunately I can't give you very specific advice as I would need to analyze the problem myself which is actually as time consuming as writing the code myself.
But I can offer you guidance to find your way around the codebase and implement the bits you are missing.
As a start you need to be familiar with the generated code around the class you want to improve. Be aware of the Internal
namespace, check what is generated there an how it plays together with the public code.
Then you need to find a technical solution how you want to bind the method you are missing. You can implement this manually as a proof of concept on your local machine. If you got this working I would like to see the code you want to generate.
Then we can take the next step and see how to make the generator create the code you want.
You are welcome to step by in the matrix channel (see readme) for adhoc communication.
I'm getting a bunch of these warnings when generating code. Is there any way for me or you to fix the issue? Even manually for the couple functions that I need will be really helpful. I don't know where to start and what to modify. point me in the right direction and I'll do it.
What brought me here is that I can't initialize ListStores and a whole lot of treemodel code that I converted from gtk 3 stopped working which I removed thinking it's no longer supported in gtk 4.