[Generator] Refactor TypeManager and add nullability. (#17559)
This has several small changes: 1. Move the maps to the TypeManager which makes more sense. 2. Enable nullability which triggers a number of changes, the biggest one, in a dict TKey is not nullable (makes perfect sense). --------- Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com> Co-authored-by: Alex Soto <alex@alexsoto.me> Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This commit is contained in:
Родитель
e047abe88e
Коммит
30d996743b
|
@ -143,6 +143,10 @@
|
||||||
<value>Frameworks were not loaded for platform {0}.</value>
|
<value>Frameworks were not loaded for platform {0}.</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
|
<data name="BI0004" xml:space="preserve">
|
||||||
|
<value>Universe was not loaded for platform {0}.</value>
|
||||||
|
</data>
|
||||||
|
|
||||||
<data name="BI0026" xml:space="preserve">
|
<data name="BI0026" xml:space="preserve">
|
||||||
<value>Could not parse the command line argument '--warnaserror': {0}</value>
|
<value>Could not parse the command line argument '--warnaserror': {0}</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -66,7 +66,8 @@ public class BindingTouch : IDisposable {
|
||||||
List<string> references = new List<string> ();
|
List<string> references = new List<string> ();
|
||||||
|
|
||||||
public MetadataLoadContext? universe;
|
public MetadataLoadContext? universe;
|
||||||
public TypeManager TypeManager = new TypeManager ();
|
public TypeManager? typeManager;
|
||||||
|
public TypeManager TypeManager => typeManager!;
|
||||||
public Frameworks? Frameworks;
|
public Frameworks? Frameworks;
|
||||||
public AttributeManager? AttributeManager;
|
public AttributeManager? AttributeManager;
|
||||||
bool disposedValue;
|
bool disposedValue;
|
||||||
|
@ -521,7 +522,7 @@ public class BindingTouch : IDisposable {
|
||||||
// Explicitly load our attribute library so that IKVM doesn't try (and fail) to find it.
|
// Explicitly load our attribute library so that IKVM doesn't try (and fail) to find it.
|
||||||
universe.LoadFromAssemblyPath (GetAttributeLibraryPath ());
|
universe.LoadFromAssemblyPath (GetAttributeLibraryPath ());
|
||||||
|
|
||||||
TypeManager.Initialize (this, api, universe.CoreAssembly, baselib);
|
typeManager ??= new (this, api, universe.CoreAssembly, baselib);
|
||||||
|
|
||||||
foreach (var linkWith in AttributeManager.GetCustomAttributes<LinkWithAttribute> (api)) {
|
foreach (var linkWith in AttributeManager.GetCustomAttributes<LinkWithAttribute> (api)) {
|
||||||
if (!linkwith.Contains (linkWith.LibraryName)) {
|
if (!linkwith.Contains (linkWith.LibraryName)) {
|
||||||
|
|
|
@ -524,72 +524,6 @@ public partial class Generator : IMemberGatherer {
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<Type, string> nsnumber_return_map;
|
|
||||||
Dictionary<Type, string> NSNumberReturnMap {
|
|
||||||
get {
|
|
||||||
if (nsnumber_return_map == null) {
|
|
||||||
nsnumber_return_map = new Dictionary<Type, string> {
|
|
||||||
{ TypeManager.System_Boolean, ".BoolValue" },
|
|
||||||
{ TypeManager.System_Byte, ".ByteValue" },
|
|
||||||
{ TypeManager.System_Double, ".DoubleValue" },
|
|
||||||
{ TypeManager.System_Float, ".FloatValue" },
|
|
||||||
{ TypeManager.System_Int16, ".Int16Value" },
|
|
||||||
{ TypeManager.System_Int32, ".Int32Value" },
|
|
||||||
{ TypeManager.System_Int64, ".Int64Value" },
|
|
||||||
{ TypeManager.System_SByte, ".SByteValue" },
|
|
||||||
{ TypeManager.System_UInt16, ".UInt16Value" },
|
|
||||||
{ TypeManager.System_UInt32, ".UInt32Value" },
|
|
||||||
{ TypeManager.System_UInt64, ".UInt64Value" },
|
|
||||||
};
|
|
||||||
nsnumber_return_map [TypeManager.System_nfloat] = ".NFloatValue";
|
|
||||||
nsnumber_return_map [TypeManager.System_nint] = ".NIntValue";
|
|
||||||
nsnumber_return_map [TypeManager.System_nuint] = ".NUIntValue";
|
|
||||||
}
|
|
||||||
return nsnumber_return_map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Dictionary<Type, string> nsvalue_return_map;
|
|
||||||
Dictionary<Type, string> NSValueReturnMap {
|
|
||||||
get {
|
|
||||||
if (nsvalue_return_map == null) {
|
|
||||||
nsvalue_return_map = new Dictionary<Type, string> {
|
|
||||||
{ TypeManager.CGAffineTransform, ".CGAffineTransformValue" },
|
|
||||||
{ TypeManager.NSRange, ".RangeValue" },
|
|
||||||
{ TypeManager.CGVector, ".CGVectorValue" },
|
|
||||||
{ TypeManager.SCNMatrix4, ".SCNMatrix4Value" },
|
|
||||||
{ TypeManager.CLLocationCoordinate2D, ".CoordinateValue" },
|
|
||||||
{ TypeManager.SCNVector3, ".Vector3Value" },
|
|
||||||
{ TypeManager.SCNVector4, ".Vector4Value" }
|
|
||||||
};
|
|
||||||
|
|
||||||
nsvalue_return_map [TypeManager.CoreGraphics_CGPoint] = ".CGPointValue";
|
|
||||||
nsvalue_return_map [TypeManager.CoreGraphics_CGRect] = ".CGRectValue";
|
|
||||||
nsvalue_return_map [TypeManager.CoreGraphics_CGSize] = ".CGSizeValue";
|
|
||||||
|
|
||||||
if (Frameworks.HaveUIKit) {
|
|
||||||
nsvalue_return_map [TypeManager.UIEdgeInsets] = ".UIEdgeInsetsValue";
|
|
||||||
nsvalue_return_map [TypeManager.UIOffset] = ".UIOffsetValue";
|
|
||||||
nsvalue_return_map [TypeManager.NSDirectionalEdgeInsets] = ".DirectionalEdgeInsetsValue";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TypeManager.MKCoordinateSpan != null)
|
|
||||||
nsvalue_return_map [TypeManager.MKCoordinateSpan] = ".CoordinateSpanValue";
|
|
||||||
|
|
||||||
if (Frameworks.HaveCoreMedia) {
|
|
||||||
nsvalue_return_map [TypeManager.CMTimeRange] = ".CMTimeRangeValue";
|
|
||||||
nsvalue_return_map [TypeManager.CMTime] = ".CMTimeValue";
|
|
||||||
nsvalue_return_map [TypeManager.CMTimeMapping] = ".CMTimeMappingValue";
|
|
||||||
nsvalue_return_map [TypeManager.CMVideoDimensions] = ".CMVideoDimensionsValue";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Frameworks.HaveCoreAnimation)
|
|
||||||
nsvalue_return_map [TypeManager.CATransform3D] = ".CATransform3DValue";
|
|
||||||
}
|
|
||||||
return nsvalue_return_map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string GetFromBindAsWrapper (MemberInformation minfo, out string suffix)
|
string GetFromBindAsWrapper (MemberInformation minfo, out string suffix)
|
||||||
{
|
{
|
||||||
var declaringType = minfo.mi.DeclaringType;
|
var declaringType = minfo.mi.DeclaringType;
|
||||||
|
@ -609,10 +543,10 @@ public partial class Generator : IMemberGatherer {
|
||||||
var originalReturnType = method?.ReturnType ?? property?.PropertyType;
|
var originalReturnType = method?.ReturnType ?? property?.PropertyType;
|
||||||
|
|
||||||
if (originalReturnType == TypeManager.NSNumber) {
|
if (originalReturnType == TypeManager.NSNumber) {
|
||||||
if (!NSNumberReturnMap.TryGetValue (retType, out append)) {
|
if (!TypeManager.NSNumberReturnMap.TryGetValue (retType, out append)) {
|
||||||
if (retType.IsEnum) {
|
if (retType.IsEnum) {
|
||||||
var enumType = retType.GetEnumUnderlyingType ();
|
var enumType = retType.GetEnumUnderlyingType ();
|
||||||
if (!NSNumberReturnMap.TryGetValue (enumType, out append))
|
if (!TypeManager.NSNumberReturnMap.TryGetValue (enumType, out append))
|
||||||
throw GetBindAsException ("unbox", retType.Name, originalReturnType.Name, "container", minfo.mi);
|
throw GetBindAsException ("unbox", retType.Name, originalReturnType.Name, "container", minfo.mi);
|
||||||
} else
|
} else
|
||||||
throw GetBindAsException ("unbox", retType.Name, originalReturnType.Name, "container", minfo.mi);
|
throw GetBindAsException ("unbox", retType.Name, originalReturnType.Name, "container", minfo.mi);
|
||||||
|
@ -620,7 +554,7 @@ public partial class Generator : IMemberGatherer {
|
||||||
if (isNullable)
|
if (isNullable)
|
||||||
append = $"?{append}";
|
append = $"?{append}";
|
||||||
} else if (originalReturnType == TypeManager.NSValue) {
|
} else if (originalReturnType == TypeManager.NSValue) {
|
||||||
if (!NSValueReturnMap.TryGetValue (retType, out append)) {
|
if (!TypeManager.NSValueReturnMap.TryGetValue (retType, out append)) {
|
||||||
// HACK: These are problematic for X.M due to we do not ship System.Drawing for Full profile
|
// HACK: These are problematic for X.M due to we do not ship System.Drawing for Full profile
|
||||||
if (retType.Name == "RectangleF" || retType.Name == "SizeF" || retType.Name == "PointF")
|
if (retType.Name == "RectangleF" || retType.Name == "SizeF" || retType.Name == "PointF")
|
||||||
append = $".{retType.Name}Value";
|
append = $".{retType.Name}Value";
|
||||||
|
@ -641,7 +575,7 @@ public partial class Generator : IMemberGatherer {
|
||||||
if (arrType == TypeManager.NSString && !arrIsNullable)
|
if (arrType == TypeManager.NSString && !arrIsNullable)
|
||||||
append = $"ptr => {{\n\tusing (var str = Runtime.GetNSObject<NSString> (ptr)!) {{\n\t\treturn {FormatType (arrRetType.DeclaringType, arrRetType)}Extensions.GetValue (str);\n\t}}\n}}";
|
append = $"ptr => {{\n\tusing (var str = Runtime.GetNSObject<NSString> (ptr)!) {{\n\t\treturn {FormatType (arrRetType.DeclaringType, arrRetType)}Extensions.GetValue (str);\n\t}}\n}}";
|
||||||
else if (arrType == TypeManager.NSNumber && !arrIsNullable) {
|
else if (arrType == TypeManager.NSNumber && !arrIsNullable) {
|
||||||
if (NSNumberReturnMap.TryGetValue (arrRetType, out valueFetcher) || arrRetType.IsEnum) {
|
if (TypeManager.NSNumberReturnMap.TryGetValue (arrRetType, out valueFetcher) || arrRetType.IsEnum) {
|
||||||
var getterStr = string.Format ("{0}{1}", arrIsNullable ? "?" : string.Empty, arrRetType.IsEnum ? ".Int32Value" : valueFetcher);
|
var getterStr = string.Format ("{0}{1}", arrIsNullable ? "?" : string.Empty, arrRetType.IsEnum ? ".Int32Value" : valueFetcher);
|
||||||
append = string.Format ("ptr => {{\n\tusing (var num = Runtime.GetNSObject<NSNumber> (ptr)!) {{\n\t\treturn ({1}) num{0};\n\t}}\n}}", getterStr, FormatType (arrRetType.DeclaringType, arrRetType));
|
append = string.Format ("ptr => {{\n\tusing (var num = Runtime.GetNSObject<NSNumber> (ptr)!) {{\n\t\treturn ({1}) num{0};\n\t}}\n}}", getterStr, FormatType (arrRetType.DeclaringType, arrRetType));
|
||||||
} else
|
} else
|
||||||
|
@ -649,7 +583,7 @@ public partial class Generator : IMemberGatherer {
|
||||||
} else if (arrType == TypeManager.NSValue && !arrIsNullable) {
|
} else if (arrType == TypeManager.NSValue && !arrIsNullable) {
|
||||||
if (arrRetType.Name == "RectangleF" || arrRetType.Name == "SizeF" || arrRetType.Name == "PointF")
|
if (arrRetType.Name == "RectangleF" || arrRetType.Name == "SizeF" || arrRetType.Name == "PointF")
|
||||||
valueFetcher = $"{(arrIsNullable ? "?" : string.Empty)}.{arrRetType.Name}Value";
|
valueFetcher = $"{(arrIsNullable ? "?" : string.Empty)}.{arrRetType.Name}Value";
|
||||||
else if (!NSValueReturnMap.TryGetValue (arrRetType, out valueFetcher))
|
else if (!TypeManager.NSValueReturnMap.TryGetValue (arrRetType, out valueFetcher))
|
||||||
throw GetBindAsException ("unbox", retType.Name, arrType.Name, "array", minfo.mi);
|
throw GetBindAsException ("unbox", retType.Name, arrType.Name, "array", minfo.mi);
|
||||||
|
|
||||||
append = string.Format ("ptr => {{\n\tusing (var val = Runtime.GetNSObject<NSValue> (ptr)!) {{\n\t\treturn val{0};\n\t}}\n}}", valueFetcher);
|
append = string.Format ("ptr => {{\n\tusing (var val = Runtime.GetNSObject<NSValue> (ptr)!) {{\n\t\treturn val{0};\n\t}}\n}}", valueFetcher);
|
||||||
|
|
|
@ -42,15 +42,15 @@ public class MarshalTypeList : List<MarshalType> {
|
||||||
Add (typeManager.CVImageBuffer);
|
Add (typeManager.CVImageBuffer);
|
||||||
}
|
}
|
||||||
if (frameworks.HaveMediaToolbox)
|
if (frameworks.HaveMediaToolbox)
|
||||||
Add (new MarshalType (typeManager.MTAudioProcessingTap, create: "MediaToolbox.MTAudioProcessingTap.FromHandle("));
|
Add (new MarshalType (typeManager.MTAudioProcessingTap!, create: "MediaToolbox.MTAudioProcessingTap.FromHandle("));
|
||||||
if (frameworks.HaveAddressBook) {
|
if (frameworks.HaveAddressBook) {
|
||||||
Add (typeManager.ABAddressBook);
|
Add (typeManager.ABAddressBook);
|
||||||
Add (new MarshalType (typeManager.ABPerson, create: "(ABPerson) ABRecord.FromHandle (", closingCreate: ")!"));
|
Add (new MarshalType (typeManager.ABPerson!, create: "(ABPerson) ABRecord.FromHandle (", closingCreate: ")!"));
|
||||||
Add (new MarshalType (typeManager.ABRecord, create: "ABRecord.FromHandle (", closingCreate: ")!"));
|
Add (new MarshalType (typeManager.ABRecord!, create: "ABRecord.FromHandle (", closingCreate: ")!"));
|
||||||
}
|
}
|
||||||
if (frameworks.HaveCoreVideo) {
|
if (frameworks.HaveCoreVideo) {
|
||||||
// owns `false` like ptr ctor https://github.com/xamarin/xamarin-macios/blob/6f68ab6f79c5f1d96d2cbb1e697330623164e46d/src/CoreVideo/CVBuffer.cs#L74-L90
|
// owns `false` like ptr ctor https://github.com/xamarin/xamarin-macios/blob/6f68ab6f79c5f1d96d2cbb1e697330623164e46d/src/CoreVideo/CVBuffer.cs#L74-L90
|
||||||
Add (new MarshalType (typeManager.CVPixelBuffer, create: "Runtime.GetINativeObject<CVPixelBuffer> (", closingCreate: ", false)!"));
|
Add (new MarshalType (typeManager.CVPixelBuffer!, create: "Runtime.GetINativeObject<CVPixelBuffer> (", closingCreate: ", false)!"));
|
||||||
}
|
}
|
||||||
Add (typeManager.CGLayer);
|
Add (typeManager.CGLayer);
|
||||||
if (frameworks.HaveCoreMedia)
|
if (frameworks.HaveCoreMedia)
|
||||||
|
@ -63,7 +63,7 @@ public class MarshalTypeList : List<MarshalType> {
|
||||||
if (frameworks.HaveAudioUnit)
|
if (frameworks.HaveAudioUnit)
|
||||||
Add (typeManager.AudioComponent);
|
Add (typeManager.AudioComponent);
|
||||||
if (frameworks.HaveCoreMedia) {
|
if (frameworks.HaveCoreMedia) {
|
||||||
Add (new MarshalType (typeManager.CMFormatDescription, create: "CMFormatDescription.Create (", closingCreate: ")!"));
|
Add (new MarshalType (typeManager.CMFormatDescription!, create: "CMFormatDescription.Create (", closingCreate: ")!"));
|
||||||
Add (typeManager.CMAudioFormatDescription);
|
Add (typeManager.CMAudioFormatDescription);
|
||||||
Add (typeManager.CMVideoFormatDescription);
|
Add (typeManager.CMVideoFormatDescription);
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,12 @@ public class MarshalTypeList : List<MarshalType> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Add (Type? type)
|
||||||
|
{
|
||||||
|
if (type is not null)
|
||||||
|
base.Add (type);
|
||||||
|
}
|
||||||
|
|
||||||
#if NET
|
#if NET
|
||||||
public bool TryGetMarshalType (Type t, [NotNullWhen (true)] out MarshalType? res)
|
public bool TryGetMarshalType (Type t, [NotNullWhen (true)] out MarshalType? res)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
public static class TypeExtensions {
|
||||||
|
|
||||||
|
public static bool IsSubclassOfNotNullable (this Type? type, Type? parent)
|
||||||
|
{
|
||||||
|
if (type is null || parent is null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return type.IsSubclassOf (parent);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,140 +1,256 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
public class TypeManager {
|
public class TypeManager {
|
||||||
BindingTouch BindingTouch;
|
Frameworks Frameworks { get; }
|
||||||
Frameworks Frameworks { get { return BindingTouch.Frameworks; } }
|
|
||||||
|
|
||||||
public Type System_Attribute;
|
public Type System_Attribute { get; }
|
||||||
public Type System_Boolean;
|
public Type System_Boolean { get; }
|
||||||
public Type System_Byte;
|
public Type System_Byte { get; }
|
||||||
public Type System_Char;
|
public Type System_Char { get; }
|
||||||
public Type System_Delegate;
|
public Type System_Delegate { get; }
|
||||||
public Type System_Double;
|
public Type System_Double { get; }
|
||||||
public Type System_Float;
|
public Type System_Float { get; }
|
||||||
public Type System_Int16;
|
public Type System_Int16 { get; }
|
||||||
public Type System_Int32;
|
public Type System_Int32 { get; }
|
||||||
public Type System_Int64;
|
public Type System_Int64 { get; }
|
||||||
public Type System_IntPtr;
|
public Type System_IntPtr { get; }
|
||||||
public Type System_Object;
|
public Type System_Object { get; }
|
||||||
public Type System_SByte;
|
public Type System_SByte { get; }
|
||||||
public Type System_String;
|
public Type System_String { get; }
|
||||||
public Type System_String_Array;
|
public Type System_String_Array { get; }
|
||||||
public Type System_UInt16;
|
public Type System_UInt16 { get; }
|
||||||
public Type System_UInt32;
|
public Type System_UInt32 { get; }
|
||||||
public Type System_UInt64;
|
public Type System_UInt64 { get; }
|
||||||
public Type System_UIntPtr;
|
public Type System_UIntPtr { get; }
|
||||||
public Type System_Void;
|
public Type System_Void { get; }
|
||||||
|
|
||||||
public Type System_nint;
|
public Type System_nint { get; }
|
||||||
public Type System_nuint;
|
public Type System_nuint { get; }
|
||||||
public Type System_nfloat;
|
public Type System_nfloat { get; }
|
||||||
|
|
||||||
/* fundamental */
|
/* fundamental */
|
||||||
public Type NSObject;
|
public Type NSObject { get; }
|
||||||
public Type INativeObject;
|
public Type INativeObject { get; }
|
||||||
|
|
||||||
/* objcruntime */
|
/* objcruntime */
|
||||||
public Type BlockLiteral;
|
public Type BlockLiteral { get; }
|
||||||
public Type Class;
|
public Type Class { get; }
|
||||||
public Type Protocol;
|
public Type Protocol { get; }
|
||||||
public Type Selector;
|
public Type Selector { get; }
|
||||||
|
|
||||||
public Type Constants;
|
public Type Constants { get; }
|
||||||
|
|
||||||
/* Different binding types */
|
/* Different binding types */
|
||||||
|
public Type DictionaryContainerType { get; }
|
||||||
|
public Type AudioBuffers { get; }
|
||||||
|
public Type AVCaptureWhiteBalanceGains { get; }
|
||||||
|
public Type CFRunLoop { get; }
|
||||||
|
public Type CGAffineTransform { get; }
|
||||||
|
public Type CGColor { get; }
|
||||||
|
public Type CGColorSpace { get; }
|
||||||
|
public Type CGContext { get; }
|
||||||
|
public Type CGPDFDocument { get; }
|
||||||
|
public Type CGPDFPage { get; }
|
||||||
|
public Type CGGradient { get; }
|
||||||
|
public Type CGImage { get; }
|
||||||
|
public Type CGImageSource { get; }
|
||||||
|
public Type CGLayer { get; }
|
||||||
|
public Type CGPath { get; }
|
||||||
|
public Type CGVector { get; }
|
||||||
|
public Type DispatchQueue { get; }
|
||||||
|
public Type DispatchData { get; }
|
||||||
|
public Type NSNumber { get; }
|
||||||
|
public Type NSRange { get; }
|
||||||
|
public Type NSString { get; }
|
||||||
|
public Type NSValue { get; }
|
||||||
|
public Type NSZone { get; }
|
||||||
|
public Type SCNMatrix4 { get; }
|
||||||
|
public Type SCNVector3 { get; }
|
||||||
|
public Type SCNVector4 { get; }
|
||||||
|
public Type SecAccessControl { get; }
|
||||||
|
public Type SecIdentity { get; }
|
||||||
|
public Type SecTrust { get; }
|
||||||
|
public Type SecProtocolMetadata { get; }
|
||||||
|
public Type SecProtocolOptions { get; }
|
||||||
|
public Type SecTrust2 { get; }
|
||||||
|
public Type SecIdentity2 { get; }
|
||||||
|
public Type CoreGraphics_CGPoint { get; }
|
||||||
|
public Type CoreGraphics_CGRect { get; }
|
||||||
|
public Type CoreGraphics_CGSize { get; }
|
||||||
|
|
||||||
public Type DictionaryContainerType;
|
// optional if AddressBook present
|
||||||
|
public Type? ABAddressBook { get; }
|
||||||
|
public Type? ABPerson { get; }
|
||||||
|
public Type? ABRecord { get; }
|
||||||
|
|
||||||
public Type ABAddressBook;
|
// optional if AudioToolbox present
|
||||||
public Type ABPerson;
|
public Type? MusicSequence { get; }
|
||||||
public Type ABRecord;
|
|
||||||
public Type AudioBuffers;
|
|
||||||
public Type AudioComponent;
|
|
||||||
public Type AudioUnit;
|
|
||||||
public Type AURenderEventEnumerator;
|
|
||||||
public Type AVCaptureWhiteBalanceGains;
|
|
||||||
public Type CATransform3D;
|
|
||||||
public Type CFRunLoop;
|
|
||||||
public Type CGAffineTransform;
|
|
||||||
public Type CGColor;
|
|
||||||
public Type CGColorSpace;
|
|
||||||
public Type CGContext;
|
|
||||||
public Type CGPDFDocument;
|
|
||||||
public Type CGPDFPage;
|
|
||||||
public Type CGGradient;
|
|
||||||
public Type CGImage;
|
|
||||||
public Type CGImageSource;
|
|
||||||
public Type CGLayer;
|
|
||||||
public Type CGLContext;
|
|
||||||
public Type CGLPixelFormat;
|
|
||||||
public Type CGPath;
|
|
||||||
public Type CGVector;
|
|
||||||
public Type CLLocationCoordinate2D;
|
|
||||||
public Type CMAudioFormatDescription;
|
|
||||||
public Type CMClock;
|
|
||||||
public Type CMFormatDescription;
|
|
||||||
public Type CMSampleBuffer;
|
|
||||||
public Type CMTime;
|
|
||||||
public Type CMTimebase;
|
|
||||||
public Type CMTimeMapping;
|
|
||||||
public Type CMTimeRange;
|
|
||||||
public Type CMVideoFormatDescription;
|
|
||||||
public Type CMVideoDimensions;
|
|
||||||
public Type CVImageBuffer;
|
|
||||||
public Type CVPixelBuffer;
|
|
||||||
public Type CVPixelBufferPool;
|
|
||||||
public Type DispatchQueue;
|
|
||||||
public Type DispatchData;
|
|
||||||
public Type MidiEndpoint;
|
|
||||||
public Type MKCoordinateSpan;
|
|
||||||
public Type MTAudioProcessingTap;
|
|
||||||
public Type MusicSequence;
|
|
||||||
public Type NSNumber;
|
|
||||||
public Type NSRange;
|
|
||||||
public Type NSString;
|
|
||||||
public Type NSValue;
|
|
||||||
public Type NSZone;
|
|
||||||
public Type SCNMatrix4;
|
|
||||||
public Type SCNVector3;
|
|
||||||
public Type SCNVector4;
|
|
||||||
public Type SecAccessControl;
|
|
||||||
public Type SecIdentity;
|
|
||||||
public Type SecTrust;
|
|
||||||
public Type SecProtocolMetadata;
|
|
||||||
public Type SecProtocolOptions;
|
|
||||||
public Type SecTrust2;
|
|
||||||
public Type SecIdentity2;
|
|
||||||
public Type UIEdgeInsets;
|
|
||||||
public Type UIOffset;
|
|
||||||
public Type NSDirectionalEdgeInsets;
|
|
||||||
|
|
||||||
public Type CoreGraphics_CGPoint;
|
// optional if AudioUnit present
|
||||||
public Type CoreGraphics_CGRect;
|
public Type? AudioComponent { get; }
|
||||||
public Type CoreGraphics_CGSize;
|
public Type? AudioUnit { get; }
|
||||||
|
public Type? AURenderEventEnumerator { get; }
|
||||||
|
|
||||||
Assembly api_assembly;
|
// optional if CoreAnimation present
|
||||||
Assembly corlib_assembly;
|
public Type? CATransform3D { get; }
|
||||||
Assembly platform_assembly;
|
|
||||||
|
|
||||||
Type Lookup (Assembly assembly, string @namespace, string @typename, bool inexistentOK = false)
|
// optional if OpenGL present
|
||||||
{
|
public Type? CGLContext { get; }
|
||||||
string fullname;
|
public Type? CGLPixelFormat { get; }
|
||||||
|
|
||||||
if (string.IsNullOrEmpty (@namespace)) {
|
// optional if CoreLocation present
|
||||||
fullname = @typename;
|
public Type? CLLocationCoordinate2D { get; }
|
||||||
} else {
|
|
||||||
fullname = @namespace + "." + @typename;
|
// optional if CoreMedia present
|
||||||
|
public Type? CMAudioFormatDescription { get; }
|
||||||
|
public Type? CMClock { get; }
|
||||||
|
public Type? CMFormatDescription { get; }
|
||||||
|
public Type? CMSampleBuffer { get; }
|
||||||
|
public Type? CMTime { get; }
|
||||||
|
public Type? CMTimebase { get; }
|
||||||
|
public Type? CMTimeMapping { get; }
|
||||||
|
public Type? CMTimeRange { get; }
|
||||||
|
public Type? CMVideoFormatDescription { get; }
|
||||||
|
public Type? CMVideoDimensions { get; }
|
||||||
|
|
||||||
|
// optional if CoreVideo present
|
||||||
|
public Type? CVImageBuffer { get; }
|
||||||
|
public Type? CVPixelBuffer { get; }
|
||||||
|
public Type? CVPixelBufferPool { get; }
|
||||||
|
|
||||||
|
// optional if CoreMidi present
|
||||||
|
public Type? MidiEndpoint { get; }
|
||||||
|
|
||||||
|
// optional if MapKit present
|
||||||
|
public Type? MKCoordinateSpan { get; }
|
||||||
|
|
||||||
|
// optional if MediaToolbox is present
|
||||||
|
public Type? MTAudioProcessingTap { get; }
|
||||||
|
|
||||||
|
// optional if UIKit is present
|
||||||
|
public Type? UIOffset { get; }
|
||||||
|
public Type? UIEdgeInsets { get; }
|
||||||
|
public Type? NSDirectionalEdgeInsets { get; }
|
||||||
|
|
||||||
|
Dictionary<Type, string>? nsnumberReturnMap;
|
||||||
|
public Dictionary<Type, string> NSNumberReturnMap {
|
||||||
|
get {
|
||||||
|
if (nsnumberReturnMap is not null)
|
||||||
|
return nsnumberReturnMap;
|
||||||
|
Tuple<Type?, string> [] typeMap = {
|
||||||
|
new (System_Boolean, ".BoolValue"),
|
||||||
|
new (System_Byte, ".ByteValue"),
|
||||||
|
new (System_Double, ".DoubleValue"),
|
||||||
|
new (System_Float, ".FloatValue"),
|
||||||
|
new (System_Int16, ".Int16Value"),
|
||||||
|
new (System_Int32, ".Int32Value"),
|
||||||
|
new (System_Int64, ".Int64Value"),
|
||||||
|
new (System_SByte, ".SByteValue"),
|
||||||
|
new (System_UInt16, ".UInt16Value"),
|
||||||
|
new (System_UInt32, ".UInt32Value"),
|
||||||
|
new (System_UInt64, ".UInt64Value"),
|
||||||
|
new (System_nfloat, ".NFloatValue"),
|
||||||
|
new (System_nint, ".NIntValue"),
|
||||||
|
new (System_nuint, ".NUIntValue"),
|
||||||
|
};
|
||||||
|
nsnumberReturnMap = new ();
|
||||||
|
foreach (var tuple in typeMap) {
|
||||||
|
if (tuple.Item1 is not null)
|
||||||
|
nsnumberReturnMap [tuple.Item1] = tuple.Item2;
|
||||||
|
}
|
||||||
|
return nsnumberReturnMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rv = assembly.GetType (fullname);
|
|
||||||
if (rv == null && !inexistentOK)
|
|
||||||
throw new BindingException (1052, true, fullname, assembly);
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type GetUnderlyingNullableType (Type type)
|
Dictionary<Type, string>? nsvalueReturnMap;
|
||||||
|
public Dictionary<Type, string> NSValueReturnMap {
|
||||||
|
get {
|
||||||
|
if (nsvalueReturnMap is not null)
|
||||||
|
return nsvalueReturnMap;
|
||||||
|
Tuple<Type?, string> [] general = {
|
||||||
|
new (CGAffineTransform, ".CGAffineTransformValue" ),
|
||||||
|
new (NSRange, ".RangeValue" ),
|
||||||
|
new (CGVector, ".CGVectorValue" ),
|
||||||
|
new (SCNMatrix4, ".SCNMatrix4Value" ),
|
||||||
|
new (CLLocationCoordinate2D, ".CoordinateValue" ),
|
||||||
|
new (SCNVector3, ".Vector3Value" ),
|
||||||
|
new (SCNVector4, ".Vector4Value" ),
|
||||||
|
new (CoreGraphics_CGPoint, ".CGPointValue"),
|
||||||
|
new (CoreGraphics_CGRect, ".CGRectValue"),
|
||||||
|
new (CoreGraphics_CGSize, ".CGSizeValue"),
|
||||||
|
new (MKCoordinateSpan, ".CoordinateSpanValue"),
|
||||||
|
};
|
||||||
|
|
||||||
|
Tuple<Type?, string> [] uiKitMap = Array.Empty<Tuple<Type?, string>> ();
|
||||||
|
if (Frameworks.HaveUIKit)
|
||||||
|
uiKitMap = new Tuple<Type?, string> [] {
|
||||||
|
new (UIEdgeInsets, ".UIEdgeInsetsValue"),
|
||||||
|
new (UIOffset, ".UIOffsetValue"),
|
||||||
|
new (NSDirectionalEdgeInsets, ".DirectionalEdgeInsetsValue"),
|
||||||
|
};
|
||||||
|
|
||||||
|
Tuple<Type?, string> [] coreMedia = Array.Empty<Tuple<Type?, string>> ();
|
||||||
|
if (Frameworks.HaveCoreMedia)
|
||||||
|
coreMedia = new Tuple<Type?, string> [] {
|
||||||
|
new (CMTimeRange, ".CMTimeRangeValue"),
|
||||||
|
new (CMTime, ".CMTimeValue"),
|
||||||
|
new (CMTimeMapping, ".CMTimeMappingValue"),
|
||||||
|
new (CMVideoDimensions, ".CMVideoDimensionsValue"),
|
||||||
|
};
|
||||||
|
|
||||||
|
Tuple<Type?, string> [] animation = Array.Empty<Tuple<Type?, string>> ();
|
||||||
|
if (Frameworks.HaveCoreAnimation)
|
||||||
|
animation = new Tuple<Type?, string> [] {
|
||||||
|
new (CATransform3D, ".CATransform3DValue"),
|
||||||
|
};
|
||||||
|
|
||||||
|
nsvalueReturnMap = new ();
|
||||||
|
foreach (var typeMap in new [] { general, uiKitMap, coreMedia, animation }) {
|
||||||
|
foreach (var tuple in typeMap) {
|
||||||
|
if (tuple.Item1 is not null)
|
||||||
|
nsvalueReturnMap [tuple.Item1] = tuple.Item2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nsvalueReturnMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if NET
|
||||||
|
static bool TryGetType (Assembly assembly, string @namespace, string typename, out string fullname, [NotNullWhen (true)] out Type? type)
|
||||||
|
#else
|
||||||
|
static bool TryGetType (Assembly assembly, string @namespace, string typename, out string fullname, out Type? type)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty (@namespace)) {
|
||||||
|
fullname = typename;
|
||||||
|
} else {
|
||||||
|
fullname = @namespace + "." + typename;
|
||||||
|
}
|
||||||
|
|
||||||
|
type = assembly.GetType (fullname);
|
||||||
|
return type is not null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Type Lookup (Assembly assembly, string @namespace, string typename)
|
||||||
|
{
|
||||||
|
if (!TryGetType (assembly, @namespace, typename, out var fullname, out var rv))
|
||||||
|
throw new BindingException (1052, true, fullname, assembly);
|
||||||
|
return rv!;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Type? ConditionalLookup (Assembly assembly, string @namespace, string typename, bool inexistentOk = false)
|
||||||
|
{
|
||||||
|
if (!TryGetType (assembly, @namespace, typename, out var fullname, out var rv) && !inexistentOk)
|
||||||
|
throw new BindingException (1052, true, fullname, assembly);
|
||||||
|
return rv; // maybe null
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type? GetUnderlyingNullableType (Type type)
|
||||||
{
|
{
|
||||||
if (!type.IsConstructedGenericType)
|
if (!type.IsConstructedGenericType)
|
||||||
return null;
|
return null;
|
||||||
|
@ -152,149 +268,149 @@ public class TypeManager {
|
||||||
return type.GenericTypeArguments [0];
|
return type.GenericTypeArguments [0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize (BindingTouch binding_touch, Assembly api, Assembly corlib, Assembly platform)
|
public TypeManager (BindingTouch bindingTouch, Assembly apiAssembly, Assembly corlibAssembly, Assembly platformAssembly)
|
||||||
{
|
{
|
||||||
BindingTouch = binding_touch;
|
if (bindingTouch.Frameworks is null)
|
||||||
|
throw ErrorHelper.CreateError (3, bindingTouch.CurrentPlatform);
|
||||||
|
if (bindingTouch.universe is null)
|
||||||
|
throw ErrorHelper.CreateError (4, bindingTouch.CurrentPlatform);
|
||||||
|
|
||||||
api_assembly = api;
|
Frameworks = bindingTouch.Frameworks;
|
||||||
corlib_assembly = corlib;
|
|
||||||
platform_assembly = platform;
|
|
||||||
|
|
||||||
/* corlib */
|
/* corlib */
|
||||||
System_Attribute = Lookup (corlib_assembly, "System", "Attribute");
|
System_Attribute = Lookup (corlibAssembly, "System", "Attribute");
|
||||||
System_Boolean = Lookup (corlib_assembly, "System", "Boolean");
|
System_Boolean = Lookup (corlibAssembly, "System", "Boolean");
|
||||||
System_Byte = Lookup (corlib_assembly, "System", "Byte");
|
System_Byte = Lookup (corlibAssembly, "System", "Byte");
|
||||||
System_Char = Lookup (corlib_assembly, "System", "Char");
|
System_Char = Lookup (corlibAssembly, "System", "Char");
|
||||||
System_Delegate = Lookup (corlib_assembly, "System", "Delegate");
|
System_Delegate = Lookup (corlibAssembly, "System", "Delegate");
|
||||||
System_Double = Lookup (corlib_assembly, "System", "Double");
|
System_Double = Lookup (corlibAssembly, "System", "Double");
|
||||||
System_Float = Lookup (corlib_assembly, "System", "Single");
|
System_Float = Lookup (corlibAssembly, "System", "Single");
|
||||||
System_Int16 = Lookup (corlib_assembly, "System", "Int16");
|
System_Int16 = Lookup (corlibAssembly, "System", "Int16");
|
||||||
System_Int32 = Lookup (corlib_assembly, "System", "Int32");
|
System_Int32 = Lookup (corlibAssembly, "System", "Int32");
|
||||||
System_Int64 = Lookup (corlib_assembly, "System", "Int64");
|
System_Int64 = Lookup (corlibAssembly, "System", "Int64");
|
||||||
System_IntPtr = Lookup (corlib_assembly, "System", "IntPtr");
|
System_IntPtr = Lookup (corlibAssembly, "System", "IntPtr");
|
||||||
System_Object = Lookup (corlib_assembly, "System", "Object");
|
System_Object = Lookup (corlibAssembly, "System", "Object");
|
||||||
System_SByte = Lookup (corlib_assembly, "System", "SByte");
|
System_SByte = Lookup (corlibAssembly, "System", "SByte");
|
||||||
System_String = Lookup (corlib_assembly, "System", "String");
|
System_String = Lookup (corlibAssembly, "System", "String");
|
||||||
System_String_Array = Lookup (corlib_assembly, "System", "String").MakeArrayType ();
|
System_String_Array = Lookup (corlibAssembly, "System", "String").MakeArrayType ();
|
||||||
System_UInt16 = Lookup (corlib_assembly, "System", "UInt16");
|
System_UInt16 = Lookup (corlibAssembly, "System", "UInt16");
|
||||||
System_UInt32 = Lookup (corlib_assembly, "System", "UInt32");
|
System_UInt32 = Lookup (corlibAssembly, "System", "UInt32");
|
||||||
System_UInt64 = Lookup (corlib_assembly, "System", "UInt64");
|
System_UInt64 = Lookup (corlibAssembly, "System", "UInt64");
|
||||||
System_UIntPtr = Lookup (corlib_assembly, "System", "UIntPtr");
|
System_UIntPtr = Lookup (corlibAssembly, "System", "UIntPtr");
|
||||||
System_Void = Lookup (corlib_assembly, "System", "Void");
|
System_Void = Lookup (corlibAssembly, "System", "Void");
|
||||||
|
|
||||||
#if NET
|
#if NET
|
||||||
System_nint = Lookup (corlib_assembly, "System", "IntPtr");
|
System_nint = Lookup (corlibAssembly, "System", "IntPtr");
|
||||||
System_nuint = Lookup (corlib_assembly, "System", "UIntPtr");
|
System_nuint = Lookup (corlibAssembly, "System", "UIntPtr");
|
||||||
var interop_assembly = binding_touch.universe.LoadFromAssemblyName ("System.Runtime.InteropServices");
|
var interopAssembly = bindingTouch.universe.LoadFromAssemblyName ("System.Runtime.InteropServices");
|
||||||
System_nfloat = Lookup (interop_assembly, "System.Runtime.InteropServices", "NFloat");
|
System_nfloat = Lookup (interopAssembly, "System.Runtime.InteropServices", "NFloat");
|
||||||
#else
|
#else
|
||||||
System_nint = Lookup (platform_assembly, "System", "nint");
|
System_nint = Lookup (platformAssembly, "System", "nint");
|
||||||
System_nuint = Lookup (platform_assembly, "System", "nuint");
|
System_nuint = Lookup (platformAssembly, "System", "nuint");
|
||||||
System_nfloat = Lookup (platform_assembly, "System", "nfloat");
|
System_nfloat = Lookup (platformAssembly, "System", "nfloat");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* fundamental */
|
/* fundamental */
|
||||||
NSObject = Lookup (platform_assembly, "Foundation", "NSObject");
|
NSObject = Lookup (platformAssembly, "Foundation", "NSObject");
|
||||||
INativeObject = Lookup (platform_assembly, "ObjCRuntime", "INativeObject");
|
INativeObject = Lookup (platformAssembly, "ObjCRuntime", "INativeObject");
|
||||||
|
|
||||||
/* objcruntime */
|
/* objcruntime */
|
||||||
BlockLiteral = Lookup (platform_assembly, "ObjCRuntime", "BlockLiteral");
|
BlockLiteral = Lookup (platformAssembly, "ObjCRuntime", "BlockLiteral");
|
||||||
Class = Lookup (platform_assembly, "ObjCRuntime", "Class");
|
Class = Lookup (platformAssembly, "ObjCRuntime", "Class");
|
||||||
Protocol = Lookup (platform_assembly, "ObjCRuntime", "Protocol");
|
Protocol = Lookup (platformAssembly, "ObjCRuntime", "Protocol");
|
||||||
Selector = Lookup (platform_assembly, "ObjCRuntime", "Selector");
|
Selector = Lookup (platformAssembly, "ObjCRuntime", "Selector");
|
||||||
|
|
||||||
Constants = Lookup (platform_assembly, "ObjCRuntime", "Constants");
|
Constants = Lookup (platformAssembly, "ObjCRuntime", "Constants");
|
||||||
|
|
||||||
/* Different binding types */
|
/* Different binding types */
|
||||||
|
|
||||||
DictionaryContainerType = Lookup (platform_assembly, "Foundation", "DictionaryContainer");
|
DictionaryContainerType = Lookup (platformAssembly, "Foundation", "DictionaryContainer");
|
||||||
|
|
||||||
if (Frameworks.HaveAddressBook) {
|
|
||||||
ABAddressBook = Lookup (platform_assembly, "AddressBook", "ABAddressBook");
|
|
||||||
ABPerson = Lookup (platform_assembly, "AddressBook", "ABPerson");
|
|
||||||
ABRecord = Lookup (platform_assembly, "AddressBook", "ABRecord");
|
|
||||||
}
|
|
||||||
// misplaced API, it's really in CoreAudio (now available everywhere)
|
// misplaced API, it's really in CoreAudio (now available everywhere)
|
||||||
AudioBuffers = Lookup (platform_assembly, "AudioToolbox", "AudioBuffers");
|
AudioBuffers = Lookup (platformAssembly, "AudioToolbox", "AudioBuffers");
|
||||||
|
AVCaptureWhiteBalanceGains = Lookup (platformAssembly, "AVFoundation", "AVCaptureWhiteBalanceGains");
|
||||||
|
CFRunLoop = Lookup (platformAssembly, "CoreFoundation", "CFRunLoop");
|
||||||
|
CGAffineTransform = Lookup (platformAssembly, "CoreGraphics", "CGAffineTransform");
|
||||||
|
CGColor = Lookup (platformAssembly, "CoreGraphics", "CGColor");
|
||||||
|
CGColorSpace = Lookup (platformAssembly, "CoreGraphics", "CGColorSpace");
|
||||||
|
CGContext = Lookup (platformAssembly, "CoreGraphics", "CGContext");
|
||||||
|
CGPDFDocument = Lookup (platformAssembly, "CoreGraphics", "CGPDFDocument");
|
||||||
|
CGPDFPage = Lookup (platformAssembly, "CoreGraphics", "CGPDFPage");
|
||||||
|
CGGradient = Lookup (platformAssembly, "CoreGraphics", "CGGradient");
|
||||||
|
CGImage = Lookup (platformAssembly, "CoreGraphics", "CGImage");
|
||||||
|
CGImageSource = Lookup (platformAssembly, "ImageIO", "CGImageSource");
|
||||||
|
CGLayer = Lookup (platformAssembly, "CoreGraphics", "CGLayer");
|
||||||
|
CGPath = Lookup (platformAssembly, "CoreGraphics", "CGPath");
|
||||||
|
CGVector = Lookup (platformAssembly, "CoreGraphics", "CGVector");
|
||||||
|
DispatchQueue = Lookup (platformAssembly, "CoreFoundation", "DispatchQueue");
|
||||||
|
DispatchData = Lookup (platformAssembly, "CoreFoundation", "DispatchData");
|
||||||
|
NSNumber = Lookup (bindingTouch.BindThirdPartyLibrary ? platformAssembly : apiAssembly, "Foundation", "NSNumber");
|
||||||
|
NSRange = Lookup (platformAssembly, "Foundation", "NSRange");
|
||||||
|
NSString = Lookup (platformAssembly, "Foundation", "NSString");
|
||||||
|
NSValue = Lookup (bindingTouch.BindThirdPartyLibrary ? platformAssembly : apiAssembly, "Foundation", "NSValue");
|
||||||
|
NSZone = Lookup (platformAssembly, "Foundation", "NSZone");
|
||||||
|
SCNVector3 = Lookup (platformAssembly, "SceneKit", "SCNVector3");
|
||||||
|
SCNVector4 = Lookup (platformAssembly, "SceneKit", "SCNVector4");
|
||||||
|
SCNMatrix4 = Lookup (platformAssembly, "SceneKit", "SCNMatrix4");
|
||||||
|
SecAccessControl = Lookup (platformAssembly, "Security", "SecAccessControl");
|
||||||
|
SecIdentity = Lookup (platformAssembly, "Security", "SecIdentity");
|
||||||
|
SecTrust = Lookup (platformAssembly, "Security", "SecTrust");
|
||||||
|
SecProtocolOptions = Lookup (platformAssembly, "Security", "SecProtocolOptions");
|
||||||
|
SecProtocolMetadata = Lookup (platformAssembly, "Security", "SecProtocolMetadata");
|
||||||
|
SecTrust2 = Lookup (platformAssembly, "Security", "SecTrust2");
|
||||||
|
SecIdentity2 = Lookup (platformAssembly, "Security", "SecIdentity2");
|
||||||
|
CoreGraphics_CGRect = Lookup (platformAssembly, "CoreGraphics", "CGRect");
|
||||||
|
CoreGraphics_CGPoint = Lookup (platformAssembly, "CoreGraphics", "CGPoint");
|
||||||
|
CoreGraphics_CGSize = Lookup (platformAssembly, "CoreGraphics", "CGSize");
|
||||||
|
|
||||||
|
// optional types per framework
|
||||||
|
if (Frameworks.HaveAddressBook) {
|
||||||
|
ABAddressBook = ConditionalLookup (platformAssembly, "AddressBook", "ABAddressBook");
|
||||||
|
ABPerson = ConditionalLookup (platformAssembly, "AddressBook", "ABPerson");
|
||||||
|
ABRecord = ConditionalLookup (platformAssembly, "AddressBook", "ABRecord");
|
||||||
|
}
|
||||||
if (Frameworks.HaveAudioToolbox) {
|
if (Frameworks.HaveAudioToolbox) {
|
||||||
MusicSequence = Lookup (platform_assembly, "AudioToolbox", "MusicSequence", true /* may not be found */);
|
MusicSequence = ConditionalLookup (platformAssembly, "AudioToolbox", "MusicSequence", true /* may not be found */);
|
||||||
}
|
}
|
||||||
if (Frameworks.HaveAudioUnit) {
|
if (Frameworks.HaveAudioUnit) {
|
||||||
AudioComponent = Lookup (platform_assembly, "AudioUnit", "AudioComponent");
|
AudioComponent = ConditionalLookup (platformAssembly, "AudioUnit", "AudioComponent");
|
||||||
AudioUnit = Lookup (platform_assembly, "AudioUnit", "AudioUnit");
|
AudioUnit = ConditionalLookup (platformAssembly, "AudioUnit", "AudioUnit");
|
||||||
AURenderEventEnumerator = Lookup (platform_assembly, "AudioUnit", "AURenderEventEnumerator");
|
AURenderEventEnumerator = ConditionalLookup (platformAssembly, "AudioUnit", "AURenderEventEnumerator");
|
||||||
}
|
}
|
||||||
AVCaptureWhiteBalanceGains = Lookup (platform_assembly, "AVFoundation", "AVCaptureWhiteBalanceGains");
|
|
||||||
if (Frameworks.HaveCoreAnimation)
|
if (Frameworks.HaveCoreAnimation)
|
||||||
CATransform3D = Lookup (platform_assembly, "CoreAnimation", "CATransform3D");
|
CATransform3D = ConditionalLookup (platformAssembly, "CoreAnimation", "CATransform3D");
|
||||||
|
|
||||||
CFRunLoop = Lookup (platform_assembly, "CoreFoundation", "CFRunLoop");
|
|
||||||
CGAffineTransform = Lookup (platform_assembly, "CoreGraphics", "CGAffineTransform");
|
|
||||||
CGColor = Lookup (platform_assembly, "CoreGraphics", "CGColor");
|
|
||||||
CGColorSpace = Lookup (platform_assembly, "CoreGraphics", "CGColorSpace");
|
|
||||||
CGContext = Lookup (platform_assembly, "CoreGraphics", "CGContext");
|
|
||||||
CGPDFDocument = Lookup (platform_assembly, "CoreGraphics", "CGPDFDocument");
|
|
||||||
CGPDFPage = Lookup (platform_assembly, "CoreGraphics", "CGPDFPage");
|
|
||||||
CGGradient = Lookup (platform_assembly, "CoreGraphics", "CGGradient");
|
|
||||||
CGImage = Lookup (platform_assembly, "CoreGraphics", "CGImage");
|
|
||||||
CGImageSource = Lookup (platform_assembly, "ImageIO", "CGImageSource");
|
|
||||||
CGLayer = Lookup (platform_assembly, "CoreGraphics", "CGLayer");
|
|
||||||
if (Frameworks.HaveOpenGL) {
|
if (Frameworks.HaveOpenGL) {
|
||||||
CGLContext = Lookup (platform_assembly, "OpenGL", "CGLContext");
|
CGLContext = ConditionalLookup (platformAssembly, "OpenGL", "CGLContext");
|
||||||
CGLPixelFormat = Lookup (platform_assembly, "OpenGL", "CGLPixelFormat");
|
CGLPixelFormat = ConditionalLookup (platformAssembly, "OpenGL", "CGLPixelFormat");
|
||||||
}
|
}
|
||||||
CGPath = Lookup (platform_assembly, "CoreGraphics", "CGPath");
|
|
||||||
CGVector = Lookup (platform_assembly, "CoreGraphics", "CGVector");
|
|
||||||
if (Frameworks.HaveCoreLocation)
|
if (Frameworks.HaveCoreLocation)
|
||||||
CLLocationCoordinate2D = Lookup (platform_assembly, "CoreLocation", "CLLocationCoordinate2D");
|
CLLocationCoordinate2D = ConditionalLookup (platformAssembly, "CoreLocation", "CLLocationCoordinate2D");
|
||||||
if (Frameworks.HaveCoreMedia) {
|
if (Frameworks.HaveCoreMedia) {
|
||||||
CMAudioFormatDescription = Lookup (platform_assembly, "CoreMedia", "CMAudioFormatDescription");
|
CMAudioFormatDescription = ConditionalLookup (platformAssembly, "CoreMedia", "CMAudioFormatDescription");
|
||||||
CMClock = Lookup (platform_assembly, "CoreMedia", "CMClock");
|
CMClock = ConditionalLookup (platformAssembly, "CoreMedia", "CMClock");
|
||||||
CMFormatDescription = Lookup (platform_assembly, "CoreMedia", "CMFormatDescription");
|
CMFormatDescription = ConditionalLookup (platformAssembly, "CoreMedia", "CMFormatDescription");
|
||||||
CMSampleBuffer = Lookup (platform_assembly, "CoreMedia", "CMSampleBuffer");
|
CMSampleBuffer = ConditionalLookup (platformAssembly, "CoreMedia", "CMSampleBuffer");
|
||||||
CMTime = Lookup (platform_assembly, "CoreMedia", "CMTime");
|
CMTime = ConditionalLookup (platformAssembly, "CoreMedia", "CMTime");
|
||||||
CMTimebase = Lookup (platform_assembly, "CoreMedia", "CMTimebase");
|
CMTimebase = ConditionalLookup (platformAssembly, "CoreMedia", "CMTimebase");
|
||||||
CMTimeMapping = Lookup (platform_assembly, "CoreMedia", "CMTimeMapping");
|
CMTimeMapping = ConditionalLookup (platformAssembly, "CoreMedia", "CMTimeMapping");
|
||||||
CMTimeRange = Lookup (platform_assembly, "CoreMedia", "CMTimeRange");
|
CMTimeRange = ConditionalLookup (platformAssembly, "CoreMedia", "CMTimeRange");
|
||||||
CMVideoFormatDescription = Lookup (platform_assembly, "CoreMedia", "CMVideoFormatDescription");
|
CMVideoFormatDescription = ConditionalLookup (platformAssembly, "CoreMedia", "CMVideoFormatDescription");
|
||||||
CMVideoDimensions = Lookup (platform_assembly, "CoreMedia", "CMVideoDimensions");
|
CMVideoDimensions = ConditionalLookup (platformAssembly, "CoreMedia", "CMVideoDimensions");
|
||||||
}
|
}
|
||||||
if (Frameworks.HaveCoreVideo) {
|
if (Frameworks.HaveCoreVideo) {
|
||||||
CVImageBuffer = Lookup (platform_assembly, "CoreVideo", "CVImageBuffer");
|
CVImageBuffer = ConditionalLookup (platformAssembly, "CoreVideo", "CVImageBuffer");
|
||||||
CVPixelBuffer = Lookup (platform_assembly, "CoreVideo", "CVPixelBuffer");
|
CVPixelBuffer = ConditionalLookup (platformAssembly, "CoreVideo", "CVPixelBuffer");
|
||||||
CVPixelBufferPool = Lookup (platform_assembly, "CoreVideo", "CVPixelBufferPool");
|
CVPixelBufferPool = ConditionalLookup (platformAssembly, "CoreVideo", "CVPixelBufferPool");
|
||||||
}
|
}
|
||||||
DispatchQueue = Lookup (platform_assembly, "CoreFoundation", "DispatchQueue");
|
|
||||||
DispatchData = Lookup (platform_assembly, "CoreFoundation", "DispatchData");
|
|
||||||
if (Frameworks.HaveCoreMidi)
|
if (Frameworks.HaveCoreMidi)
|
||||||
MidiEndpoint = Lookup (platform_assembly, "CoreMidi", "MidiEndpoint");
|
MidiEndpoint = ConditionalLookup (platformAssembly, "CoreMidi", "MidiEndpoint");
|
||||||
if (Frameworks.HaveMapKit)
|
if (Frameworks.HaveMapKit)
|
||||||
MKCoordinateSpan = Lookup (platform_assembly, "MapKit", "MKCoordinateSpan", true /* isn't in XM/Classic */);
|
MKCoordinateSpan = ConditionalLookup (platformAssembly, "MapKit", "MKCoordinateSpan", true /* isn't in XM/Classic */);
|
||||||
if (Frameworks.HaveMediaToolbox)
|
if (Frameworks.HaveMediaToolbox)
|
||||||
MTAudioProcessingTap = Lookup (platform_assembly, "MediaToolbox", "MTAudioProcessingTap");
|
MTAudioProcessingTap = ConditionalLookup (platformAssembly, "MediaToolbox", "MTAudioProcessingTap");
|
||||||
NSNumber = Lookup (binding_touch.BindThirdPartyLibrary ? platform_assembly : api_assembly, "Foundation", "NSNumber");
|
|
||||||
NSRange = Lookup (platform_assembly, "Foundation", "NSRange");
|
|
||||||
NSString = Lookup (platform_assembly, "Foundation", "NSString");
|
|
||||||
NSValue = Lookup (binding_touch.BindThirdPartyLibrary ? platform_assembly : api_assembly, "Foundation", "NSValue");
|
|
||||||
NSZone = Lookup (platform_assembly, "Foundation", "NSZone");
|
|
||||||
SCNVector3 = Lookup (platform_assembly, "SceneKit", "SCNVector3");
|
|
||||||
SCNVector4 = Lookup (platform_assembly, "SceneKit", "SCNVector4");
|
|
||||||
SCNMatrix4 = Lookup (platform_assembly, "SceneKit", "SCNMatrix4");
|
|
||||||
SecAccessControl = Lookup (platform_assembly, "Security", "SecAccessControl");
|
|
||||||
SecIdentity = Lookup (platform_assembly, "Security", "SecIdentity");
|
|
||||||
SecTrust = Lookup (platform_assembly, "Security", "SecTrust");
|
|
||||||
SecProtocolOptions = Lookup (platform_assembly, "Security", "SecProtocolOptions");
|
|
||||||
SecProtocolMetadata = Lookup (platform_assembly, "Security", "SecProtocolMetadata");
|
|
||||||
SecTrust2 = Lookup (platform_assembly, "Security", "SecTrust2");
|
|
||||||
SecIdentity2 = Lookup (platform_assembly, "Security", "SecIdentity2");
|
|
||||||
if (Frameworks.HaveUIKit) {
|
if (Frameworks.HaveUIKit) {
|
||||||
UIOffset = Lookup (platform_assembly, "UIKit", "UIOffset");
|
UIOffset = ConditionalLookup (platformAssembly, "UIKit", "UIOffset");
|
||||||
UIEdgeInsets = Lookup (platform_assembly, "UIKit", "UIEdgeInsets");
|
UIEdgeInsets = ConditionalLookup (platformAssembly, "UIKit", "UIEdgeInsets");
|
||||||
NSDirectionalEdgeInsets = Lookup (platform_assembly, "UIKit", "NSDirectionalEdgeInsets");
|
NSDirectionalEdgeInsets = ConditionalLookup (platformAssembly, "UIKit", "NSDirectionalEdgeInsets");
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreGraphics_CGRect = Lookup (platform_assembly, "CoreGraphics", "CGRect");
|
|
||||||
CoreGraphics_CGPoint = Lookup (platform_assembly, "CoreGraphics", "CGPoint");
|
|
||||||
CoreGraphics_CGSize = Lookup (platform_assembly, "CoreGraphics", "CGSize");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,7 @@
|
||||||
<Compile Include="..\src\bgen\StringExtensions.cs" />
|
<Compile Include="..\src\bgen\StringExtensions.cs" />
|
||||||
<Compile Include="..\src\bgen\ThreadCheck.cs" />
|
<Compile Include="..\src\bgen\ThreadCheck.cs" />
|
||||||
<Compile Include="..\src\bgen\TrampolineInfo.cs" />
|
<Compile Include="..\src\bgen\TrampolineInfo.cs" />
|
||||||
|
<Compile Include="..\src\bgen\TypeExtensions.cs" />
|
||||||
<Compile Include="..\src\bgen\TypeManager.cs" />
|
<Compile Include="..\src\bgen\TypeManager.cs" />
|
||||||
<Compile Include="..\src\bgen\WrapPropMemberInformation.cs" />
|
<Compile Include="..\src\bgen\WrapPropMemberInformation.cs" />
|
||||||
<Compile Include="..\tools\common\ApplePlatform.cs" />
|
<Compile Include="..\tools\common\ApplePlatform.cs" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче