throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass()); throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass()); throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
private static IRubyObject getInternalVariable(RubyClass type, String internedName) { RubyClass structClass = type.getRuntime().getStructClass(); IRubyObject variable; while (type != null && type != structClass) { if ((variable = (IRubyObject)type.getInternalVariable(internedName)) != null) { return variable; } type = type.getSuperClass(); } return type.getRuntime().getNil(); }
throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass()); throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass()); throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass()); throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass()); throw runtime.newTypeError(runtime.getNil(), runtime.getStructClass());
public static RubyStruct unmarshalFrom(UnmarshalStream input) throws java.io.IOException { final Ruby runtime = input.getRuntime(); RubySymbol className = (RubySymbol) input.unmarshalObject(false); RubyClass rbClass = pathToClass(runtime, className.asJavaString()); if (rbClass == null) { throw runtime.newNameError(UNINITIALIZED_CONSTANT, runtime.getStructClass(), className); } final RubyArray member = __member__(rbClass); final int len = input.unmarshalInt(); // FIXME: This could all be more efficient, but it's how struct works final RubyStruct result; // 1.9 does not appear to call initialize (JRUBY-5875) result = new RubyStruct(runtime, rbClass); input.registerLinkTarget(result); for (int i = 0; i < len; i++) { IRubyObject slot = input.unmarshalObject(false); final IRubyObject elem = member.eltInternal(i); // RubySymbol if ( ! elem.toString().equals( slot.toString() ) ) { throw runtime.newTypeError("struct " + rbClass.getName() + " not compatible (:" + slot + " for :" + elem + ")"); } result.aset(i, input.unmarshalObject()); } return result; }
public static RubyStruct unmarshalFrom(UnmarshalStream input) throws java.io.IOException { final Ruby runtime = input.getRuntime(); RubySymbol className = (RubySymbol) input.unmarshalObject(false); RubyClass rbClass = pathToClass(runtime, className.asJavaString()); if (rbClass == null) { throw runtime.newNameError(UNINITIALIZED_CONSTANT, runtime.getStructClass(), className); } final RubyArray member = __member__(rbClass); final int len = input.unmarshalInt(); // FIXME: This could all be more efficient, but it's how struct works final RubyStruct result; // 1.9 does not appear to call initialize (JRUBY-5875) result = new RubyStruct(runtime, rbClass); input.registerLinkTarget(result); for (int i = 0; i < len; i++) { IRubyObject slot = input.unmarshalObject(false); final IRubyObject elem = member.eltInternal(i); // RubySymbol if ( ! elem.toString().equals( slot.toString() ) ) { throw runtime.newTypeError("struct " + rbClass.getName() + " not compatible (:" + slot + " for :" + elem + ")"); } result.aset(i, input.unmarshalObject()); } return result; }
private static void defineGroupStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Group"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("gid"), runtime.newSymbol("mem") }; runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); runtime.getEtc().defineConstant("Group", runtime.getGroupStruct()); }
private static void defineGroupStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Group"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("gid"), runtime.newSymbol("mem") }; runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); runtime.getEtc().defineConstant("Group", runtime.getGroupStruct()); }
private static void defineGroupStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Group"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("gid"), runtime.newSymbol("mem") }; runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); if (runtime.is1_9()) { runtime.getEtc().defineConstant("Group", runtime.getGroupStruct()); } }
private static void defineGroupStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Group"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("gid"), runtime.newSymbol("mem") }; runtime.setGroupStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); if (runtime.is1_9()) { runtime.getEtc().defineConstant("Group", runtime.getGroupStruct()); } }
private static void definePasswdStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Passwd"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("uid"), runtime.newSymbol("gid"), runtime.newSymbol("gecos"), runtime.newSymbol("dir"), runtime.newSymbol("shell"), runtime.newSymbol("change"), runtime.newSymbol("uclass"), runtime.newSymbol("expire") }; runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); if (runtime.is1_9()) { runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct()); } }
private static void definePasswdStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Passwd"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("uid"), runtime.newSymbol("gid"), runtime.newSymbol("gecos"), runtime.newSymbol("dir"), runtime.newSymbol("shell"), runtime.newSymbol("change"), runtime.newSymbol("uclass"), runtime.newSymbol("expire") }; runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); if (runtime.is1_9()) { runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct()); } }
private static void definePasswdStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Passwd"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("uid"), runtime.newSymbol("gid"), runtime.newSymbol("gecos"), runtime.newSymbol("dir"), runtime.newSymbol("shell"), runtime.newSymbol("change"), runtime.newSymbol("uclass"), runtime.newSymbol("expire") }; runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct()); }
private static void definePasswdStruct(Ruby runtime) { IRubyObject[] args = new IRubyObject[] { runtime.newString("Passwd"), runtime.newSymbol("name"), runtime.newSymbol("passwd"), runtime.newSymbol("uid"), runtime.newSymbol("gid"), runtime.newSymbol("gecos"), runtime.newSymbol("dir"), runtime.newSymbol("shell"), runtime.newSymbol("change"), runtime.newSymbol("uclass"), runtime.newSymbol("expire") }; runtime.setPasswdStruct(RubyStruct.newInstance(runtime.getStructClass(), args, Block.NULL_BLOCK)); runtime.getEtc().defineConstant("Passwd", runtime.getPasswdStruct()); }
runtime.getStructClass(), new IRubyObject[]{ runtime.newString("Tms"),
runtime.getStructClass(), new IRubyObject[]{ runtime.newString("Tms"),