try { if (nmode != nil || opt != nil) { ConvConfig convconfig = new ConvConfig(); Object vmode_vperm = vmodeVperm(nmode, null); int[] fmode_p = {0};
public void setEncoding(ThreadContext context, IRubyObject v1, IRubyObject v2, IRubyObject opt) { IOEncodable.ConvConfig holder = new IOEncodable.ConvConfig(); int ecflags = this.ecflags; IRubyObject[] ecopts_p = {context.nil}; EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { if (v1.isNil()) { EncodingUtils.ioExtIntToEncs(context, holder, null, null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecopts_p[0] = context.nil; } else { if (!tmp.isNil() && EncodingUtils.encAsciicompat(EncodingUtils.encGet(context, tmp))) { EncodingUtils.parseModeEncoding(context, holder, tmp.asJavaString(), null); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { EncodingUtils.ioExtIntToEncs(context, holder, EncodingUtils.rbToEncoding(context, v1), null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags);
fptr.setMode(fmode | (OpenFile.SYNC|OpenFile.DUPLEX)); if (convconfig != null) { fptr.encs.copy(convconfig); if (Platform.IS_WINDOWS) { // #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32) if ((fptr.encs.ecflags & EncodingUtils.ECONV_DEFAULT_NEWLINE_DECORATOR) != 0) {
fptr.setMode(fmode | (OpenFile.SYNC|OpenFile.DUPLEX)); if (convconfig != null) { fptr.encs.copy(convconfig); if (Platform.IS_WINDOWS) { // #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32) if ((fptr.encs.ecflags & EncodingUtils.ECONV_DEFAULT_NEWLINE_DECORATOR) != 0) {
try { if (nmode != nil || opt != nil) { ConvConfig convconfig = new ConvConfig(); Object vmode_vperm = vmodeVperm(nmode, null); int[] fmode_p = {0};
ExecArg eargp; int[] oflags_p = {0}, fmode_p = {0}; IOEncodable.ConvConfig convconfig = new IOEncodable.ConvConfig(); int argc = argv.length;
ExecArg eargp; int[] oflags_p = {0}, fmode_p = {0}; IOEncodable.ConvConfig convconfig = new IOEncodable.ConvConfig(); int argc = argv.length;
public void setEncoding(ThreadContext context, IRubyObject v1, IRubyObject v2, IRubyObject opt) { IOEncodable.ConvConfig holder = new IOEncodable.ConvConfig(); int ecflags = this.ecflags; IRubyObject[] ecopts_p = {context.nil}; EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { if (v1.isNil()) { EncodingUtils.ioExtIntToEncs(context, holder, null, null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecopts_p[0] = context.nil; } else { if (!tmp.isNil() && EncodingUtils.encAsciicompat(EncodingUtils.encGet(context, tmp))) { EncodingUtils.parseModeEncoding(context, holder, tmp.asJavaString(), null); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { EncodingUtils.ioExtIntToEncs(context, holder, EncodingUtils.rbToEncoding(context, v1), null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags);
public void setEncoding(ThreadContext context, IRubyObject v1, IRubyObject v2, IRubyObject opt) { final IRubyObject nil = context.nil; IOEncodable.ConvConfig holder = new IOEncodable.ConvConfig(); int ecflags = openFile.encs.ecflags; IRubyObject[] ecopts_p = { nil }; EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { if (v1.isNil()) { EncodingUtils.ioExtIntToEncs(context, holder, null, null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecopts_p[0] = context.nil; } else { if (tmp != nil && EncodingUtils.encAsciicompat(EncodingUtils.encGet(context, tmp))) { EncodingUtils.parseModeEncoding(context, holder, tmp.asJavaString(), null); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { EncodingUtils.ioExtIntToEncs(context, holder, EncodingUtils.rbToEncoding(context, v1), null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags);
ConvConfig convconfig = new ConvConfig(); EncodingUtils.extractModeEncoding(context, convconfig, pm, opt, oflags_p, fmode_p);
public void setEncoding(ThreadContext context, IRubyObject v1, IRubyObject v2, IRubyObject opt) { final IRubyObject nil = context.nil; IOEncodable.ConvConfig holder = new IOEncodable.ConvConfig(); int ecflags = openFile.encs.ecflags; IRubyObject[] ecopts_p = { nil }; EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { if (v1.isNil()) { EncodingUtils.ioExtIntToEncs(context, holder, null, null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecopts_p[0] = context.nil; } else { if (tmp != nil && EncodingUtils.encAsciicompat(EncodingUtils.encGet(context, tmp))) { EncodingUtils.parseModeEncoding(context, holder, tmp.asJavaString(), null); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags); ecflags = EncodingUtils.econvPrepareOptions(context, opt, ecopts_p, ecflags); } else { EncodingUtils.ioExtIntToEncs(context, holder, EncodingUtils.rbToEncoding(context, v1), null, 0); EncodingUtils.SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(holder.getEnc2(), ecflags);
ConvConfig convconfig = new ConvConfig(); EncodingUtils.extractModeEncoding(context, convconfig, pm, opt, oflags_p, fmode_p);
IOEncodable convconfig = new ConvConfig(); EncodingUtils.extractModeEncoding(context, convconfig, pm, options, oflags_p, fmode_p); int perm = (vperm(pm) != null && !vperm(pm).isNil()) ?
IOEncodable convconfig = new ConvConfig(); EncodingUtils.extractModeEncoding(context, convconfig, pm, options, oflags_p, fmode_p); int perm = (vperm(pm) != null && !vperm(pm).isNil()) ?
IRubyObject length, offset; length = offset = context.nil; IOEncodable convconfig = new IOEncodable.ConvConfig();
IRubyObject length, offset; length = offset = context.nil; IOEncodable convconfig = new IOEncodable.ConvConfig();
public IRubyObject fileOpenGeneric(ThreadContext context, IRubyObject filename, int oflags, int fmode, IOEncodable convConfig, int perm) { if (convConfig == null) { convConfig = new ConvConfig(); EncodingUtils.ioExtIntToEncs(context, convConfig, null, null, fmode); convConfig.setEcflags(0); convConfig.setEcopts(context.nil); } int[] fmode_p = {fmode}; EncodingUtils.validateEncodingBinmode(context, fmode_p, convConfig.getEcflags(), convConfig); OpenFile fptr = MakeOpenFile(); fptr.setMode(fmode_p[0]); fptr.encs.copy(convConfig); fptr.setPath(adjustRootPathOnWindows(context.runtime, RubyFile.get_path(context, filename).asJavaString(), getRuntime().getCurrentDirectory())); fptr.setFD(sysopen(context.runtime, fptr.getPath(), oflags, perm)); fptr.checkTTY(); if ((fmode_p[0] & OpenFile.SETENC_BY_BOM) != 0) { EncodingUtils.ioSetEncodingByBOM(context, this); } return this; }
public IRubyObject fileOpenGeneric(ThreadContext context, IRubyObject filename, int oflags, int fmode, IOEncodable convConfig, int perm) { if (convConfig == null) { convConfig = new ConvConfig(); EncodingUtils.ioExtIntToEncs(context, convConfig, null, null, fmode); convConfig.setEcflags(0); convConfig.setEcopts(context.nil); } int[] fmode_p = {fmode}; EncodingUtils.validateEncodingBinmode(context, fmode_p, convConfig.getEcflags(), convConfig); OpenFile fptr = MakeOpenFile(); fptr.setMode(fmode_p[0]); fptr.encs.copy(convConfig); fptr.setPath(adjustRootPathOnWindows(context.runtime, RubyFile.get_path(context, filename).asJavaString(), getRuntime().getCurrentDirectory())); fptr.setFD(sysopen(context.runtime, fptr.getPath(), oflags, perm)); fptr.checkTTY(); if ((fmode_p[0] & OpenFile.SETENC_BY_BOM) != 0) { EncodingUtils.ioSetEncodingByBOM(context, this); } return this; }
static RubyIO ioOpen(ThreadContext context, IRubyObject recv, RubyString filename, IRubyObject vmode, IRubyObject vperm, IRubyObject opt) { int[] oflags_p = {0}, fmode_p = {0}; ConvConfig convConfig = new ConvConfig(); Object pm = EncodingUtils.vmodeVperm(vmode, vperm); EncodingUtils.extractModeEncoding(context, convConfig, pm, opt, oflags_p, fmode_p); vperm = vperm(pm); int perm = (vperm == null || vperm == context.nil) ? 0666 : RubyNumeric.num2int(vperm); return ioOpenGeneric(context, recv, filename, oflags_p[0], fmode_p[0], convConfig, perm); }
static RubyIO ioOpen(ThreadContext context, IRubyObject recv, RubyString filename, IRubyObject vmode, IRubyObject vperm, IRubyObject opt) { int[] oflags_p = {0}, fmode_p = {0}; ConvConfig convConfig = new ConvConfig(); Object pm = EncodingUtils.vmodeVperm(vmode, vperm); EncodingUtils.extractModeEncoding(context, convConfig, pm, opt, oflags_p, fmode_p); vperm = vperm(pm); int perm = (vperm == null || vperm == context.nil) ? 0666 : RubyNumeric.num2int(vperm); return ioOpenGeneric(context, recv, filename, oflags_p[0], fmode_p[0], convConfig, perm); }