@JRubyClass(name = "FFI::DynamicLibrary", parent = "Object") public class DynamicLibrary extends RubyObject { @JRubyConstant public static final int RTLD_LAZY = 0x00001; @JRubyConstant public static final int RTLD_NOW = 0x00002; @JRubyConstant public static final int RTLD_LOCAL = 0x00004; @JRubyConstant public static final int RTLD_GLOBAL = 0x00008;
public boolean defineAnnotatedConstant(Field field) { JRubyConstant jrubyConstant = field.getAnnotation(JRubyConstant.class); if (jrubyConstant == null) return false; String[] names = jrubyConstant.value(); if(names.length == 0) { names = new String[]{field.getName()}; } Class tp = field.getType(); IRubyObject realVal; try { if(tp == Integer.class || tp == Integer.TYPE || tp == Short.class || tp == Short.TYPE || tp == Byte.class || tp == Byte.TYPE) { realVal = RubyNumeric.int2fix(getRuntime(), field.getInt(null)); } else if(tp == Boolean.class || tp == Boolean.TYPE) { realVal = field.getBoolean(null) ? getRuntime().getTrue() : getRuntime().getFalse(); } else { realVal = getRuntime().getNil(); } } catch(Exception e) { realVal = getRuntime().getNil(); } for(String name : names) { this.setConstant(name, realVal); } return true; }
public boolean defineAnnotatedConstant(Field field) { JRubyConstant jrubyConstant = field.getAnnotation(JRubyConstant.class); if (jrubyConstant == null) return false; String[] names = jrubyConstant.value(); if(names.length == 0) { names = new String[]{field.getName()}; } Class tp = field.getType(); IRubyObject realVal; try { if(tp == Integer.class || tp == Integer.TYPE || tp == Short.class || tp == Short.TYPE || tp == Byte.class || tp == Byte.TYPE) { realVal = RubyNumeric.int2fix(getRuntime(), field.getInt(null)); } else if(tp == Boolean.class || tp == Boolean.TYPE) { realVal = field.getBoolean(null) ? getRuntime().getTrue() : getRuntime().getFalse(); } else { realVal = getRuntime().getNil(); } } catch(Exception e) { realVal = getRuntime().getNil(); } for(String name : names) { this.setConstant(name, realVal); } return true; }
@JRubyClass(name = "FFI::DynamicLibrary", parent = "Object") public class DynamicLibrary extends RubyObject { @JRubyConstant public static final int RTLD_LAZY = 0x00001; @JRubyConstant public static final int RTLD_NOW = 0x00002; @JRubyConstant public static final int RTLD_LOCAL = 0x00004; @JRubyConstant public static final int RTLD_GLOBAL = 0x00008;
public final boolean defineAnnotatedConstant(Field field) { JRubyConstant jrubyConstant = field.getAnnotation(JRubyConstant.class); if (jrubyConstant == null) return false; Class tp = field.getType(); IRubyObject realVal; try { if(tp == Integer.class || tp == Integer.TYPE || tp == Short.class || tp == Short.TYPE || tp == Byte.class || tp == Byte.TYPE) { realVal = RubyNumeric.int2fix(getRuntime(), field.getInt(null)); } else if(tp == Boolean.class || tp == Boolean.TYPE) { realVal = field.getBoolean(null) ? getRuntime().getTrue() : getRuntime().getFalse(); } else { realVal = getRuntime().getNil(); } } catch(Exception e) { realVal = getRuntime().getNil(); } String[] names = jrubyConstant.value(); if (names.length == 0) { setConstant(field.getName(), realVal); } else { for (String name : names) setConstant(name, realVal); } return true; }
@JRubyClass(name = "FFI::DynamicLibrary", parent = "Object") public class DynamicLibrary extends RubyObject { @JRubyConstant public static final int RTLD_LAZY = 0x00001; @JRubyConstant public static final int RTLD_NOW = 0x00002; @JRubyConstant public static final int RTLD_LOCAL = 0x00004; @JRubyConstant public static final int RTLD_GLOBAL = 0x00008;
public final boolean defineAnnotatedConstant(Field field) { JRubyConstant jrubyConstant = field.getAnnotation(JRubyConstant.class); if (jrubyConstant == null) return false; Class tp = field.getType(); IRubyObject realVal; try { if(tp == Integer.class || tp == Integer.TYPE || tp == Short.class || tp == Short.TYPE || tp == Byte.class || tp == Byte.TYPE) { realVal = RubyNumeric.int2fix(getRuntime(), field.getInt(null)); } else if(tp == Boolean.class || tp == Boolean.TYPE) { realVal = field.getBoolean(null) ? getRuntime().getTrue() : getRuntime().getFalse(); } else { realVal = getRuntime().getNil(); } } catch(Exception e) { realVal = getRuntime().getNil(); } String[] names = jrubyConstant.value(); if (names.length == 0) { setConstant(field.getName(), realVal); } else { for (String name : names) setConstant(name, realVal); } return true; }
@JRubyClass(name = "FFI::DynamicLibrary", parent = "Object") public class DynamicLibrary extends RubyObject { @JRubyConstant public static final int RTLD_LAZY = 0x00001; @JRubyConstant public static final int RTLD_NOW = 0x00002; @JRubyConstant public static final int RTLD_LOCAL = 0x00004; @JRubyConstant public static final int RTLD_GLOBAL = 0x00008;
private CharsetTranscoder transcoder; @JRubyConstant public static final int INVALID_MASK = EncodingUtils.ECONV_INVALID_MASK; @JRubyConstant public static final int INVALID_REPLACE = EncodingUtils.ECONV_INVALID_REPLACE; @JRubyConstant public static final int UNDEF_MASK = EncodingUtils.ECONV_UNDEF_MASK; @JRubyConstant public static final int UNDEF_REPLACE = EncodingUtils.ECONV_UNDEF_REPLACE; @JRubyConstant public static final int UNDEF_HEX_CHARREF = EncodingUtils.ECONV_UNDEF_HEX_CHARREF; @JRubyConstant public static final int PARTIAL_INPUT = EncodingUtils.ECONV_PARTIAL_INPUT; @JRubyConstant public static final int AFTER_OUTPUT = EncodingUtils.ECONV_AFTER_OUTPUT; @JRubyConstant public static final int UNIVERSAL_NEWLINE_DECORATOR = EncodingUtils.ECONV_UNIVERSAL_NEWLINE_DECORATOR; @JRubyConstant public static final int CRLF_NEWLINE_DECORATOR = EncodingUtils.ECONV_CRLF_NEWLINE_DECORATOR; @JRubyConstant public static final int CR_NEWLINE_DECORATOR = EncodingUtils.ECONV_CR_NEWLINE_DECORATOR; @JRubyConstant public static final int XML_TEXT_DECORATOR = EncodingUtils.ECONV_XML_TEXT_DECORATOR; @JRubyConstant public static final int XML_ATTR_CONTENT_DECORATOR = EncodingUtils.ECONV_XML_ATTR_CONTENT_DECORATOR; @JRubyConstant public static final int XML_ATTR_QUOTE_DECORATOR = EncodingUtils.ECONV_XML_ATTR_QUOTE_DECORATOR;
private CharsetTranscoder transcoder; @JRubyConstant public static final int INVALID_MASK = EncodingUtils.ECONV_INVALID_MASK; @JRubyConstant public static final int INVALID_REPLACE = EncodingUtils.ECONV_INVALID_REPLACE; @JRubyConstant public static final int UNDEF_MASK = EncodingUtils.ECONV_UNDEF_MASK; @JRubyConstant public static final int UNDEF_REPLACE = EncodingUtils.ECONV_UNDEF_REPLACE; @JRubyConstant public static final int UNDEF_HEX_CHARREF = EncodingUtils.ECONV_UNDEF_HEX_CHARREF; @JRubyConstant public static final int PARTIAL_INPUT = EncodingUtils.ECONV_PARTIAL_INPUT; @JRubyConstant public static final int AFTER_OUTPUT = EncodingUtils.ECONV_AFTER_OUTPUT; @JRubyConstant public static final int UNIVERSAL_NEWLINE_DECORATOR = EncodingUtils.ECONV_UNIVERSAL_NEWLINE_DECORATOR; @JRubyConstant public static final int CRLF_NEWLINE_DECORATOR = EncodingUtils.ECONV_CRLF_NEWLINE_DECORATOR; @JRubyConstant public static final int CR_NEWLINE_DECORATOR = EncodingUtils.ECONV_CR_NEWLINE_DECORATOR; @JRubyConstant public static final int XML_TEXT_DECORATOR = EncodingUtils.ECONV_XML_TEXT_DECORATOR; @JRubyConstant public static final int XML_ATTR_CONTENT_DECORATOR = EncodingUtils.ECONV_XML_ATTR_CONTENT_DECORATOR; @JRubyConstant public static final int XML_ATTR_QUOTE_DECORATOR = EncodingUtils.ECONV_XML_ATTR_QUOTE_DECORATOR;
private EConv ec; @JRubyConstant public static final int INVALID_MASK = EConvFlags.INVALID_MASK; @JRubyConstant public static final int INVALID_REPLACE = EConvFlags.INVALID_REPLACE; @JRubyConstant public static final int UNDEF_MASK = EConvFlags.UNDEF_MASK; @JRubyConstant public static final int UNDEF_REPLACE = EConvFlags.UNDEF_REPLACE; @JRubyConstant public static final int UNDEF_HEX_CHARREF = EConvFlags.UNDEF_HEX_CHARREF; @JRubyConstant public static final int PARTIAL_INPUT = EConvFlags.PARTIAL_INPUT; @JRubyConstant public static final int AFTER_OUTPUT = EConvFlags.AFTER_OUTPUT; @JRubyConstant public static final int UNIVERSAL_NEWLINE_DECORATOR = EConvFlags.UNIVERSAL_NEWLINE_DECORATOR; @JRubyConstant public static final int CRLF_NEWLINE_DECORATOR = EConvFlags.CRLF_NEWLINE_DECORATOR; @JRubyConstant public static final int CR_NEWLINE_DECORATOR = EConvFlags.CR_NEWLINE_DECORATOR; @JRubyConstant public static final int XML_TEXT_DECORATOR = EConvFlags.XML_TEXT_DECORATOR; @JRubyConstant public static final int XML_ATTR_CONTENT_DECORATOR = EConvFlags.XML_ATTR_CONTENT_DECORATOR; @JRubyConstant public static final int XML_ATTR_QUOTE_DECORATOR = EConvFlags.XML_ATTR_QUOTE_DECORATOR;
private EConv ec; @JRubyConstant public static final int INVALID_MASK = EConvFlags.INVALID_MASK; @JRubyConstant public static final int INVALID_REPLACE = EConvFlags.INVALID_REPLACE; @JRubyConstant public static final int UNDEF_MASK = EConvFlags.UNDEF_MASK; @JRubyConstant public static final int UNDEF_REPLACE = EConvFlags.UNDEF_REPLACE; @JRubyConstant public static final int UNDEF_HEX_CHARREF = EConvFlags.UNDEF_HEX_CHARREF; @JRubyConstant public static final int PARTIAL_INPUT = EConvFlags.PARTIAL_INPUT; @JRubyConstant public static final int AFTER_OUTPUT = EConvFlags.AFTER_OUTPUT; @JRubyConstant public static final int UNIVERSAL_NEWLINE_DECORATOR = EConvFlags.UNIVERSAL_NEWLINE_DECORATOR; @JRubyConstant public static final int CRLF_NEWLINE_DECORATOR = EConvFlags.CRLF_NEWLINE_DECORATOR; @JRubyConstant public static final int CR_NEWLINE_DECORATOR = EConvFlags.CR_NEWLINE_DECORATOR; @JRubyConstant public static final int XML_TEXT_DECORATOR = EConvFlags.XML_TEXT_DECORATOR; @JRubyConstant public static final int XML_ATTR_CONTENT_DECORATOR = EConvFlags.XML_ATTR_CONTENT_DECORATOR; @JRubyConstant public static final int XML_ATTR_QUOTE_DECORATOR = EConvFlags.XML_ATTR_QUOTE_DECORATOR;
@JRubyConstant public final static int ROUND_DOWN = BigDecimal.ROUND_DOWN; @JRubyConstant public final static int ROUND_CEILING = BigDecimal.ROUND_CEILING; @JRubyConstant public final static int ROUND_UP = BigDecimal.ROUND_UP; @JRubyConstant public final static int ROUND_HALF_DOWN = BigDecimal.ROUND_HALF_DOWN; @JRubyConstant public final static int ROUND_HALF_EVEN = BigDecimal.ROUND_HALF_EVEN; @JRubyConstant public final static int ROUND_HALF_UP = BigDecimal.ROUND_HALF_UP; @JRubyConstant public final static int ROUND_FLOOR = BigDecimal.ROUND_FLOOR; @JRubyConstant public final static int SIGN_POSITIVE_INFINITE = 3; @JRubyConstant public final static int SIGN_POSITIVE_ZERO = 1; @JRubyConstant public final static int SIGN_NEGATIVE_FINITE = -2; @JRubyConstant public final static int SIGN_NaN = 0; @JRubyConstant public final static int BASE = 10000; @JRubyConstant public final static int ROUND_MODE = 256; @JRubyConstant public final static int SIGN_POSITIVE_FINITE = 2;
@JRubyConstant public final static int ROUND_DOWN = BigDecimal.ROUND_DOWN; @JRubyConstant public final static int ROUND_CEILING = BigDecimal.ROUND_CEILING; @JRubyConstant public final static int ROUND_UP = BigDecimal.ROUND_UP; @JRubyConstant public final static int ROUND_HALF_DOWN = BigDecimal.ROUND_HALF_DOWN; @JRubyConstant public final static int ROUND_HALF_EVEN = BigDecimal.ROUND_HALF_EVEN; @JRubyConstant public final static int ROUND_HALF_UP = BigDecimal.ROUND_HALF_UP; @JRubyConstant public final static int ROUND_FLOOR = BigDecimal.ROUND_FLOOR; @JRubyConstant public final static int SIGN_POSITIVE_INFINITE = 3; @JRubyConstant public final static int SIGN_POSITIVE_ZERO = 1; @JRubyConstant public final static int SIGN_NEGATIVE_FINITE = -2; @JRubyConstant public final static int SIGN_NaN = 0; @JRubyConstant public final static int BASE = 10000; @JRubyConstant public final static int ROUND_MODE = 256; @JRubyConstant public final static int SIGN_POSITIVE_FINITE = 2;
@JRubyConstant public final static int ROUND_DOWN = BigDecimal.ROUND_DOWN; @JRubyConstant public final static int ROUND_CEILING = BigDecimal.ROUND_CEILING; @JRubyConstant public final static int ROUND_UP = BigDecimal.ROUND_UP; @JRubyConstant public final static int ROUND_HALF_DOWN = BigDecimal.ROUND_HALF_DOWN; @JRubyConstant public final static int ROUND_HALF_EVEN = BigDecimal.ROUND_HALF_EVEN; @JRubyConstant public final static int ROUND_HALF_UP = BigDecimal.ROUND_HALF_UP; @JRubyConstant public final static int ROUND_FLOOR = BigDecimal.ROUND_FLOOR; @JRubyConstant public final static int SIGN_POSITIVE_INFINITE = 3; @JRubyConstant public final static int EXCEPTION_OVERFLOW = 8; @JRubyConstant public final static int SIGN_POSITIVE_ZERO = 1; @JRubyConstant public final static int EXCEPTION_ALL = 255; @JRubyConstant public final static int SIGN_NEGATIVE_FINITE = -2; @JRubyConstant public final static int EXCEPTION_UNDERFLOW = 4; @JRubyConstant public final static int SIGN_NaN = 0;
@JRubyConstant public final static int ROUND_DOWN = BigDecimal.ROUND_DOWN; @JRubyConstant public final static int ROUND_CEILING = BigDecimal.ROUND_CEILING; @JRubyConstant public final static int ROUND_UP = BigDecimal.ROUND_UP; @JRubyConstant public final static int ROUND_HALF_DOWN = BigDecimal.ROUND_HALF_DOWN; @JRubyConstant public final static int ROUND_HALF_EVEN = BigDecimal.ROUND_HALF_EVEN; @JRubyConstant public final static int ROUND_HALF_UP = BigDecimal.ROUND_HALF_UP; @JRubyConstant public final static int ROUND_FLOOR = BigDecimal.ROUND_FLOOR; @JRubyConstant public final static int SIGN_POSITIVE_INFINITE = 3; @JRubyConstant public final static int EXCEPTION_OVERFLOW = 8; @JRubyConstant public final static int SIGN_POSITIVE_ZERO = 1; @JRubyConstant public final static int EXCEPTION_ALL = 255; @JRubyConstant public final static int SIGN_NEGATIVE_FINITE = -2; @JRubyConstant public final static int EXCEPTION_UNDERFLOW = 4; @JRubyConstant public final static int SIGN_NaN = 0;