Package org.jruby

Examples of org.jruby.RubyArray.entry()


                RubyModule pathHelper = runtime.getClassFromPath("JRuby::PathHelper");
                RubyArray parts = (RubyArray) RuntimeHelpers.invoke(
                                                                    context, pathHelper, "smart_split_command", rawArgs);
                args = new String[parts.getLength()];
                for (int i = 0; i < parts.getLength(); i++) {
                    args[i] = parts.entry(i).toString();
                }
            }
        } else {
            args = new String[rawArgs.length];
            int start = 0;
View Full Code Here


                }
               
                for (int i = 0; i < count; ++i) {
                    op.put(context, memory,
                            m.offset + (i * arrayType.getComponentType().getNativeSize()),
                            ary.entry(i));
                }
            } else {
                throw context.runtime.newNotImplementedError("cannot set array field");
            }
        }
View Full Code Here

        Object val;
       
        int n = rubyArray.getLength();
        if (preArgsCount == -1) {
            // Masgn for 1.8 and 1.9 pre-reqd. args always comes down this path!
            return rubyArray.entry(index);
        } else {
            // Masgn for 1.9 post-reqd args always come down this path
            int remaining = n - preArgsCount;
            if (remaining <= index) {
                return context.nil;
View Full Code Here

            // Masgn for 1.9 post-reqd args always come down this path
            int remaining = n - preArgsCount;
            if (remaining <= index) {
                return context.nil;
            } else {
                return (remaining > postArgsCount) ? rubyArray.entry(n - postArgsCount + index) : rubyArray.entry(preArgsCount + index);
            }
        }
    }

    @Override
View Full Code Here

            // Masgn for 1.9 post-reqd args always come down this path
            int remaining = n - preArgsCount;
            if (remaining <= index) {
                return context.nil;
            } else {
                return (remaining > postArgsCount) ? rubyArray.entry(n - postArgsCount + index) : rubyArray.entry(preArgsCount + index);
            }
        }
    }

    @Override
View Full Code Here

        // ENEBO: Can I assume since IR figured this is an internal array it will be RubyArray like this?
        RubyArray rubyArray = (RubyArray) array.retrieve(context, self, currDynScope, temp);
        Object val;
       
        int n = rubyArray.getLength();
      return minArgsLength <= n ? rubyArray.entry(index) : UndefinedValue.UNDEFINED;
    }

    @Override
    public void visit(IRVisitor visitor) {
        visitor.OptArgMultipleAsgnInstr(this);
View Full Code Here

        RubyArray arr = aryArg.convertToArray();
        int len = arr.size();

        for (int i = 0, off = 0; i < len; i++, off += type.size) {
            op.put(context, getMemoryIO(), off, arr.entry(i));
        }

        return this;
    }
View Full Code Here

        final RubyArray arr = (RubyArray) arrParam;
        final int count = arr.getLength();

        long off = getOffset(offset);
        for (int i = 0; i < count; ++i) {
            putPointer(context, off + (i * POINTER_SIZE), arr.entry(i));
        }
        return this;
    }
   
    @JRubyMethod(name = { "read_array_of_pointer" }, required = 1)
View Full Code Here

            convention = args[3].asJavaString();
        }

        Type[] parameterTypes = new Type[paramTypes.size()];
        for (int i = 0; i < parameterTypes.length; ++i) {
            IRubyObject type = paramTypes.entry(i);
            if (!(type instanceof Type)) {
                throw context.runtime.newArgumentError("Invalid parameter type");
            }
            parameterTypes[i] = (Type) paramTypes.entry(i);
        }
View Full Code Here

        for (int i = 0; i < parameterTypes.length; ++i) {
            IRubyObject type = paramTypes.entry(i);
            if (!(type instanceof Type)) {
                throw context.runtime.newArgumentError("Invalid parameter type");
            }
            parameterTypes[i] = (Type) paramTypes.entry(i);
        }
        DirectMemoryIO fptr = (DirectMemoryIO) ptr.getMemoryIO();
        return new JFFIInvoker(context.runtime, (RubyClass) recv, fptr,
                (Type) returnType, parameterTypes,
                "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.