Exemple #1
0
        int Execute()
        {
            var arguments  = BuildArgumentArray();
            var in_process = InProcess && Profile != Profile.macOSClassic;

            if (in_process)
            {
                int rv;
                var previous_environment = new Dictionary <string, string> ();
                foreach (var kvp in EnvironmentVariables)
                {
                    previous_environment [kvp.Key] = Environment.GetEnvironmentVariable(kvp.Key);
                    Environment.SetEnvironmentVariable(kvp.Key, kvp.Value);
                }
                ThreadStaticTextWriter.ReplaceConsole(Output);
                try {
                    rv = BindingTouch.Main(arguments);
                } finally {
                    ThreadStaticTextWriter.RestoreConsole();
                    foreach (var kvp in previous_environment)
                    {
                        Environment.SetEnvironmentVariable(kvp.Key, kvp.Value);
                    }
                }
                Console.WriteLine(Output);
                ParseMessages();
                return(rv);
            }
            return(Execute(arguments, always_show_output: true));
        }
Exemple #2
0
        int Execute()
        {
            var arguments  = BuildArgumentArray();
            var in_process = InProcess && Profile != Profile.macOSClassic;

            if (in_process)
            {
                int rv;
                ThreadStaticTextWriter.ReplaceConsole(Output);
                try {
                    rv = BindingTouch.Main(arguments);
                } finally {
                    ThreadStaticTextWriter.RestoreConsole();
                }
                Console.WriteLine(Output);
                ParseMessages();
                return(rv);
            }
            return(Execute(string.Join(" ", StringUtils.Quote(arguments)), always_show_output: true));
        }
Exemple #3
0
    static int Main2(string [] args)
    {
        var touch = new BindingTouch();

        return(touch.Main3(args));
    }
