コード例 #1
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            var pointerType = aNativeFunction.CurrentParameterType as PointerCType;

            if (pointerType == null)
            {
                return(false);
            }
            var namedType = pointerType.BaseType as NamedCType;

            if (namedType == null)
            {
                return(false);
            }

            switch (namedType.Name)
            {
            case "void":
                break;

            default:
                return(false);
            }

            aAssembler.AddPInvokeParameter(new CSharpType("IntPtr"), aNativeFunction.CurrentParameter.Name, null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeArgument();
            return(true);
        }
コード例 #2
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            var pointerType = aNativeFunction.CurrentParameterType as PointerCType;

            if (pointerType == null)
            {
                return(false);
            }
            var namedType = pointerType.BaseType as NamedCType;

            if (namedType == null)
            {
                return(false);
            }
            string structName;

            if (!iHandlesToStructNames.TryGetValue(namedType.Name, out structName))
            {
                return(false);
            }

            aAssembler.AddPInvokeParameter(new CSharpType(structName)
            {
                IsRef = true
            }, aNativeFunction.CurrentParameter.Name, null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeArgument();
            return(true);
        }
コード例 #3
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            if (aNativeFunction.CurrentParameter != null) return false;
            if (!(aNativeFunction.ReturnType is PointerCType)) return false;

            aAssembler.SetPInvokeReturn(new CSharpType("IntPtr"), null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeReturn();
            return true;
        }
コード例 #4
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            var pointerType = aNativeFunction.CurrentParameterType as PointerCType;
            if (pointerType == null) return false;
            var namedType = pointerType.BaseType as NamedCType;
            if (namedType == null) return false;

            // Accept anything.

            aAssembler.AddPInvokeParameter(new CSharpType("IntPtr"), aNativeFunction.CurrentParameter.Name, null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeArgument();
            return true;
        }
コード例 #5
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            if (aNativeFunction.CurrentParameter != null)
            {
                return(false);
            }
            if (!(aNativeFunction.ReturnType is PointerCType))
            {
                return(false);
            }

            aAssembler.SetPInvokeReturn(new CSharpType("IntPtr"), null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeReturn();
            return(true);
        }
コード例 #6
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            var pointerType = aNativeFunction.CurrentParameterType as PointerCType;
            if (pointerType == null) return false;
            var namedType = pointerType.BaseType as NamedCType;
            if (namedType == null) return false;
            string structName;
            if (!iHandlesToStructNames.TryGetValue(namedType.Name, out structName))
            {
                return false;
            }

            aAssembler.AddPInvokeParameter(new CSharpType(structName) { IsRef = true }, aNativeFunction.CurrentParameter.Name, null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeArgument();
            return true;
        }
コード例 #7
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            PointerCType pointer1Type = aNativeFunction.CurrentParameterType as PointerCType;
            if (pointer1Type == null) return false;
            PointerCType pointer2Type = pointer1Type.BaseType as PointerCType;
            if (pointer2Type == null) return false;
            NamedCType nativeType = pointer2Type.BaseType as NamedCType;
            if (nativeType == null) return false;
            if (!iHandleNames.Contains(nativeType.Name)) return false;

            aAssembler.AddPInvokeParameter(
                new CSharpType("IntPtr") { IsRef = true },
                aNativeFunction.CurrentParameter.Name,
                null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeArgument();
            return true;
        }
コード例 #8
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            var arrayType = aNativeFunction.CurrentParameterType as ArrayCType;
            if (arrayType == null) return false;
            var namedType = arrayType.BaseType as NamedCType;
            if (namedType == null) return false;

            switch (namedType.Name)
            {
                case "byte":
                    break;
                default:
                    return false;
            }

            aAssembler.AddPInvokeParameter(new CSharpType("IntPtr"), aNativeFunction.CurrentParameter.Name, null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeArgument();
            return true;
        }
コード例 #9
0
        public bool Apply(IFunctionSpecificationAnalyser aNativeFunction, IFunctionAssembler aAssembler)
        {
            PointerCType pointer1Type = aNativeFunction.CurrentParameterType as PointerCType;

            if (pointer1Type == null)
            {
                return(false);
            }
            PointerCType pointer2Type = pointer1Type.BaseType as PointerCType;

            if (pointer2Type == null)
            {
                return(false);
            }
            NamedCType nativeType = pointer2Type.BaseType as NamedCType;

            if (nativeType == null)
            {
                return(false);
            }
            if (!iHandleNames.Contains(nativeType.Name))
            {
                return(false);
            }

            aAssembler.AddPInvokeParameter(
                new CSharpType("IntPtr")
            {
                IsRef = true
            },
                aNativeFunction.CurrentParameter.Name,
                null);
            aAssembler.SuppressManagedWrapper();
            aNativeFunction.ConsumeArgument();
            return(true);
        }