[.NET] Move the nfloat type to the ObjCRuntime namespace for .NET. (#13092)
Also move the NMath type from the System namespace to the ObjCRuntime namespace. Ref: https://github.com/xamarin/xamarin-macios/issues/13087
This commit is contained in:
Родитель
8f1e650bea
Коммит
02431b9fc8
|
@ -0,0 +1,21 @@
|
|||
# Breaking changes in .NET
|
||||
|
||||
## System.nfloat moved to ObjCRuntime.nfloat
|
||||
|
||||
The `nfloat` type moved from the `System` namespace to the `ObjCRuntime` namespace.
|
||||
|
||||
* Code that references the `nfloat` type might not compile unless the `ObjCRuntime` namespace is imported.
|
||||
|
||||
Fix: add `using ObjCRuntime` to the file in question.
|
||||
|
||||
* Code that references the full typename, `System.nfloat` won't compile.
|
||||
|
||||
Fix: use `ObjCRuntime.nfloat` instead.
|
||||
|
||||
## System.NMath moved to ObjCRuntime.NMath
|
||||
|
||||
The `NMath` type moved from the `System` namespace to the `ObjCRuntime` namespace.
|
||||
|
||||
* Code that uses the `NMath` type won't compile unless the `ObjCRuntime` namespace is imported.
|
||||
|
||||
Fix: add `using ObjCRuntime` to the file in question.
|
|
@ -1 +1 @@
|
|||
Subproject commit 8e60f82a1ab0fba5e798624edd488736870bb0d7
|
||||
Subproject commit 5a05c6912ef3828271557d9daaaec172c5fb45c2
|
|
@ -1 +1 @@
|
|||
Subproject commit 3345db2f4e6408fdf2e8f099251c5c1310b56937
|
||||
Subproject commit cbda70358360329854ea399100a2b5b04ae43982
|
|
@ -1513,7 +1513,11 @@ xamarin_get_nsnumber_converter (MonoClass *managedType, MonoMethod *method, bool
|
|||
func = to_managed ? (void *) xamarin_nsnumber_to_nint : (void *) xamarin_nint_to_nsnumber;
|
||||
} else if (!strcmp (fullname, "System.nuint")) {
|
||||
func = to_managed ? (void *) xamarin_nsnumber_to_nuint : (void *) xamarin_nuint_to_nsnumber;
|
||||
#if DOTNET
|
||||
} else if (!strcmp (fullname, "ObjCRuntime.nfloat")) {
|
||||
#else
|
||||
} else if (!strcmp (fullname, "System.nfloat")) {
|
||||
#endif
|
||||
func = to_managed ? (void *) xamarin_nsnumber_to_nfloat : (void *) xamarin_nfloat_to_nsnumber;
|
||||
} else if (mono_class_is_enum (managedType)) {
|
||||
MonoType *baseType = mono_class_enum_basetype (managedType);
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
//
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace AppKit {
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
public struct NSEdgeInsets {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#if !__MACCATALYST__
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace AppKit {
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#if MONOMAC
|
||||
|
||||
using System;
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace Foundation
|
||||
{
|
||||
|
|
|
@ -7,9 +7,14 @@
|
|||
// Copyright 2014 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
#if NET
|
||||
namespace ObjCRuntime
|
||||
#else
|
||||
namespace System
|
||||
#endif
|
||||
{
|
||||
public static class NMath
|
||||
{
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
// Copyright 2013 Xamarin, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#if NET
|
||||
#define OBJCRUNTIME_nfloat
|
||||
#endif
|
||||
|
||||
<#@ template language="C#v3.5" #>
|
||||
<#@ import namespace="System" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
|
@ -32,8 +36,8 @@ using System.Diagnostics;
|
|||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System
|
||||
{
|
||||
using ObjCRuntime;
|
||||
|
||||
<#
|
||||
foreach (var type in new [] {
|
||||
new { NSName = "nint", CilName32 = "Int32", CilName64 = "Int64", IsIntegerType = true },
|
||||
|
@ -56,6 +60,12 @@ namespace System
|
|||
binops.Add ("^");
|
||||
}
|
||||
#>
|
||||
#if OBJCRUNTIME_<#= type.NSName #>
|
||||
namespace ObjCRuntime
|
||||
#else
|
||||
namespace System
|
||||
#endif
|
||||
{
|
||||
[Serializable]
|
||||
[DebuggerDisplay ("{v,nq}")]
|
||||
public unsafe struct <#= type.NSName #> : IFormattable, IConvertible, IComparable, IComparable<<#= type.NSName #>>, IEquatable <<#= type.NSName #>>
|
||||
|
@ -429,5 +439,5 @@ namespace System
|
|||
Marshal.WriteIntPtr (destination, i * <#= type.NSName #>.Size, (IntPtr)source [i + startIndex]);
|
||||
}
|
||||
}
|
||||
<# } #>
|
||||
}
|
||||
<# } #>
|
||||
|
|
|
@ -88,6 +88,14 @@ namespace Registrar {
|
|||
public Application App { get; protected set; }
|
||||
#endif
|
||||
|
||||
#if MMP || MTOUCH || BUNDLER
|
||||
static string NFloatTypeName { get => Driver.IsDotNet ? "ObjCRuntime.nfloat" : "System.nfloat"; }
|
||||
#elif NET
|
||||
const string NFloatTypeName = "ObjCRuntime.nfloat";
|
||||
#else
|
||||
const string NFloatTypeName = "System.nfloat";
|
||||
#endif
|
||||
|
||||
Dictionary<TAssembly, object> assemblies = new Dictionary<TAssembly, object> (); // Use Dictionary instead of HashSet to avoid pulling in System.Core.dll.
|
||||
// locking: all accesses must lock 'types'.
|
||||
Dictionary<TType, ObjCType> types = new Dictionary<TType, ObjCType> ();
|
||||
|
@ -715,10 +723,11 @@ namespace Registrar {
|
|||
case "System.nuint":
|
||||
case "System.Single":
|
||||
case "System.Double":
|
||||
case "System.nfloat":
|
||||
case "System.Boolean":
|
||||
return true;
|
||||
default:
|
||||
if (outputTypeName == NFloatTypeName)
|
||||
return true;
|
||||
return Registrar.IsEnum (underlyingOutputType);
|
||||
}
|
||||
} else if (Registrar.Is (underlyingInputType, Foundation, "NSValue")) {
|
||||
|
@ -2641,12 +2650,13 @@ namespace Registrar {
|
|||
return Is64Bits ? "q" : "i";
|
||||
case "System.nuint":
|
||||
return Is64Bits ? "Q" : "I";
|
||||
case "System.nfloat":
|
||||
return Is64Bits ? "d" : "f";
|
||||
case "System.DateTime":
|
||||
throw CreateException (4102, member, Errors.MT4102, "System.DateTime", "Foundation.NSDate", member.FullName);
|
||||
}
|
||||
|
||||
if (typeFullName == NFloatTypeName)
|
||||
return Is64Bits ? "d" : "f";
|
||||
|
||||
if (Is (type, ObjCRuntime, "Selector"))
|
||||
return ":";
|
||||
|
||||
|
|
|
@ -226,6 +226,13 @@ namespace ObjCRuntime
|
|||
if (type.IsNested)
|
||||
return false;
|
||||
|
||||
#if NET
|
||||
if (type.Namespace == "ObjCRuntime" && type.Name == "nfloat") {
|
||||
type_size = is_64_bits ? 8 : 4;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (type.Namespace != "System")
|
||||
return false;
|
||||
|
||||
|
@ -251,7 +258,9 @@ namespace ObjCRuntime
|
|||
type_size = 8;
|
||||
return true;
|
||||
case "IntPtr":
|
||||
#if !NET
|
||||
case "nfloat":
|
||||
#endif
|
||||
case "nuint":
|
||||
case "nint":
|
||||
type_size = is_64_bits ? 8 : 4;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#if !XAMCORE_4_0
|
||||
using System;
|
||||
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ We have introduced 6 new types to make this possible:
|
|||
|
||||
In the Classic assembly, the `System.Drawing` types are backed by the 32-bit
|
||||
`System.Single` type. In the Unified assemblies, the `CoreGraphics` types
|
||||
are backed by 32/64-bit `System.nfloat` type.
|
||||
are backed by 32/64-bit `System.nfloat` type (`ObjCRuntime.nfloat` in .NET).
|
||||
|
||||
#### Enums ####
|
||||
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
// Copyright 2012 Xamarin Inc
|
||||
//
|
||||
using System;
|
||||
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
|
@ -36,7 +36,11 @@ using Vector4 = global::OpenTK.Vector4;
|
|||
using Quaternion = global::OpenTK.Quaternion;
|
||||
using Quaterniond = global::OpenTK.Quaterniond;
|
||||
#if MONOMAC
|
||||
#if NET
|
||||
using pfloat = ObjCRuntime.nfloat;
|
||||
#else
|
||||
using pfloat = System.nfloat;
|
||||
#endif
|
||||
#else
|
||||
using pfloat = System.Single;
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,7 @@ using System.Collections.Generic;
|
|||
using CoreAnimation;
|
||||
#endif
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
|
@ -31,7 +31,11 @@ using Quaternion = global::OpenTK.Quaternion;
|
|||
using MathHelper = global::OpenTK.MathHelper;
|
||||
|
||||
#if MONOMAC
|
||||
#if NET
|
||||
using pfloat = ObjCRuntime.nfloat;
|
||||
#else
|
||||
using pfloat = System.nfloat;
|
||||
#endif
|
||||
#else
|
||||
using pfloat = System.Single;
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,11 @@ using Vector2 = global::OpenTK.Vector2;
|
|||
using Vector3 = global::OpenTK.Vector3;
|
||||
using MathHelper = global::OpenTK.MathHelper;
|
||||
#if MONOMAC
|
||||
#if NET
|
||||
using pfloat = ObjCRuntime.nfloat;
|
||||
#else
|
||||
using pfloat = System.nfloat;
|
||||
#endif
|
||||
#else
|
||||
using pfloat = System.Single;
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,11 @@ using Vector4 = global::OpenTK.Vector4;
|
|||
using Quaternion = global::OpenTK.Quaternion;
|
||||
using MathHelper = global::OpenTK.MathHelper;
|
||||
#if MONOMAC
|
||||
#if NET
|
||||
using pfloat = ObjCRuntime.nfloat;
|
||||
#else
|
||||
using pfloat = System.nfloat;
|
||||
#endif
|
||||
#else
|
||||
using pfloat = System.Single;
|
||||
#endif
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
using System;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace UIKit {
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace UIKit {
|
|||
[UnsupportedOSPlatform ("ios7.0")]
|
||||
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
|
||||
#endif
|
||||
public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, UILineBreakMode breakMode)
|
||||
public static CGSize DrawString (this string This, CGPoint point, nfloat width, UIFont font, UILineBreakMode breakMode)
|
||||
{
|
||||
using (var self = ((NSString) This))
|
||||
return self.DrawString (point, width, font, breakMode);
|
||||
|
@ -40,7 +40,7 @@ namespace UIKit {
|
|||
[UnsupportedOSPlatform ("ios7.0")]
|
||||
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
|
||||
#endif
|
||||
public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, global::System.nfloat fontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment)
|
||||
public static CGSize DrawString (this string This, CGPoint point, nfloat width, UIFont font, nfloat fontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment)
|
||||
{
|
||||
using (var self = ((NSString) This))
|
||||
return self.DrawString (point, width, font, fontSize, breakMode, adjustment);
|
||||
|
@ -52,7 +52,7 @@ namespace UIKit {
|
|||
[UnsupportedOSPlatform ("ios7.0")]
|
||||
[Obsolete ("Starting with ios7.0 use NSString.DrawString(CGRect, UIStringAttributes) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
|
||||
#endif
|
||||
public static CGSize DrawString (this string This, CGPoint point, global::System.nfloat width, UIFont font, global::System.nfloat minFontSize, ref global::System.nfloat actualFontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment)
|
||||
public static CGSize DrawString (this string This, CGPoint point, nfloat width, UIFont font, nfloat minFontSize, ref nfloat actualFontSize, UILineBreakMode breakMode, UIBaselineAdjustment adjustment)
|
||||
{
|
||||
using (var self = ((NSString) This))
|
||||
return self.DrawString (point, width, font, minFontSize, ref actualFontSize, breakMode, adjustment);
|
||||
|
@ -112,7 +112,7 @@ namespace UIKit {
|
|||
[UnsupportedOSPlatform ("ios7.0")]
|
||||
[Obsolete ("Starting with ios7.0 use NSString.GetBoundingRect (CGSize, NSStringDrawingOptions, UIStringAttributes, NSStringDrawingContext) instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")]
|
||||
#endif
|
||||
public static CGSize StringSize (this string This, UIFont font, global::System.nfloat forWidth, UILineBreakMode breakMode)
|
||||
public static CGSize StringSize (this string This, UIFont font, nfloat forWidth, UILineBreakMode breakMode)
|
||||
{
|
||||
using (var self = ((NSString) This))
|
||||
return self.StringSize (font, forWidth, breakMode);
|
||||
|
@ -147,7 +147,7 @@ namespace UIKit {
|
|||
#else
|
||||
[UnsupportedOSPlatform ("ios7.0")]
|
||||
#endif
|
||||
public static CGSize StringSize (this string This, UIFont font, global::System.nfloat minFontSize, ref global::System.nfloat actualFontSize, global::System.nfloat forWidth, UILineBreakMode lineBreakMode)
|
||||
public static CGSize StringSize (this string This, UIFont font, nfloat minFontSize, ref nfloat actualFontSize, nfloat forWidth, UILineBreakMode lineBreakMode)
|
||||
{
|
||||
using (var self = ((NSString) This))
|
||||
return self.StringSize (font, minFontSize, ref actualFontSize, forWidth, lineBreakMode);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
using System;
|
||||
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
|
|
@ -191,7 +191,11 @@ public class TypeManager {
|
|||
|
||||
System_nint = Lookup (platform_assembly, "System", "nint");
|
||||
System_nuint = Lookup (platform_assembly, "System", "nuint");
|
||||
#if NET
|
||||
System_nfloat = Lookup (platform_assembly, "ObjCRuntime", "nfloat");
|
||||
#else
|
||||
System_nfloat = Lookup (platform_assembly, "System", "nfloat");
|
||||
#endif
|
||||
|
||||
/* fundamental */
|
||||
NSObject = Lookup (platform_assembly, "Foundation", "NSObject");
|
||||
|
|
|
@ -43,7 +43,11 @@ using Quaternion = global::OpenTK.Quaternion;
|
|||
using MathHelper = global::OpenTK.MathHelper;
|
||||
|
||||
#if MONOMAC
|
||||
#if NET
|
||||
using pfloat = ObjCRuntime.nfloat;
|
||||
#else
|
||||
using pfloat = System.nfloat;
|
||||
#endif
|
||||
using AppKit;
|
||||
#else
|
||||
using OpenGLES;
|
||||
|
|
|
@ -42,7 +42,11 @@ using AppKit;
|
|||
using UIColor = global::AppKit.NSColor;
|
||||
using UIImage = global::AppKit.NSImage;
|
||||
using UIView = global::AppKit.NSView;
|
||||
#if NET
|
||||
using pfloat = ObjCRuntime.nfloat;
|
||||
#else
|
||||
using pfloat = System.nfloat;
|
||||
#endif
|
||||
#else
|
||||
using UIKit;
|
||||
using NSLineBreakMode = global::UIKit.UILineBreakMode;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using Xamarin;
|
||||
using Xamarin.Tests;
|
||||
using Xamarin.Utils;
|
||||
|
||||
namespace GeneratorTests
|
||||
{
|
||||
|
@ -18,7 +21,20 @@ namespace GeneratorTests
|
|||
var bgen = new BGenTool ();
|
||||
bgen.CreateTemporaryBinding ("");
|
||||
bgen.ResponseFile = Path.Combine (Cache.CreateTemporaryDirectory (), "rspfile");
|
||||
File.WriteAllLines (bgen.ResponseFile, new string [] { "--target-framework:Xamarin.iOS,v1.0" });
|
||||
|
||||
var arguments = new List<string> ();
|
||||
#if NET
|
||||
var targetFramework = TargetFramework.DotNet_6_0_iOS_String;
|
||||
var tf = TargetFramework.Parse (targetFramework);
|
||||
arguments.Add ($"--baselib={Configuration.GetBaseLibrary (tf)}");
|
||||
arguments.Add ($"--attributelib={Configuration.GetBindingAttributePath (tf)}");
|
||||
arguments.AddRange (Directory.GetFiles (Configuration.DotNet6BclDir, "*.dll").Select (v => $"-r:{v}"));
|
||||
#else
|
||||
var targetFramework = "Xamarin.iOS,v1.0";
|
||||
#endif
|
||||
arguments.Add ($"--target-framework={targetFramework}");
|
||||
|
||||
File.WriteAllLines (bgen.ResponseFile, arguments.ToArray ());
|
||||
bgen.AssertExecute ("response file");
|
||||
bgen.AssertNoWarnings ();
|
||||
}
|
||||
|
|
|
@ -33,7 +33,11 @@ using ObjCRuntime;
|
|||
namespace Introspection {
|
||||
|
||||
public abstract class ApiSignatureTest : ApiBaseTest {
|
||||
|
||||
#if NET
|
||||
const string NFloatTypeName = "ObjCRuntime.nfloat";
|
||||
#else
|
||||
const string NFloatTypeName = "System.nfloat";
|
||||
#endif
|
||||
[DllImport ("/usr/lib/libobjc.dylib")]
|
||||
// note: the returned string is not ours to free
|
||||
static extern IntPtr objc_getClass (string name);
|
||||
|
@ -662,7 +666,7 @@ namespace Introspection {
|
|||
switch (type.FullName) {
|
||||
case "System.Double":
|
||||
return true;
|
||||
case "System.nfloat":
|
||||
case NFloatTypeName:
|
||||
return IntPtr.Size == 8;
|
||||
default:
|
||||
return false;
|
||||
|
@ -671,7 +675,7 @@ namespace Introspection {
|
|||
switch (type.FullName) {
|
||||
case "System.Single":
|
||||
return true;
|
||||
case "System.nfloat":
|
||||
case NFloatTypeName:
|
||||
return IntPtr.Size == 4;
|
||||
default:
|
||||
return false;
|
||||
|
|
|
@ -20,6 +20,7 @@ using AppKit;
|
|||
using UIKit;
|
||||
#endif
|
||||
using AVFoundation;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.AVFoundation {
|
||||
|
|
|
@ -5,6 +5,7 @@ using NUnit.Framework;
|
|||
|
||||
using AppKit;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace Xamarin.Mac.Tests
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.Drawing;
|
|||
using System.Runtime.InteropServices;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ using AppKit;
|
|||
using UIKit;
|
||||
#endif
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreGraphics {
|
||||
|
|
|
@ -11,6 +11,7 @@ using System;
|
|||
using System.Drawing;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreGraphics {
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.Drawing;
|
|||
using Foundation;
|
||||
using CoreGraphics;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreGraphics {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
using System;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreGraphics {
|
||||
|
|
|
@ -12,6 +12,7 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreGraphics {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
using System;
|
||||
using Foundation;
|
||||
using CoreGraphics;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreGraphics {
|
||||
|
|
|
@ -13,6 +13,7 @@ using System;
|
|||
|
||||
using Foundation;
|
||||
using CoreImage;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.CoreImage {
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.Linq;
|
|||
|
||||
using Foundation;
|
||||
using CoreText;
|
||||
using ObjCRuntime;
|
||||
|
||||
namespace MonoTouchFixtures.CoreText {
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ using AppKit;
|
|||
#else
|
||||
using UIKit;
|
||||
#endif
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Drawing;
|
|||
#endif
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.UIKit {
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.Drawing;
|
|||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.UIKit {
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Drawing;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.UIKit {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
using System;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.UIKit {
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Drawing;
|
|||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.UIKit {
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Drawing;
|
|||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using ObjCRuntime;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.UIKit {
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace Xharness.Jenkins {
|
|||
TestProject = buildDotNetTestsProject,
|
||||
Platform = TestPlatform.All,
|
||||
TestName = "DotNet tests",
|
||||
Timeout = TimeSpan.FromMinutes (90),
|
||||
Timeout = TimeSpan.FromMinutes (120),
|
||||
Ignored = !IncludeDotNet,
|
||||
};
|
||||
Tasks.Add (runDotNetTests);
|
||||
|
|
|
@ -213,6 +213,8 @@ namespace Registrar {
|
|||
|
||||
class StaticRegistrar : Registrar
|
||||
{
|
||||
static string NFloatTypeName { get => Driver.IsDotNet ? "ObjCRuntime.nfloat" : "System.nfloat"; }
|
||||
|
||||
Dictionary<ICustomAttribute, MethodDefinition> protocol_member_method_map;
|
||||
|
||||
public Dictionary<ICustomAttribute, MethodDefinition> ProtocolMemberMethodMap {
|
||||
|
@ -730,10 +732,11 @@ namespace Registrar {
|
|||
case "System.Int64":
|
||||
case "System.UInt64": return 8;
|
||||
case "System.IntPtr":
|
||||
case "System.nfloat":
|
||||
case "System.nuint":
|
||||
case "System.nint": return is_64_bits ? 8 : 4;
|
||||
default:
|
||||
if (type.FullName == NFloatTypeName)
|
||||
return is_64_bits ? 8 : 4;
|
||||
int size = 0;
|
||||
foreach (FieldDefinition field in type.Fields) {
|
||||
if (field.IsStatic)
|
||||
|
@ -2449,14 +2452,15 @@ namespace Registrar {
|
|||
case "System.nuint":
|
||||
CheckNamespace ("Foundation", exceptions);
|
||||
return "NSUInteger";
|
||||
case "System.nfloat":
|
||||
CheckNamespace ("CoreGraphics", exceptions);
|
||||
return "CGFloat";
|
||||
case "System.DateTime":
|
||||
throw ErrorHelper.CreateError (4102, Errors.MT4102, "System.DateTime", "Foundation.NSDate", descriptiveMethodName);
|
||||
case "ObjCRuntime.Selector": return "SEL";
|
||||
case "ObjCRuntime.Class": return "Class";
|
||||
default:
|
||||
if (type.FullName == NFloatTypeName) {
|
||||
CheckNamespace ("CoreGraphics", exceptions);
|
||||
return "CGFloat";
|
||||
}
|
||||
TypeDefinition td = ResolveType (type);
|
||||
if (IsNSObject (td)) {
|
||||
if (!IsPlatformType (td))
|
||||
|
@ -2510,10 +2514,11 @@ namespace Registrar {
|
|||
case "System.UInt64": return "llu";
|
||||
case "System.nint": return "zd";
|
||||
case "System.nuint": return "tu";
|
||||
case "System.nfloat":
|
||||
case "System.Single":
|
||||
case "System.Double": return "f";
|
||||
default:
|
||||
if (type.FullName == NFloatTypeName)
|
||||
return "f";
|
||||
unknown = true;
|
||||
return "p";
|
||||
}
|
||||
|
@ -4397,9 +4402,10 @@ namespace Registrar {
|
|||
case "System.nuint": return "xamarin_nuint_to_nsnumber";
|
||||
case "System.Single": return "xamarin_float_to_nsnumber";
|
||||
case "System.Double": return "xamarin_double_to_nsnumber";
|
||||
case "System.nfloat": return "xamarin_nfloat_to_nsnumber";
|
||||
case "System.Boolean": return "xamarin_bool_to_nsnumber";
|
||||
default:
|
||||
if (typeName == NFloatTypeName)
|
||||
return "xamarin_nfloat_to_nsnumber";
|
||||
if (IsEnum (managedType))
|
||||
return GetManagedToNSNumberFunc (GetEnumUnderlyingType (managedType), inputType, outputType, descriptiveMethodName);
|
||||
throw ErrorHelper.CreateError (99, Errors.MX0099, $"can't convert from '{inputType.FullName}' to '{outputType.FullName}' in {descriptiveMethodName}");
|
||||
|
@ -4422,9 +4428,12 @@ namespace Registrar {
|
|||
case "System.nuint": nativeType = "NSUInteger"; return "xamarin_nsnumber_to_nuint";
|
||||
case "System.Single": nativeType = "float"; return "xamarin_nsnumber_to_float";
|
||||
case "System.Double": nativeType = "double"; return "xamarin_nsnumber_to_double";
|
||||
case "System.nfloat": nativeType = "CGFloat"; return "xamarin_nsnumber_to_nfloat";
|
||||
case "System.Boolean": nativeType = "BOOL"; return "xamarin_nsnumber_to_bool";
|
||||
default:
|
||||
if (typeName == NFloatTypeName) {
|
||||
nativeType = "CGFloat";
|
||||
return "xamarin_nsnumber_to_nfloat";
|
||||
}
|
||||
if (IsEnum (managedType))
|
||||
return GetNSNumberToManagedFunc (GetEnumUnderlyingType (managedType), inputType, outputType, descriptiveMethodName, out nativeType);
|
||||
throw ErrorHelper.CreateError (99, Errors.MX0099, $"can't convert from '{inputType.FullName}' to '{outputType.FullName}' in {descriptiveMethodName}");
|
||||
|
|
Загрузка…
Ссылка в новой задаче