Exemple #4
0
    public void Initialize(BindingTouch binding_touch, Assembly api, Assembly corlib, Assembly platform, Assembly system, Assembly binding)
    {
        BindingTouch = binding_touch;

        api_assembly      = api;
        corlib_assembly   = corlib;
        platform_assembly = platform;
        system_assembly   = system;
        binding_assembly  = binding;

        /* corlib */
        System_Attribute    = Lookup(corlib_assembly, "System", "Attribute");
        System_Boolean      = Lookup(corlib_assembly, "System", "Boolean");
        System_Byte         = Lookup(corlib_assembly, "System", "Byte");
        System_Delegate     = Lookup(corlib_assembly, "System", "Delegate");
        System_Double       = Lookup(corlib_assembly, "System", "Double");
        System_Float        = Lookup(corlib_assembly, "System", "Single");
        System_Int16        = Lookup(corlib_assembly, "System", "Int16");
        System_Int32        = Lookup(corlib_assembly, "System", "Int32");
        System_Int64        = Lookup(corlib_assembly, "System", "Int64");
        System_IntPtr       = Lookup(corlib_assembly, "System", "IntPtr");
        System_Object       = Lookup(corlib_assembly, "System", "Object");
        System_SByte        = Lookup(corlib_assembly, "System", "SByte");
        System_String       = Lookup(corlib_assembly, "System", "String");
        System_String_Array = Lookup(corlib_assembly, "System", "String").MakeArrayType();
        System_UInt16       = Lookup(corlib_assembly, "System", "UInt16");
        System_UInt32       = Lookup(corlib_assembly, "System", "UInt32");
        System_UInt64       = Lookup(corlib_assembly, "System", "UInt64");
        System_Void         = Lookup(corlib_assembly, "System", "Void");

        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");
        INativeObject = Lookup(platform_assembly, "ObjCRuntime", "INativeObject");

        /* objcruntime */
        BlockLiteral = Lookup(platform_assembly, "ObjCRuntime", "BlockLiteral");
        Class        = Lookup(platform_assembly, "ObjCRuntime", "Class");
        Protocol     = Lookup(platform_assembly, "ObjCRuntime", "Protocol");
        Selector     = Lookup(platform_assembly, "ObjCRuntime", "Selector");

        Constants = Lookup(platform_assembly, "ObjCRuntime", "Constants");

        /* Different binding types */

        DictionaryContainerType = Lookup(platform_assembly, "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)
        AudioBuffers = Lookup(platform_assembly, "AudioToolbox", "AudioBuffers");
        if (Frameworks.HaveAudioToolbox)
        {
            MusicSequence = Lookup(platform_assembly, "AudioToolbox", "MusicSequence", true /* may not be found */);
        }
        if (Frameworks.HaveAudioUnit)
        {
            AudioComponent          = Lookup(platform_assembly, "AudioUnit", "AudioComponent");
            AudioUnit               = Lookup(platform_assembly, "AudioUnit", "AudioUnit");
            AURenderEventEnumerator = Lookup(platform_assembly, "AudioUnit", "AURenderEventEnumerator");
        }
        AVCaptureWhiteBalanceGains = Lookup(platform_assembly, "AVFoundation", "AVCaptureWhiteBalanceGains");
        if (Frameworks.HaveCoreAnimation)
        {
            CATransform3D = Lookup(platform_assembly, "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)
        {
            CGLContext     = Lookup(platform_assembly, "OpenGL", "CGLContext");
            CGLPixelFormat = Lookup(platform_assembly, "OpenGL", "CGLPixelFormat");
        }
        CGPath   = Lookup(platform_assembly, "CoreGraphics", "CGPath");
        CGVector = Lookup(platform_assembly, "CoreGraphics", "CGVector");
        if (Frameworks.HaveCoreLocation)
        {
            CLLocationCoordinate2D = Lookup(platform_assembly, "CoreLocation", "CLLocationCoordinate2D");
        }
        if (Frameworks.HaveCoreMedia)
        {
            CMAudioFormatDescription = Lookup(platform_assembly, "CoreMedia", "CMAudioFormatDescription");
            CMClock             = Lookup(platform_assembly, "CoreMedia", "CMClock");
            CMFormatDescription = Lookup(platform_assembly, "CoreMedia", "CMFormatDescription");
            CMSampleBuffer      = Lookup(platform_assembly, "CoreMedia", "CMSampleBuffer");
            CMTime                   = Lookup(platform_assembly, "CoreMedia", "CMTime");
            CMTimebase               = Lookup(platform_assembly, "CoreMedia", "CMTimebase");
            CMTimeMapping            = Lookup(platform_assembly, "CoreMedia", "CMTimeMapping");
            CMTimeRange              = Lookup(platform_assembly, "CoreMedia", "CMTimeRange");
            CMVideoFormatDescription = Lookup(platform_assembly, "CoreMedia", "CMVideoFormatDescription");
        }
        if (Frameworks.HaveCoreVideo)
        {
            CVImageBuffer     = Lookup(platform_assembly, "CoreVideo", "CVImageBuffer");
            CVPixelBuffer     = Lookup(platform_assembly, "CoreVideo", "CVPixelBuffer");
            CVPixelBufferPool = Lookup(platform_assembly, "CoreVideo", "CVPixelBufferPool");
        }
        DispatchQueue = Lookup(platform_assembly, "CoreFoundation", "DispatchQueue");
        DispatchData  = Lookup(platform_assembly, "CoreFoundation", "DispatchData");
        if (Frameworks.HaveCoreMidi)
        {
            MidiEndpoint = Lookup(platform_assembly, "CoreMidi", "MidiEndpoint");
        }
        if (Frameworks.HaveMapKit)
        {
            MKCoordinateSpan = Lookup(platform_assembly, "MapKit", "MKCoordinateSpan", true /* isn't in XM/Classic */);
        }
        if (Frameworks.HaveMediaToolbox)
        {
            MTAudioProcessingTap = Lookup(platform_assembly, "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)
        {
            UIOffset                = Lookup(platform_assembly, "UIKit", "UIOffset");
            UIEdgeInsets            = Lookup(platform_assembly, "UIKit", "UIEdgeInsets");
            NSDirectionalEdgeInsets = Lookup(platform_assembly, "UIKit", "NSDirectionalEdgeInsets");
        }

        CoreGraphics_CGRect  = Lookup(platform_assembly, "CoreGraphics", "CGRect");
        CoreGraphics_CGPoint = Lookup(platform_assembly, "CoreGraphics", "CGPoint");
        CoreGraphics_CGSize  = Lookup(platform_assembly, "CoreGraphics", "CGSize");
    }
Exemple #5
0
 public AttributeManager(BindingTouch binding_touch)
 {
     BindingTouch = binding_touch;
 }