public NativeType nativeType() { return converter.getRealType().getNativeType(); }
public NativeType nativeType() { return converter.getRealType().getNativeType(); }
public NativeType nativeType() { return converter.getRealType().getNativeType(); }
public NativeType nativeType() { return converter.getRealType().getNativeType(); }
@SuppressWarnings("deprecation") private static ParameterMarshaller newConvertingMarshallerWithHash(Type type, CallingConvention convention, IRubyObject enums, MappedType ctype) { return new ConvertingMarshaller( getMarshaller(ctype.getRealType(), convention, enums.isNil() ? null : (RubyHash)enums), DataConverters.getParameterConverter(type, enums.isNil() ? null : (RubyHash)enums)); }
@SuppressWarnings("deprecation") private static ParameterMarshaller newConvertingMarshallerWithHash(Type type, CallingConvention convention, IRubyObject enums, MappedType ctype) { return new ConvertingMarshaller( getMarshaller(ctype.getRealType(), convention, enums.isNil() ? null : (RubyHash)enums), DataConverters.getParameterConverter(type, enums.isNil() ? null : (RubyHash)enums)); }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
public static MemoryOp getMemoryOp(Type type, ByteOrder order) { if (type instanceof Type.Builtin) { return getMemoryOp(type.getNativeType(), order); } else if (type instanceof StructByValue) { StructByValue sbv = (StructByValue) type; return new StructOp(sbv.getStructClass()); } else if (type instanceof MappedType) { return new Mapped(getMemoryOp(((MappedType) type).getRealType(), order), (MappedType) type); } return null; }
private static CachingCallSite getParameterCallSite(Signature signature, int parameterIndex) { if (signature.getParameterCount() <= parameterIndex) { return null; } Type type = signature.getParameterType(parameterIndex); NativeType nativeType = type instanceof MappedType ? ((MappedType) type).getRealType().getNativeType() : type.getNativeType(); switch (nativeType) { case STRING: case TRANSIENT_STRING: return new FunctionalCachingCallSite("to_str"); case POINTER: case BUFFER_IN: case BUFFER_OUT: case BUFFER_INOUT: return new FunctionalCachingCallSite("to_ptr"); default: return null; } }
private static CachingCallSite getParameterCallSite(Signature signature, int parameterIndex) { if (signature.getParameterCount() <= parameterIndex) { return null; } Type type = signature.getParameterType(parameterIndex); NativeType nativeType = type instanceof MappedType ? ((MappedType) type).getRealType().getNativeType() : type.getNativeType(); switch (nativeType) { case STRING: case TRANSIENT_STRING: return new FunctionalCachingCallSite("to_str"); case POINTER: case BUFFER_IN: case BUFFER_OUT: case BUFFER_INOUT: return new FunctionalCachingCallSite("to_ptr"); default: return null; } }
private static CachingCallSite getParameterCallSite(Signature signature, int parameterIndex) { if (signature.getParameterCount() <= parameterIndex) { return null; } Type type = signature.getParameterType(parameterIndex); NativeType nativeType = type instanceof MappedType ? ((MappedType) type).getRealType().getNativeType() : type.getNativeType(); switch (nativeType) { case STRING: case TRANSIENT_STRING: return new FunctionalCachingCallSite("to_str"); case POINTER: case BUFFER_IN: case BUFFER_OUT: case BUFFER_INOUT: return new FunctionalCachingCallSite("to_ptr"); default: return null; } }
private static CachingCallSite getParameterCallSite(Signature signature, int parameterIndex) { if (signature.getParameterCount() <= parameterIndex) { return null; } Type type = signature.getParameterType(parameterIndex); NativeType nativeType = type instanceof MappedType ? ((MappedType) type).getRealType().getNativeType() : type.getNativeType(); switch (nativeType) { case STRING: case TRANSIENT_STRING: return new FunctionalCachingCallSite("to_str"); case POINTER: case BUFFER_IN: case BUFFER_OUT: case BUFFER_INOUT: return new FunctionalCachingCallSite("to_ptr"); default: return null; } }
static FunctionInvoker getFunctionInvoker(Type returnType) { if (returnType instanceof Type.Builtin) { return getFunctionInvoker(returnType.getNativeType()); } else if (returnType instanceof CallbackInfo) { return new ConvertingInvoker(getFunctionInvoker(NativeType.POINTER), DataConverters.getResultConverter(returnType)); } else if (returnType instanceof StructByValue) { return new StructByValueInvoker((StructByValue) returnType); } else if (returnType instanceof MappedType) { MappedType ctype = (MappedType) returnType; return new ConvertingInvoker(getFunctionInvoker(ctype.getRealType()), DataConverters.getResultConverter(ctype)); } throw returnType.getRuntime().newArgumentError("Cannot get FunctionInvoker for " + returnType); }
private static com.kenai.jffi.Type cacheFFIType(Type type) { Object ffiType; synchronized (type) { if ((ffiType = type.getFFIHandle()) instanceof com.kenai.jffi.Type) { return (com.kenai.jffi.Type) ffiType; } if (type instanceof Type.Builtin || type instanceof CallbackInfo) { ffiType = FFIUtil.getFFIType(type.getNativeType()); } else if (type instanceof org.jruby.ext.ffi.StructLayout) { ffiType = FFIUtil.newStruct((org.jruby.ext.ffi.StructLayout) type); } else if (type instanceof org.jruby.ext.ffi.StructByValue) { ffiType = FFIUtil.newStruct(((org.jruby.ext.ffi.StructByValue) type).getStructLayout()); } else if (type instanceof org.jruby.ext.ffi.Type.Array) { ffiType = FFIUtil.newArray((org.jruby.ext.ffi.Type.Array) type); } else if (type instanceof org.jruby.ext.ffi.MappedType) { ffiType = FFIUtil.getFFIType(((org.jruby.ext.ffi.MappedType) type).getRealType()); } else { return null; } type.setFFIHandle(ffiType); } return (com.kenai.jffi.Type) ffiType; }
static FunctionInvoker getFunctionInvoker(Type returnType) { if (returnType instanceof Type.Builtin) { return getFunctionInvoker(returnType.getNativeType()); } else if (returnType instanceof CallbackInfo) { return new ConvertingInvoker(getFunctionInvoker(NativeType.POINTER), DataConverters.getResultConverter(returnType)); } else if (returnType instanceof StructByValue) { return new StructByValueInvoker((StructByValue) returnType); } else if (returnType instanceof MappedType) { MappedType ctype = (MappedType) returnType; return new ConvertingInvoker(getFunctionInvoker(ctype.getRealType()), DataConverters.getResultConverter(ctype)); } throw returnType.getRuntime().newArgumentError("Cannot get FunctionInvoker for " + returnType); }
static FunctionInvoker getFunctionInvoker(Type returnType) { if (returnType instanceof Type.Builtin) { return getFunctionInvoker(returnType.getNativeType()); } else if (returnType instanceof CallbackInfo) { return new ConvertingInvoker(getFunctionInvoker(NativeType.POINTER), DataConverters.getResultConverter(returnType)); } else if (returnType instanceof StructByValue) { return new StructByValueInvoker((StructByValue) returnType); } else if (returnType instanceof MappedType) { MappedType ctype = (MappedType) returnType; return new ConvertingInvoker(getFunctionInvoker(ctype.getRealType()), DataConverters.getResultConverter(ctype)); } throw returnType.getRuntime().newArgumentError("Cannot get FunctionInvoker for " + returnType); }
static FunctionInvoker getFunctionInvoker(Type returnType) { if (returnType instanceof Type.Builtin) { return getFunctionInvoker(returnType.getNativeType()); } else if (returnType instanceof CallbackInfo) { return new ConvertingInvoker(getFunctionInvoker(NativeType.POINTER), DataConverters.getResultConverter(returnType)); } else if (returnType instanceof StructByValue) { return new StructByValueInvoker((StructByValue) returnType); } else if (returnType instanceof MappedType) { MappedType ctype = (MappedType) returnType; return new ConvertingInvoker(getFunctionInvoker(ctype.getRealType()), DataConverters.getResultConverter(ctype)); } throw returnType.getRuntime().newArgumentError("Cannot get FunctionInvoker for " + returnType); }
/** * Gets a marshaller to convert from a ruby type to a native type. * * @param type The native type to convert to. * @return A new <tt>Marshaller</tt> */ static ParameterMarshaller getMarshaller(Type type, CallingConvention convention, IRubyObject enums) { if (type instanceof Type.Builtin) { return enums != null && !enums.isNil() ? getEnumMarshaller(type, convention, enums) : getMarshaller(type.getNativeType()); } else if (type instanceof org.jruby.ext.ffi.CallbackInfo) { return new ConvertingMarshaller(getMarshaller(type.getNativeType()), DataConverters.getParameterConverter(type, null)); } else if (type instanceof org.jruby.ext.ffi.StructByValue) { return new StructByValueMarshaller((org.jruby.ext.ffi.StructByValue) type); } else if (type instanceof org.jruby.ext.ffi.MappedType) { MappedType ctype = (MappedType) type; return new ConvertingMarshaller( getMarshaller(ctype.getRealType(), convention, enums), DataConverters.getParameterConverter(type, enums instanceof RubyHash ? (RubyHash) enums : null)); } else { return null; } }