From 6f19d734b7003dd2317b7c68e357ee6425be737b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 24 Jul 2019 09:01:40 -0700 Subject: [PATCH] [generator] Remove support for Classic bindings. Partial fix for #6300. (#6643) Partial fix for https://github.com/xamarin/xamarin-macios/issues/6300. --- src/Makefile.generator | 6 - src/ObjCRuntime/Stret.cs | 12 -- src/bmac | 68 ------- src/btouch.cs | 54 +----- src/generator-attribute-manager.cs | 14 +- src/generator-typemanager.cs | 33 +--- src/generator.cs | 295 +++++++++-------------------- 7 files changed, 100 insertions(+), 382 deletions(-) delete mode 100755 src/bmac diff --git a/src/Makefile.generator b/src/Makefile.generator index 9edb3a07dd..21f9e12909 100644 --- a/src/Makefile.generator +++ b/src/Makefile.generator @@ -28,7 +28,6 @@ IOS_TARGETS_DIRS += \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen \ IOS_TARGETS += \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/monotouch.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.iOS.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/bgen.exe \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/bin/bgen \ @@ -61,10 +60,6 @@ $(IOS_BUILD_DIR)/native/Xamarin.iOS.BindingAttributes.dll: generator-attributes. $(Q) mkdir -p $(dir $@) $(Q_GEN) $(SYSTEM_CSC) -nologo -out:$@ -debug generator-attributes.cs -target:library -deterministic -$(IOS_BUILD_DIR)/native/monotouch.BindingAttributes.dll: generator-attributes.cs Makefile.generator - $(Q) mkdir -p $(dir $@) - $(Q_GEN) $(SYSTEM_CSC) -nologo -debug -out:$@ -debug generator-attributes.cs -target:library -deterministic - # # Xamarin.Watch (bwatch) # @@ -166,7 +161,6 @@ bgen: \ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/bgen.exe \ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-full.BindingAttributes.dll \ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/bgen/Xamarin.Mac-mobile.BindingAttributes.dll \ - $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/monotouch.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.iOS.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.TVOS.BindingAttributes.dll \ $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/bgen/Xamarin.WatchOS.BindingAttributes.dll \ diff --git a/src/ObjCRuntime/Stret.cs b/src/ObjCRuntime/Stret.cs index 3c312622ce..51a45d6d86 100644 --- a/src/ObjCRuntime/Stret.cs +++ b/src/ObjCRuntime/Stret.cs @@ -92,12 +92,6 @@ namespace ObjCRuntime case "nint": case "nuint": case "nfloat": -#if BGENERATOR - var isUnified = generator.UnifiedAPI; -#endif - if (!isUnified) - return false; - if (t.Namespace != "System") return false; #if BGENERATOR @@ -208,12 +202,6 @@ namespace ObjCRuntime public static bool X86_64NeedStret (Type returnType, Generator generator) { -#if BGENERATOR - var isUnified = generator.UnifiedAPI; -#endif - if (!isUnified) - return false; - Type t = returnType; if (!t.IsValueType || t.IsEnum || IsMagicTypeOrCorlibType (t, generator)) diff --git a/src/bmac b/src/bmac deleted file mode 100755 index 56352317cb..0000000000 --- a/src/bmac +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -sdk= -bmac= -new_style= -refs= -full_profile= -mobile_profile= -mono=/Library/Frameworks/Mono.framework/Versions/Current/bin/mono - -BMAC_DIR=`dirname $0` -if [ `basename $BMAC_DIR` == "Commands" ]; then -BMAC_DIR="`dirname $BMAC_DIR`/Versions/Current/bin" -fi - -ROOT_DIR=$BMAC_DIR/.. - -btouch_arguments=() -for arg in "$@"; do - if [[ $sdk == next-arg ]]; then - sdk=$arg - elif [[ $arg =~ ^(/|-{1,2})sdk ]]; then - sdk=${arg#*=}; sdk=${sdk#*:} - if [[ $sdk == $arg ]]; then - sdk=next-arg - fi - elif [[ $arg =~ ^(/|-{1,2})new-style$ ]]; then - new_style=1 - mobile_profile=1 - continue - elif [[ $arg =~ ^(/|-{1,2})unified-full-profile$ ]]; then - full_profile=1 - new_style=1 - elif [[ $arg =~ ^(/|-{1,2})unified-mobile-profile$ ]]; then - mobile_profile=1 - new_style=1 - fi - btouch_arguments+=("${arg}") -done - -sdk=$(echo $sdk | tr '[:upper:]' '[:lower:]') - -case $sdk in -mobile|xamarin.mac|xammac) - bmac="bmac-mobile.exe -no-mono-path" - mono=/Library/Frameworks/Mono.framework/Commands/mono - export MONO_PATH=$ROOT_DIR/lib/mono/Xamarin.Mac - ;; -*) - if [[ -z "$new_style" ]]; then - bmac=bmac-compat.exe - refs="-r:/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/System.Drawing.dll -baselib:$ROOT_DIR/lib/mono/XamMac.dll --target-framework=XamMac,v1.0" - export MONO_PATH=$ROOT_DIR/lib/mono - else - if [[ "$full_profile" -eq 1 ]]; then - refs="-baselib:$ROOT_DIR/lib/reference/full/Xamarin.Mac.dll --target-framework=Xamarin.Mac,Version=v4.5,Profile=Full" - bmac=bmac-full.exe - export MONO_PATH=$ROOT_DIR/lib/reference/full - elif [[ "$mobile_profile" -eq 1 ]]; then - refs="-baselib:$ROOT_DIR/lib/reference/mobile/Xamarin.Mac.dll --target-framework=Xamarin.Mac,Version=v2.0,Profile=Mobile" - bmac=bmac-mobile.exe - export MONO_PATH=$ROOT_DIR/lib/mono/Xamarin.Mac - fi - fi - ;; -esac - -$mono $MONO_OPTIONS $ROOT_DIR/lib/bmac/$bmac $refs "${btouch_arguments[@]}" diff --git a/src/btouch.cs b/src/btouch.cs index 6e0724a739..bdb6bc0b26 100644 --- a/src/btouch.cs +++ b/src/btouch.cs @@ -42,7 +42,6 @@ public class BindingTouch { TargetFramework? target_framework; public PlatformName CurrentPlatform; public bool BindThirdPartyLibrary = true; - public bool Unified; public bool skipSystemDrawing; public string outfile; @@ -89,11 +88,7 @@ public class BindingTouch { switch (CurrentPlatform) { case PlatformName.iOS: - if (Unified) { - return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.iOS.BindingAttributes.dll"); - } else { - return Path.Combine (GetSDKRoot (), "lib", "bgen", "monotouch.BindingAttributes.dll"); - } + return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.iOS.BindingAttributes.dll"); case PlatformName.WatchOS: return Path.Combine (GetSDKRoot (), "lib", "bgen", "Xamarin.WatchOS.BindingAttributes.dll"); case PlatformName.TvOS: @@ -117,7 +112,7 @@ public class BindingTouch { { switch (CurrentPlatform) { case PlatformName.iOS: - yield return Path.Combine (GetSDKRoot (), "lib", "mono", Unified ? "Xamarin.iOS" : "2.1"); + yield return Path.Combine (GetSDKRoot (), "lib", "mono", "Xamarin.iOS"); break; case PlatformName.WatchOS: yield return Path.Combine (GetSDKRoot (), "lib", "mono", "Xamarin.WatchOS"); @@ -195,20 +190,6 @@ public class BindingTouch { throw ErrorHelper.CreateError (70, "Invalid target framework: {0}. Valid target frameworks are: {1}.", target_framework.Value, string.Join (" ", TargetFramework.ValidFrameworks.Select ((v) => v.ToString ()).ToArray ())); } - public string NamespacePlatformPrefix { - get { - switch (CurrentPlatform) { - case PlatformName.MacOSX: - return Unified ? null : "MonoMac"; - case PlatformName.iOS: - return Unified ? null : "MonoTouch"; - default: - return null; - } - - } - } - static int Main2 (string [] args) { var touch = new BindingTouch (); @@ -340,18 +321,8 @@ public class BindingTouch { throw ErrorHelper.CreateError (86, "A target framework (--target-framework) must be specified."); switch (target_framework.Value.Identifier.ToLowerInvariant ()) { - case "monotouch": - CurrentPlatform = PlatformName.iOS; - Unified = false; - if (string.IsNullOrEmpty (baselibdll)) - baselibdll = Path.Combine (GetSDKRoot (), "lib/mono/2.1/monotouch.dll"); - Path.Combine (GetSDKRoot (), "bin/smcs"); - references.Add ("Facades/System.Drawing.Common"); - ReferenceFixer.FixSDKReferences (GetSDKRoot (), "lib/mono/2.1/", references); - break; case "xamarin.ios": CurrentPlatform = PlatformName.iOS; - Unified = true; nostdlib = true; if (string.IsNullOrEmpty (baselibdll)) baselibdll = Path.Combine (GetSDKRoot (), "lib/mono/Xamarin.iOS/Xamarin.iOS.dll"); @@ -360,7 +331,6 @@ public class BindingTouch { break; case "xamarin.tvos": CurrentPlatform = PlatformName.TvOS; - Unified = true; nostdlib = true; if (string.IsNullOrEmpty (baselibdll)) baselibdll = Path.Combine (GetSDKRoot (), "lib/mono/Xamarin.TVOS/Xamarin.TVOS.dll"); @@ -369,24 +339,14 @@ public class BindingTouch { break; case "xamarin.watchos": CurrentPlatform = PlatformName.WatchOS; - Unified = true; nostdlib = true; if (string.IsNullOrEmpty (baselibdll)) baselibdll = Path.Combine (GetSDKRoot (), "lib/mono/Xamarin.WatchOS/Xamarin.WatchOS.dll"); references.Add ("Facades/System.Drawing.Common"); ReferenceFixer.FixSDKReferences (GetSDKRoot (), "lib/mono/Xamarin.WatchOS", references); break; - case "xammac": - CurrentPlatform = PlatformName.MacOSX; - Unified = false; - if (string.IsNullOrEmpty (baselibdll)) - baselibdll = Path.Combine (GetSDKRoot (), "lib", "mono", "XamMac.dll"); - references.Add ("Facades/System.Drawing.Common"); - ReferenceFixer.FixSDKReferences ("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5", references); - break; case "xamarin.mac": CurrentPlatform = PlatformName.MacOSX; - Unified = true; nostdlib = true; if (string.IsNullOrEmpty (baselibdll)) { if (target_framework == TargetFramework.Xamarin_Mac_2_0_Mobile) @@ -555,7 +515,6 @@ public class BindingTouch { var nsManager = new NamespaceManager ( this, - NamespacePlatformPrefix, ns == null ? firstApiDefinitionName : ns, skipSystemDrawing ); @@ -563,16 +522,9 @@ public class BindingTouch { var g = new Generator (this, nsManager, public_mode, external, debug, types.ToArray (), strong_dictionaries.ToArray ()){ BaseDir = basedir != null ? basedir : tmpdir, ZeroCopyStrings = zero_copy, - InlineSelectors = inline_selectors ?? (Unified && CurrentPlatform != PlatformName.MacOSX), + InlineSelectors = inline_selectors ?? (CurrentPlatform != PlatformName.MacOSX), }; - if (!Unified && !BindThirdPartyLibrary) { - foreach (var mi in baselib.GetType (nsManager.CoreObjCRuntime + ".Messaging").GetMethods ()){ - if (mi.Name.IndexOf ("_objc_msgSend", StringComparison.Ordinal) != -1) - g.RegisterMethodName (mi.Name); - } - } - g.Go (); if (generate_file_list != null){ diff --git a/src/generator-attribute-manager.cs b/src/generator-attribute-manager.cs index ecfa0eee03..9befb7bae0 100644 --- a/src/generator-attribute-manager.cs +++ b/src/generator-attribute-manager.cs @@ -41,12 +41,7 @@ public class AttributeManager throw ErrorHelper.CreateError (1061, $"The attribute '{type.FullName}' found on '{Generator.FormatProvider (provider)}' is not a valid binding attribute. Please remove this attribute."); } - var prefix = BindingTouch.NamespacePlatformPrefix; - var n = type.FullName; - if (!string.IsNullOrEmpty (prefix) && type.Namespace.StartsWith (prefix, System.StringComparison.Ordinal)) { - n = n.Substring (prefix.Length + 1); - } - rv = typeof (TypeManager).Assembly.GetType (n); + rv = typeof (TypeManager).Assembly.GetType (type.FullName); } else { throw ErrorHelper.CreateError (1054, "Internal error: can't convert type '{0}' (unknown assembly). Please file a bug report (https://github.com/xamarin/xamarin-macios/issues/new) with a test case.", type.AssemblyQualifiedName); } @@ -72,12 +67,7 @@ public class AttributeManager string fullname; // HACK ?? if (type.Namespace?.StartsWith ("XamCore.", System.StringComparison.Ordinal) == true) { - var prefix = BindingTouch.NamespacePlatformPrefix; - if (!string.IsNullOrEmpty (prefix)) { - fullname = prefix + "." + type.FullName.Substring (8); - } else { - fullname = type.FullName.Substring (8); - } + fullname = type.FullName.Substring (8); } else { fullname = type.FullName; } diff --git a/src/generator-typemanager.cs b/src/generator-typemanager.cs index 3b06781fa0..57f693d589 100644 --- a/src/generator-typemanager.cs +++ b/src/generator-typemanager.cs @@ -137,18 +137,11 @@ public class TypeManager { Type Lookup (Assembly assembly, string @namespace, string @typename, bool inexistentOK = false) { string fullname; - string nsManagerPrefix = null; - - if (assembly == platform_assembly || assembly == api_assembly) - nsManagerPrefix = BindingTouch.NamespacePlatformPrefix; - - if (!string.IsNullOrEmpty (nsManagerPrefix)) - nsManagerPrefix += "."; if (string.IsNullOrEmpty (@namespace)) { - fullname = nsManagerPrefix + @typename; + fullname = @typename; } else { - fullname = nsManagerPrefix + @namespace + "." + @typename; + fullname = @namespace + "." + @typename; } var rv = assembly.GetType (fullname); @@ -215,11 +208,9 @@ public class TypeManager { System_UInt64 = Lookup (corlib_assembly, "System", "UInt64"); System_Void = Lookup (corlib_assembly, "System", "Void"); - if (BindingTouch.Unified) { - System_nint = Lookup (platform_assembly, "System", "nint"); - System_nuint = Lookup (platform_assembly, "System", "nuint"); - System_nfloat = Lookup (platform_assembly, "System", "nfloat"); - } + System_nint = Lookup (platform_assembly, "System", "nint"); + System_nuint = Lookup (platform_assembly, "System", "nuint"); + System_nfloat = Lookup (platform_assembly, "System", "nfloat"); /* fundamental */ NSObject = Lookup (platform_assembly, "Foundation", "NSObject"); @@ -231,11 +222,7 @@ public class TypeManager { Protocol = Lookup (platform_assembly, "ObjCRuntime", "Protocol"); Selector = Lookup (platform_assembly, "ObjCRuntime", "Selector"); - if (BindingTouch.Unified) { - Constants = Lookup (platform_assembly, "ObjCRuntime", "Constants"); - } else { - Constants = Lookup (platform_assembly, "", "Constants"); - } + Constants = Lookup (platform_assembly, "ObjCRuntime", "Constants"); /* Different binding types */ @@ -323,10 +310,8 @@ public class TypeManager { NSDirectionalEdgeInsets = Lookup (platform_assembly, "UIKit", "NSDirectionalEdgeInsets"); } - if (BindingTouch.Unified) { - CoreGraphics_CGRect = Lookup (platform_assembly, "CoreGraphics", "CGRect"); - CoreGraphics_CGPoint = Lookup (platform_assembly, "CoreGraphics", "CGPoint"); - CoreGraphics_CGSize = Lookup (platform_assembly, "CoreGraphics", "CGSize"); - } + CoreGraphics_CGRect = Lookup (platform_assembly, "CoreGraphics", "CGRect"); + CoreGraphics_CGPoint = Lookup (platform_assembly, "CoreGraphics", "CGPoint"); + CoreGraphics_CGSize = Lookup (platform_assembly, "CoreGraphics", "CGSize"); } } diff --git a/src/generator.cs b/src/generator.cs index 695cd38c2d..d86cf03b00 100644 --- a/src/generator.cs +++ b/src/generator.cs @@ -149,24 +149,24 @@ public static class ReflectionExtensions { public static bool IsInternal (this MemberInfo mi, Generator generator) { return generator.AttributeManager.HasAttribute (mi) - || (generator.UnifiedAPI && generator.AttributeManager.HasAttribute (mi)); + || (generator.AttributeManager.HasAttribute (mi)); } public static bool IsUnifiedInternal (this MemberInfo mi, Generator generator) { - return (generator.UnifiedAPI && generator.AttributeManager.HasAttribute (mi)); + return (generator.AttributeManager.HasAttribute (mi)); } public static bool IsInternal (this PropertyInfo pi, Generator generator) { return generator.AttributeManager.HasAttribute (pi) - || (generator.UnifiedAPI && generator.AttributeManager.HasAttribute (pi)); + || (generator.AttributeManager.HasAttribute (pi)); } public static bool IsInternal (this Type type, Generator generator) { return generator.AttributeManager.HasAttribute (type) - || (generator.UnifiedAPI && generator.AttributeManager.HasAttribute (type)); + || (generator.AttributeManager.HasAttribute (type)); } public static List GatherMethods (this Type type, BindingFlags flags, Generator generator) { @@ -478,7 +478,7 @@ public class MemberInformation is_abstract = AttributeManager.HasAttribute (mi) && mi.DeclaringType == type; is_protected = AttributeManager.HasAttribute (mi); is_internal = mi.IsInternal (generator); - is_unified_internal = (Generator.UnifiedAPI && AttributeManager.HasAttribute (mi)); + is_unified_internal = AttributeManager.HasAttribute (mi); is_override = AttributeManager.HasAttribute (mi) || !Generator.MemberBelongsToType (mi.DeclaringType, type); is_new = AttributeManager.HasAttribute (mi); is_sealed = AttributeManager.HasAttribute (mi); @@ -649,11 +649,8 @@ public class NamespaceManager { public BindingTouch BindingTouch; PlatformName CurrentPlatform { get { return BindingTouch.CurrentPlatform; } } - bool UnifiedAPI { get { return BindingTouch.Unified; } } Frameworks Frameworks { get { return BindingTouch.Frameworks; } } - public string Prefix { get; private set; } - // Where the core messaging lives public string CoreObjCRuntime { get; private set; } @@ -667,10 +664,9 @@ public class NamespaceManager public ICollection ImplicitNamespaces { get; private set; } public ICollection NamespacesThatConflictWithTypes { get; private set; } - public NamespaceManager (BindingTouch binding_touch, string prefix, string customObjCRuntimeNS, bool skipSystemDrawing) + public NamespaceManager (BindingTouch binding_touch, string customObjCRuntimeNS, bool skipSystemDrawing) { BindingTouch = binding_touch; - Prefix = prefix; CoreObjCRuntime = Get ("ObjCRuntime"); ObjCRuntime = String.IsNullOrEmpty (customObjCRuntimeNS) @@ -728,7 +724,7 @@ public class NamespaceManager if (Frameworks.HaveAudioUnit) ImplicitNamespaces.Add (Get ("AudioUnit")); - if (Frameworks.HaveContacts && UnifiedAPI) + if (Frameworks.HaveContacts) ImplicitNamespaces.Add (Get ("Contacts")); if (Frameworks.HaveCoreAnimation) ImplicitNamespaces.Add (Get ("CoreAnimation")); @@ -765,16 +761,16 @@ public class NamespaceManager if (Frameworks.HaveAddressBook) ImplicitNamespaces.Add (Get ("AddressBook")); - if (Frameworks.HaveModelIO && !(CurrentPlatform == PlatformName.MacOSX && !UnifiedAPI)) + if (Frameworks.HaveModelIO) ImplicitNamespaces.Add (Get ("ModelIO")); - if (Frameworks.HaveMetal && !(CurrentPlatform == PlatformName.MacOSX && !UnifiedAPI)) + if (Frameworks.HaveMetal) ImplicitNamespaces.Add (Get ("Metal")); if (Frameworks.HaveCoreImage) ImplicitNamespaces.Add (Get ("CoreImage")); if (Frameworks.HavePhotos) ImplicitNamespaces.Add (Get ("Photos")); - if (Frameworks.HaveMediaPlayer && UnifiedAPI) + if (Frameworks.HaveMediaPlayer) ImplicitNamespaces.Add (Get ("MediaPlayer")); if (Frameworks.HaveMessages) ImplicitNamespaces.Add (Get ("Messages")); @@ -782,7 +778,7 @@ public class NamespaceManager ImplicitNamespaces.Add (Get ("GameplayKit")); if (Frameworks.HaveSpriteKit) ImplicitNamespaces.Add (Get ("SpriteKit")); - if (Frameworks.HaveFileProvider && UnifiedAPI) + if (Frameworks.HaveFileProvider) ImplicitNamespaces.Add (Get ("FileProvider")); // These are both types and namespaces @@ -797,9 +793,7 @@ public class NamespaceManager public string Get (string nsWithoutPrefix) { - if (String.IsNullOrEmpty (Prefix)) - return nsWithoutPrefix; - return Prefix + "." + nsWithoutPrefix; + return nsWithoutPrefix; } public string [] Get (IEnumerable nsWithoutPrefix) @@ -881,8 +875,6 @@ public partial class Generator : IMemberGatherer { // Dictionary delegate_types = new Dictionary (); - public bool Compat { get { return !UnifiedAPI; } } - public PlatformName CurrentPlatform { get { return BindingTouch.CurrentPlatform; } } public string ApplicationClassName { @@ -900,15 +892,12 @@ public partial class Generator : IMemberGatherer { } } - // Static version of the above (!Compat) field, set on each Go invocation, needed because some static - // helper methods need to access this. This is the exact opposite of Compat. - public bool UnifiedAPI { get { return BindingTouch.Unified; } } public int XamcoreVersion { get { switch (CurrentPlatform) { case PlatformName.MacOSX: case PlatformName.iOS: - return UnifiedAPI ? 2 : 1; + return 2; case PlatformName.TvOS: case PlatformName.WatchOS: return 3; @@ -1093,7 +1082,7 @@ public partial class Generator : IMemberGatherer { t = TypeManager.GetUnderlyingEnumType (t); - if (UnifiedAPI && AttributeManager.HasAttribute (enumType)) { + if (AttributeManager.HasAttribute (enumType)) { if (t != TypeManager.System_Int64 && t != TypeManager.System_UInt64) throw new BindingException (1026, true, "`{0}`: Enums attributed with [{1}] must have an underlying type of `long` or `ulong`", @@ -1307,11 +1296,9 @@ public partial class Generator : IMemberGatherer { nsvalue_create_map [TypeManager.SCNVector3] = "Vector"; nsvalue_create_map [TypeManager.SCNVector4] = "Vector"; - if (UnifiedAPI) { - nsvalue_create_map [TypeManager.CoreGraphics_CGPoint] = "CGPoint"; - nsvalue_create_map [TypeManager.CoreGraphics_CGRect] = "CGRect"; - nsvalue_create_map [TypeManager.CoreGraphics_CGSize] = "CGSize"; - } + nsvalue_create_map [TypeManager.CoreGraphics_CGPoint] = "CGPoint"; + nsvalue_create_map [TypeManager.CoreGraphics_CGRect] = "CGRect"; + nsvalue_create_map [TypeManager.CoreGraphics_CGSize] = "CGSize"; if (Frameworks.HaveUIKit) { nsvalue_create_map [TypeManager.UIEdgeInsets] = "UIEdgeInsets"; @@ -1432,11 +1419,9 @@ public partial class Generator : IMemberGatherer { { TypeManager.System_UInt32, ".UInt32Value" }, { TypeManager.System_UInt64, ".UInt64Value" }, }; - if (UnifiedAPI) { - nsnumber_return_map [TypeManager.System_nfloat] = ".NFloatValue"; - nsnumber_return_map [TypeManager.System_nint] = ".NIntValue"; - nsnumber_return_map [TypeManager.System_nuint] = ".NUIntValue"; - } + 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; } @@ -1456,11 +1441,9 @@ public partial class Generator : IMemberGatherer { { TypeManager.SCNVector4, ".Vector4Value" } }; - if (UnifiedAPI) { - nsvalue_return_map [TypeManager.CoreGraphics_CGPoint] = ".CGPointValue"; - nsvalue_return_map [TypeManager.CoreGraphics_CGRect] = ".CGRectValue"; - nsvalue_return_map [TypeManager.CoreGraphics_CGSize] = ".CGSizeValue"; - } + 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"; @@ -1669,7 +1652,7 @@ public partial class Generator : IMemberGatherer { if (Frameworks.HaveAudioToolbox) { if (pi.ParameterType == TypeManager.AudioBuffers){ pars.AppendFormat ("IntPtr {0}", pi.Name.GetSafeParamName ()); - invoke.AppendFormat ("new global::{0}AudioToolbox.AudioBuffers ({1})", UnifiedAPI ? "" : "MonoTouch.", pi.Name.GetSafeParamName ()); + invoke.AppendFormat ("new global::AudioToolbox.AudioBuffers ({0})", pi.Name.GetSafeParamName ()); continue; } } @@ -1716,7 +1699,7 @@ public partial class Generator : IMemberGatherer { invoke.Append ($"ref {refname}"); continue; } - } else if (!Compat && IsNativeEnum (pi.ParameterType)) { + } else if (IsNativeEnum (pi.ParameterType)) { Type underlyingEnumType = TypeManager.GetUnderlyingEnumType (pi.ParameterType); pars.AppendFormat ("{0} {1}", GetNativeEnumType (pi.ParameterType), pi.Name.GetSafeParamName ()); invoke.AppendFormat ("({1}) ({2}) {0}", pi.Name.GetSafeParamName (), FormatType (null, pi.ParameterType), FormatType (null, underlyingEnumType)); @@ -1819,7 +1802,7 @@ public partial class Generator : IMemberGatherer { if (enum_mode != EnumMode.Compat && enum_mode != EnumMode.NativeBits && pi.ParameterType.IsEnum) return "(" + PrimitiveType (pi.ParameterType, enum_mode: enum_mode) + ")" + pi.Name.GetSafeParamName (); - if (enum_mode == EnumMode.NativeBits && IsNativeEnum (pi.ParameterType) && !Compat) + if (enum_mode == EnumMode.NativeBits && IsNativeEnum (pi.ParameterType)) return "(" + GetNativeEnumType (pi.ParameterType) + ") (" + PrimitiveType (TypeManager.GetUnderlyingEnumType (pi.ParameterType)) + ") " + pi.Name.GetSafeParamName (); if (IsNativeType (pi.ParameterType)) @@ -1954,7 +1937,7 @@ public partial class Generator : IMemberGatherer { public bool IsTarget (ParameterInfo pi) { var is_target = AttributeManager.HasAttribute (pi); - if (is_target && UnifiedAPI) { + if (is_target) { throw new BindingException (1031, true, "The [Target] attribute is not supported for the Unified API (found on the member '{0}.{1}'). " + "For Objective-C categories, create an api definition interface with the [Category] attribute instead.", @@ -2070,9 +2053,6 @@ public partial class Generator : IMemberGatherer { bool HasNativeEnumInSignature (MethodInfo mi) { - if (Compat) - return false; - if (IsNativeEnum (mi.ReturnType)) return true; @@ -2089,38 +2069,24 @@ public partial class Generator : IMemberGatherer { return; try { - if (Compat) { - var returnType = mi.ReturnType; - bool arm_stret = Stret.ArmNeedStret (returnType, this); - bool is_aligned = AttributeManager.HasAttribute (mi); - RegisterMethod (arm_stret, mi, MakeSig (mi, arm_stret, arm_stret && is_aligned), arm_stret && is_aligned); - RegisterMethod (arm_stret, mi, MakeSuperSig (mi, arm_stret, arm_stret && is_aligned), arm_stret && is_aligned); - - bool x86_stret = Stret.X86NeedStret (returnType, this); - if (x86_stret != arm_stret){ - RegisterMethod (x86_stret, mi, MakeSig (mi, x86_stret, x86_stret && is_aligned), x86_stret && is_aligned); - RegisterMethod (x86_stret, mi, MakeSuperSig (mi, x86_stret, x86_stret && is_aligned), x86_stret && is_aligned); - } + EnumMode[] modes; + if (HasNativeEnumInSignature (mi)) { + modes = new EnumMode[] { EnumMode.Bit32, EnumMode.Bit64 }; } else { - EnumMode[] modes; - if (HasNativeEnumInSignature (mi)) { - modes = new EnumMode[] { EnumMode.Bit32, EnumMode.Bit64 }; - } else { - modes = new EnumMode[] { EnumMode.Bit32 }; - } - foreach (var mode in modes) { - // arm64 never requires stret, so we'll always need the non-stret variants - RegisterMethod (false, mi, MakeSig (mi, false, enum_mode: mode), false, mode); - RegisterMethod (false, mi, MakeSuperSig (mi, false, enum_mode: mode), false, mode); + modes = new EnumMode[] { EnumMode.Bit32 }; + } + foreach (var mode in modes) { + // arm64 never requires stret, so we'll always need the non-stret variants + RegisterMethod (false, mi, MakeSig (mi, false, enum_mode: mode), false, mode); + RegisterMethod (false, mi, MakeSuperSig (mi, false, enum_mode: mode), false, mode); - if (CheckNeedStret (mi)) { - RegisterMethod (true, mi, MakeSig (mi, true, enum_mode: mode), false, mode); - RegisterMethod (true, mi, MakeSuperSig (mi, true, enum_mode: mode), false, mode); + if (CheckNeedStret (mi)) { + RegisterMethod (true, mi, MakeSig (mi, true, enum_mode: mode), false, mode); + RegisterMethod (true, mi, MakeSuperSig (mi, true, enum_mode: mode), false, mode); - if (AttributeManager.HasAttribute (mi)) { - RegisterMethod (true, mi, MakeSig (mi, true, true, mode), true, mode); - RegisterMethod (true, mi, MakeSuperSig (mi, true, true, mode), true, mode); - } + if (AttributeManager.HasAttribute (mi)) { + RegisterMethod (true, mi, MakeSig (mi, true, true, mode), true, mode); + RegisterMethod (true, mi, MakeSuperSig (mi, true, true, mode), true, mode); } } } @@ -2204,12 +2170,6 @@ public partial class Generator : IMemberGatherer { if (t.IsUnavailable (this)) return true; - if (Compat) - return AttributeManager.GetCustomAttributes (t) - .Any (attr => attr.AvailabilityKind == AvailabilityKind.Introduced && - attr.Platform == CurrentPlatform && - attr.Architecture == PlatformArchitecture.Arch64); - return false; } @@ -2290,7 +2250,7 @@ public partial class Generator : IMemberGatherer { m = GetOutputStream ("ObjCRuntime", "Messaging"); Header (m); print (m, "namespace {0} {{", ns.ObjCRuntime); - print (m, "\t{0}partial class Messaging {{", Compat ? "public " : String.Empty); + print (m, "\tpartial class Messaging {"); if (BindThirdPartyLibrary){ print (m, "\t\tstatic internal System.Reflection.Assembly this_assembly = typeof (Messaging).Assembly;\n"); @@ -2527,33 +2487,6 @@ public partial class Generator : IMemberGatherer { Type GetCorrectGenericType (Type type) { - if (UnifiedAPI) - return type; - - if (type != null && type.IsGenericType) { - // for compat we expose NSSet/NSDictionary instead of NSSet/NSDictionary - var bt = type.GetGenericTypeDefinition (); - - switch (bt.FullName) { - case "MonoTouch.Foundation.NSDictionary`2": - case "MonoMac.Foundation.NSDictionary`2": - return bt.Assembly.GetType (bt.Namespace + ".NSDictionary"); - case "MonoTouch.Foundation.NSMutableDictionary`2": - case "MonoMac.Foundation.NSMutableDictionary`2": - return bt.Assembly.GetType (bt.Namespace + ".NSMutableDictionary"); - case "MonoTouch.Foundation.NSSet`1": - case "MonoMac.Foundation.NSSet`1": - return bt.Assembly.GetType (bt.Namespace + ".NSSet"); - case "MonoTouch.Foundation.NSMutableSet`1": - case "MonoMac.Foundation.NSMutableSet`1": - return bt.Assembly.GetType (bt.Namespace + ".NSMutableSet"); - case "MonoTouch.Foundation.NSMutableArray`1": - case "MonoMac.Foundation.NSMutableArray`1": - return bt.Assembly.GetType (bt.Namespace + ".NSMutableArray"); - default: - return type; - } - } return type; } @@ -2860,13 +2793,13 @@ public partial class Generator : IMemberGatherer { } else if (fetchType == TypeManager.System_nuint){ getter = "{1} GetNUIntValue ({0})"; setter = "SetNumberValue ({0}, {1}value)"; - } else if (UnifiedAPI && fetchType == TypeManager.CoreGraphics_CGRect){ + } else if (fetchType == TypeManager.CoreGraphics_CGRect){ getter = "{1} GetCGRectValue ({0})"; setter = "SetCGRectValue ({0}, {1}value)"; - } else if (UnifiedAPI && fetchType == TypeManager.CoreGraphics_CGSize){ + } else if (fetchType == TypeManager.CoreGraphics_CGSize){ getter = "{1} GetCGSizeValue ({0})"; setter = "SetCGSizeValue ({0}, {1}value)"; - } else if (UnifiedAPI && fetchType == TypeManager.CoreGraphics_CGPoint){ + } else if (fetchType == TypeManager.CoreGraphics_CGPoint){ getter = "{1} GetCGPointValue ({0})"; setter = "SetCGPointValue ({0}, {1}value)"; } else if (Frameworks.HaveCoreMedia && fetchType == TypeManager.CMTime){ @@ -3449,9 +3382,6 @@ public partial class Generator : IMemberGatherer { public bool Protocolize (ICustomAttributeProvider provider) { - if (!UnifiedAPI) - return false; - var attribs = AttributeManager.GetCustomAttributes (provider); if (attribs == null || attribs.Length == 0) return false; @@ -3472,7 +3402,7 @@ public partial class Generator : IMemberGatherer { if (!minfo.is_ctor && !is_async){ var prefix = ""; - if (UnifiedAPI && !BindThirdPartyLibrary){ + if (!BindThirdPartyLibrary){ var hasReturnTypeProtocolize = Protocolize (AttributeManager.GetReturnTypeCustomAttributes (minfo.method)); if (hasReturnTypeProtocolize) { if (!IsProtocol (minfo.method.ReturnType)) { @@ -3797,39 +3727,6 @@ public partial class Generator : IMemberGatherer { } } - void GenerateInvoke (bool supercall, MethodInfo mi, MemberInformation minfo, string selector, string[] args, bool assign_to_temp, Type category_type) - { - if (!Compat) { - GenerateNewStyleInvoke (supercall, mi, minfo, selector, args, assign_to_temp, category_type); - return; - } - - var returnType = mi.ReturnType; - bool arm_stret = Stret.ArmNeedStret (returnType, this); - bool x86_stret = Stret.X86NeedStret (returnType, this); - bool aligned = AttributeManager.HasAttribute (mi); - - if (CurrentPlatform == PlatformName.MacOSX) { - GenerateInvoke (x86_stret, supercall, mi, minfo, selector, args[0], assign_to_temp, category_type, aligned && x86_stret); - return; - } - - bool need_two_paths = arm_stret != x86_stret; - if (need_two_paths){ - print ("if (Runtime.Arch == Arch.DEVICE){"); - indent++; - GenerateInvoke (arm_stret, supercall, mi, minfo, selector, args[0], assign_to_temp, category_type, aligned && arm_stret); - indent--; - print ("} else {"); - indent++; - GenerateInvoke (x86_stret, supercall, mi, minfo, selector, args[0], assign_to_temp, category_type, aligned && arm_stret); - indent--; - print ("}"); - } else { - GenerateInvoke (arm_stret, supercall, mi, minfo, selector, args[0], assign_to_temp, category_type, aligned && arm_stret); - } - } - void GenerateNewStyleInvoke (bool supercall, MethodInfo mi, MemberInformation minfo, string selector, string[] args, bool assign_to_temp, Type category_type) { var returnType = mi.ReturnType; @@ -4225,7 +4122,7 @@ public partial class Generator : IMemberGatherer { if (!needs_null_check) continue; - if (UnifiedAPI && !BindThirdPartyLibrary) { + if (!BindThirdPartyLibrary) { if (!mi.IsSpecialName && IsModel (pi.ParameterType) && !Protocolize (pi)) ErrorHelper.Warning (1106, "The parameter {2} in the method {0}.{1} exposes a model ({3}). Please expose the corresponding protocol type instead ({4}.I{5}).", mi.DeclaringType, mi.Name, pi.Name, pi.ParameterType, pi.ParameterType.Namespace, pi.ParameterType.Name); @@ -4391,7 +4288,7 @@ public partial class Generator : IMemberGatherer { ((body_options & BodyOption.NeedsTempReturn) == BodyOption.NeedsTempReturn) || (mi.ReturnType.IsSubclassOf (TypeManager.System_Delegate)) || (AttributeManager.HasAttribute (AttributeManager.GetReturnTypeCustomAttributes (mi))) || - (!Compat && IsNativeEnum (mi.ReturnType)) || + (IsNativeEnum (mi.ReturnType)) || (mi.Name != "Constructor" && by_ref_processing.Length > 0 && mi.ReturnType != TypeManager.System_Void) || needsPtrZeroCheck; @@ -4419,7 +4316,7 @@ public partial class Generator : IMemberGatherer { if (minfo.is_virtual_method || mi.Name == "Constructor"){ //print ("if (this.GetType () == TypeManager.{0}) {{", type.Name); if (external || minfo.is_interface_impl || minfo.is_extension_method) { - GenerateInvoke (false, mi, minfo, sel, argsArray, needs_temp, category_type); + GenerateNewStyleInvoke (false, mi, minfo, sel, argsArray, needs_temp, category_type); } else { var may_throw = ShouldMarshalNativeExceptions (mi); var null_handle = may_throw && mi.Name == "Constructor"; @@ -4430,8 +4327,8 @@ public partial class Generator : IMemberGatherer { WriteIsDirectBindingCondition (sw, ref indent, is_direct_binding, mi.Name == "Constructor" ? is_direct_binding_value : null, // We only need to print the is_direct_binding value in constructors - () => { GenerateInvoke (false, mi, minfo, sel, argsArray, needs_temp, category_type); return null; }, - () => { GenerateInvoke (true, mi, minfo, sel, argsArray, needs_temp, category_type); return null; } + () => { GenerateNewStyleInvoke (false, mi, minfo, sel, argsArray, needs_temp, category_type); return null; }, + () => { GenerateNewStyleInvoke (true, mi, minfo, sel, argsArray, needs_temp, category_type); return null; } ); if (null_handle) { @@ -4445,7 +4342,7 @@ public partial class Generator : IMemberGatherer { } } } else { - GenerateInvoke (false, mi, minfo, sel, argsArray, needs_temp, category_type); + GenerateNewStyleInvoke (false, mi, minfo, sel, argsArray, needs_temp, category_type); } if (minfo.is_return_release) { @@ -4699,25 +4596,23 @@ public partial class Generator : IMemberGatherer { var mod = minfo.GetVisibility (); minfo.protocolize = Protocolize (pi); - if (UnifiedAPI) { // We have some sub-optimal bindings in compat that trigger this exception, so we just don't fix those - // So we don't hide the get or set of a parent property with the same name, we need to see if we have a parent declaring the same property - PropertyInfo parentBaseType = GetParentTypeWithSameNamedProperty (ReflectionExtensions.GetBaseTypeAttribute (type, this), pi.Name); + // So we don't hide the get or set of a parent property with the same name, we need to see if we have a parent declaring the same property + PropertyInfo parentBaseType = GetParentTypeWithSameNamedProperty (ReflectionExtensions.GetBaseTypeAttribute (type, this), pi.Name); - // If so, we're not static, and we can't both read and write, but they can - if (!minfo.is_static && !(pi.CanRead && pi.CanWrite) && (parentBaseType != null && parentBaseType.CanRead && parentBaseType.CanWrite)) { - // Make sure the selector matches, sanity check that we aren't hiding something of a different type - // We skip this for wrap'ed properties, as those get complicated to resolve the correct export - if (wrap == null && - ((pi.CanRead && (GetGetterExportAttribute (pi).Selector != GetGetterExportAttribute (parentBaseType).Selector)) || - pi.CanWrite && (GetSetterExportAttribute (pi).Selector != GetSetterExportAttribute (parentBaseType).Selector))) { - throw new BindingException (1035, true, "The property {0} on class {1} is hiding a property from a parent class {2} but the selectors do not match.", pi.Name, type, parentBaseType.DeclaringType); - } - // Then let's not write out our copy, since we'll reduce visibility - return; + // If so, we're not static, and we can't both read and write, but they can + if (!minfo.is_static && !(pi.CanRead && pi.CanWrite) && (parentBaseType != null && parentBaseType.CanRead && parentBaseType.CanWrite)) { + // Make sure the selector matches, sanity check that we aren't hiding something of a different type + // We skip this for wrap'ed properties, as those get complicated to resolve the correct export + if (wrap == null && + ((pi.CanRead && (GetGetterExportAttribute (pi).Selector != GetGetterExportAttribute (parentBaseType).Selector)) || + pi.CanWrite && (GetSetterExportAttribute (pi).Selector != GetSetterExportAttribute (parentBaseType).Selector))) { + throw new BindingException (1035, true, "The property {0} on class {1} is hiding a property from a parent class {2} but the selectors do not match.", pi.Name, type, parentBaseType.DeclaringType); } + // Then let's not write out our copy, since we'll reduce visibility + return; } - if (UnifiedAPI && !BindThirdPartyLibrary) { + if (!BindThirdPartyLibrary) { var elType = pi.PropertyType.IsArray ? pi.PropertyType.GetElementType () : pi.PropertyType; if (IsModel (elType) && !minfo.protocolize) { @@ -4762,7 +4657,7 @@ public partial class Generator : IMemberGatherer { print ("set {"); indent++; - var is_protocol_wrapper = UnifiedAPI && IsProtocolInterface (pi.PropertyType, false); + var is_protocol_wrapper = IsProtocolInterface (pi.PropertyType, false); if (minfo.protocolize || is_protocol_wrapper){ print ("var rvalue = value as NSObject;"); @@ -5062,7 +4957,7 @@ public partial class Generator : IMemberGatherer { if (minfo.is_void_async) return "Task"; var ttype = GetAsyncTaskType (minfo); - if (UnifiedAPI && minfo.has_nserror && (ttype == "bool")) + if (minfo.has_nserror && (ttype == "bool")) ttype = "Tuple"; return "Task<" + ttype + ">"; } @@ -5166,7 +5061,7 @@ public partial class Generator : IMemberGatherer { var tuple = false; if (!minfo.is_void_async) { ttype = GetAsyncTaskType (minfo); - tuple = (UnifiedAPI && minfo.has_nserror && (ttype == "bool")); + tuple = (minfo.has_nserror && (ttype == "bool")); if (tuple) ttype = "Tuple"; } @@ -5825,11 +5720,7 @@ public partial class Generator : IMemberGatherer { // avoid (for unified) all the metadata for empty static classes, we can introduce them later when required bool include_extensions = false; - if (UnifiedAPI) { - include_extensions = optionalInstanceMethods.Any () || optionalInstanceProperties.Any () || requiredInstanceAsyncMethods.Any (); - } else { - include_extensions = true; - } + include_extensions = optionalInstanceMethods.Any () || optionalInstanceProperties.Any () || requiredInstanceAsyncMethods.Any (); if (include_extensions) { // extension methods PrintAttributes (type, preserve:true, advice:true); @@ -5916,9 +5807,6 @@ public partial class Generator : IMemberGatherer { { var dir = basedir; - if (!string.IsNullOrEmpty (@namespace)) - dir = Path.Combine (dir, @namespace.Replace (ns.Prefix + ".", string.Empty)); - var filename = Path.Combine (dir, name + ".g.cs"); var counter = 2; while (generated_files.Contains (filename)) { @@ -6073,12 +5961,6 @@ public partial class Generator : IMemberGatherer { throw new BindingException (1042, true, $"Missing '[Field (LibraryName=value)]' for {propertyName} (e.g.\"__Internal\")"); } else { library_name = type.Namespace; - - // note: not every binding namespace will start with ns.Prefix (e.g. MonoTouch.) - if (!String.IsNullOrEmpty (ns.Prefix) && library_name.StartsWith (ns.Prefix, StringComparison.Ordinal)) { - library_name = library_name.Substring (ns.Prefix.Length + 1); - library_name = library_name.Replace (".", string.Empty); // Remove dots from namespaces - } } if (!libraries.ContainsKey (library_name)) @@ -6112,7 +5994,7 @@ public partial class Generator : IMemberGatherer { public void Generate (Type type) { - if (!Compat && ZeroCopyStrings) { + if (ZeroCopyStrings) { ErrorHelper.Warning (1027, "Support for ZeroCopy strings is not implemented. Strings will be marshalled as NSStrings."); ZeroCopyStrings = false; } @@ -6372,7 +6254,7 @@ public partial class Generator : IMemberGatherer { if (TypeName != "NSObject"){ var initSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"init\")" : "Selector.Init"; var initWithCoderSelector = (InlineSelectors || BindThirdPartyLibrary) ? "Selector.GetHandle (\"initWithCoder:\")" : "Selector.InitWithCoder"; - string v = UnifiedAPI && class_mod == "abstract " ? "protected" : ctor_visibility; + string v = class_mod == "abstract " ? "protected" : ctor_visibility; var is32BitNotSupported = Is64BitiOSOnly (type); if (external) { if (!disable_default_ctor) { @@ -6427,18 +6309,13 @@ public partial class Generator : IMemberGatherer { sw.WriteLine ("\t\t}"); sw.WriteLine (); } - // old monotouch.dll (and MonoMac.dll, XamMac.dll) always included this .ctor even if the - // type did not conform to NSCopying. That made the .ctor throw a (native) exception and crash var nscoding = ConformToNSCoding (type); - if (Compat || nscoding) { - // for compatibility we continue to include the .ctor(NSCoder) in the compat assemblies - // but we make it throw an InvalidOperationException if the type does not implement NSCoding - // because it's easier to catch (and won't crash on devices) + if (nscoding) { GeneratedCode (sw, 2); sw.WriteLine ("\t\t[DesignatedInitializer]"); sw.WriteLine ("\t\t[EditorBrowsable (EditorBrowsableState.Advanced)]"); sw.WriteLine ("\t\t[Export (\"initWithCoder:\")]"); - sw.WriteLine ("\t\t{0} {1} (NSCoder coder) : base (NSObjectFlag.Empty)", UnifiedAPI ? v : "public", TypeName); + sw.WriteLine ("\t\t{0} {1} (NSCoder coder) : base (NSObjectFlag.Empty)", v, TypeName); sw.WriteLine ("\t\t{"); if (is32BitNotSupported) { sw.WriteLine ("\t\t#if ARCH_32"); @@ -6466,7 +6343,7 @@ public partial class Generator : IMemberGatherer { if (!is_sealed) { GeneratedCode (sw, 2); sw.WriteLine ("\t\t[EditorBrowsable (EditorBrowsableState.Advanced)]"); - sw.WriteLine ("\t\t{0} {1} (NSObjectFlag t) : base (t)", UnifiedAPI ? "protected" : "public", TypeName); + sw.WriteLine ("\t\tprotected {0} (NSObjectFlag t) : base (t)", TypeName); sw.WriteLine ("\t\t{"); if (is32BitNotSupported) { sw.WriteLine ("\t\t#if ARCH_32"); @@ -6483,7 +6360,7 @@ public partial class Generator : IMemberGatherer { } GeneratedCode (sw, 2); sw.WriteLine ("\t\t[EditorBrowsable (EditorBrowsableState.Advanced)]"); - sw.WriteLine ("\t\t{0} {1} (IntPtr handle) : base (handle)", UnifiedAPI ? "protected internal" : "public", TypeName); + sw.WriteLine ("\t\tprotected internal {0} (IntPtr handle) : base (handle)", TypeName); sw.WriteLine ("\t\t{"); if (is32BitNotSupported) { sw.WriteLine ("\t\t#if ARCH_32"); @@ -6691,13 +6568,13 @@ public partial class Generator : IMemberGatherer { field_pi.PropertyType == TypeManager.AVCaptureWhiteBalanceGains)) { print ("return *(({3} *) Dlfcn.dlsym (Libraries.{2}.Handle, \"{1}\"));", field_pi.Name, fieldAttr.SymbolName, library_name, FormatType (type, field_pi.PropertyType.Namespace, field_pi.PropertyType.Name)); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.System_nint) { + } else if (field_pi.PropertyType == TypeManager.System_nint) { print ("return Dlfcn.GetNInt (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.System_nuint) { + } else if (field_pi.PropertyType == TypeManager.System_nuint) { print ("return Dlfcn.GetNUInt (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.System_nfloat) { + } else if (field_pi.PropertyType == TypeManager.System_nfloat) { print ("return Dlfcn.GetNFloat (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.CoreGraphics_CGSize){ + } else if (field_pi.PropertyType == TypeManager.CoreGraphics_CGSize){ print ("return Dlfcn.GetCGSize (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType.IsEnum) { var btype = field_pi.PropertyType.GetEnumUnderlyingType (); @@ -6707,7 +6584,7 @@ public partial class Generator : IMemberGatherer { print ("_{0} = Dlfcn.GetStringConstant (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); indent--; print ($"return {smartEnumTypeName}Extensions.GetValue (_{field_pi.Name});"); - } else if (UnifiedAPI && IsNativeEnum (field_pi.PropertyType)) { + } else if (IsNativeEnum (field_pi.PropertyType)) { if (btype == TypeManager.System_nint || btype == TypeManager.System_Int64) print ($"return ({fieldTypeName}) (long) Dlfcn.GetNInt (Libraries.{library_name}.Handle, \"{fieldAttr.SymbolName}\");" ); else if (btype == TypeManager.System_nuint || btype == TypeManager.System_UInt64) @@ -6761,19 +6638,19 @@ public partial class Generator : IMemberGatherer { print ("Dlfcn.SetString (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType.Name == "NSArray"){ print ("Dlfcn.SetArray (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.System_nint) { + } else if (field_pi.PropertyType == TypeManager.System_nint) { print ("Dlfcn.SetNInt (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.System_nuint) { + } else if (field_pi.PropertyType == TypeManager.System_nuint) { print ("Dlfcn.SetNUInt (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.System_nfloat) { + } else if (field_pi.PropertyType == TypeManager.System_nfloat) { print ("Dlfcn.SetNFloat (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); - } else if (UnifiedAPI && field_pi.PropertyType == TypeManager.CoreGraphics_CGSize) { + } else if (field_pi.PropertyType == TypeManager.CoreGraphics_CGSize) { print ("Dlfcn.SetCGSize (Libraries.{2}.Handle, \"{1}\", value);", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType.IsEnum) { var btype = field_pi.PropertyType.GetEnumUnderlyingType (); if (smartEnumTypeName != null) print ($"Dlfcn.SetString (Libraries.{library_name}.Handle, \"{fieldAttr.SymbolName}\", value.GetConstant ());"); - else if (UnifiedAPI && IsNativeEnum (field_pi.PropertyType)) { + else if (IsNativeEnum (field_pi.PropertyType)) { if (btype == TypeManager.System_nint || (BindThirdPartyLibrary && btype == TypeManager.System_Int64)) print ($"Dlfcn.SetNInt (Libraries.{library_name}.Handle, \"{fieldAttr.SymbolName}\", (nint) (long) value);"); else if (btype == TypeManager.System_nuint || (BindThirdPartyLibrary && btype == TypeManager.System_UInt64))