Пример #1
0
        internal void GenDelegatePlumbing(DelegateType d)
        {
            if (!DelegatesSeen.ContainsKey(d))
            {
                DelegateSanityCheck(d);

                var converted      = new ForeignMacroExpr(d, Convert, Helpers);
                var entrypointName = Convert.Name.GenNativeMethodName(d);

                // Generate c++ entrypoint
                BlockHost.AddCppEntrypoint(converted, entrypointName);
                BlockHost.Include(d);

                // Generate java native method
                BlockHost.NativeJavaMethods.Add(converted.GenJavaNativeMethod(entrypointName));

                // Generate java runnable/callable class
                DelegatesSeen.Add(d, GenJavaDelegateCode(d, converted, entrypointName));
            }
        }
Пример #2
0
        string InterceptCallToUno(Function func, object callArgs)
        {
            var ufunc          = new ForeignMacroExpr(func, Convert, Helpers);
            var entrypointName = Convert.Name.GenNativeMethodName(func);

            // Add requirements
            BlockHost.RequireMember(func);
            BlockHost.Include(ufunc.EntrypointIncludes);

            // Generate c++ entrypoint
            BlockHost.AddCppEntrypoint(ufunc, entrypointName);

            // Generate java native method
            BlockHost.NativeJavaMethods.Add(ufunc.GenJavaNativeMethod(entrypointName));

            // Generate java call to java native method
            var args       = (List <string>)callArgs;
            var castedArgs = ufunc.Params.Zip(args, (x, y) => x.JavaArgCast + y);

            return(ufunc.GenCallToNativeMethod(entrypointName, new List <string>(castedArgs)));
        }
Пример #3
0
        string InterceptProperty(string macroText, string expansionResult, Property property, object callArgs)
        {
            var isGetter       = !macroText.Contains(":Set(");
            var ufunc          = new ForeignMacroExpr(property, isGetter, Convert, Helpers);
            var entrypointName = Convert.Name.GenNativePropertyName(property, isGetter);

            // Add requirements
            BlockHost.RequireMember(property);
            BlockHost.Include(property.DeclaringType);
            BlockHost.Include(ufunc.EntrypointIncludes);

            // Generate c++ entrypoint
            BlockHost.AddCppEntrypoint(ufunc, entrypointName);

            // Generate java native method
            BlockHost.NativeJavaMethods.Add(ufunc.GenJavaNativeMethod(entrypointName));

            // Generate java call to java native method
            var args = callArgs == null ? new List <string>() : new List <string>((List <string>)callArgs);

            return(ufunc.GenCallToNativeMethod(entrypointName, args));
        }