bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
public void testImageThumbnailExplodsOnHessianSerialization() { HierarchyBrowsing hb = (HierarchyBrowsing) applicationContext.getBean("hierarchyBrowsingService"); Set imgIds = new HashSet(); imgIds.add(new Integer(1191)); imgIds.add(new Integer(4665)); imgIds.add(new Integer(1304)); imgIds.add(new Integer(4977)); imgIds.add(new Integer(3540)); imgIds.add(new Integer(2064)); Set result = hb.findPDIHierarchies(imgIds); Set test = Utils.getImagesinPID(result); assertTrue("Images in should eq. images out",imgIds.size()==test.size()); }
|
public void testImageThumbnailExplodsOnHessianSerialization() { Set imgIds = new HashSet(); imgIds.add(new Integer(1191)); imgIds.add(new Integer(4665)); imgIds.add(new Integer(1304)); imgIds.add(new Integer(4977)); imgIds.add(new Integer(3540)); imgIds.add(new Integer(2064)); Set result = hb.findPDIHierarchies(imgIds); Set test = Utils.getImagesinPID(result); assertTrue("Images in should eq. images out",imgIds.size()==test.size()); }
| 3,237,683
|
public void perform(WikiSystem wiki, WebContext wc, WikiUser user, WikiPage page) throws PageActionException { String pageName = wc.getForm ("jump"); pageName = WikiUtil.guessWikiTitle(pageName, wiki); if (!wiki.containsPage(pageName)) throw new PageActionException ("That page does not exist"); throw new RedirectException (pageName); }
|
public void perform(WikiSystem wiki, WebContext wc, WikiUser user, WikiPage page) throws PageActionException { String pageName = wc.getForm ("jump"); pageName = WikiUtil.guessWikiTitle(pageName, wiki); if (!wiki.containsPage(pageName)) throw new PageActionException ("That page does not exist"); throw new RedirectException (pageName); }
| 3,237,685
|
private void selectAll(boolean b) { TableComponent table = view.table; Boolean obj = Boolean.FALSE; if (b) obj = Boolean.TRUE; for (int i = 0; i < table.getRowCount(); i++) table.setValueAt(obj, i, ContextPane.BOOLEAN); }
|
private void selectAll(boolean b) { TableComponent table = view.table; Boolean obj = Boolean.FALSE; if (b) obj = Boolean.TRUE; for (int i = 0; i < table.getRowCount(); i++) table.setValueAt(obj, i, ContextDialog.BOOLEAN); }
| 3,237,686
|
public void stateChanged(ChangeEvent ce) { Object source = ce.getSource(); if (source instanceof HiViewer) { HiViewer parentModel = model.getParentModel(); if (parentModel.getState() == HiViewer.READY) { parentModel.getBrowser().addPropertyChangeListener( Browser.SELECTED_DISPLAY_PROPERTY, this); parentModel.getBrowser().addPropertyChangeListener( Browser.MOUSE_OVER_PROPERTY, this); view.initListeners(); } } else if (source instanceof ClipBoard) { switch (model.getState()) { //We don't know how long the call is going to take so set to // indeterminate case ClipBoard.EDIT_ANNOTATIONS: model.getParentModel().setStatus(EDIT_MSG, -1); break; case ClipBoard.LOADING_CLASSIFICATIONS: case ClipBoard.LOADING_ANNOTATIONS: case ClipBoard.LOADING_CHANNELS_METADATA: model.getParentModel().setStatus(LOADING_MSG, -1); break; case ClipBoard.READY: case ClipBoard.ANNOTATIONS_READY: case ClipBoard.CLASSIFICATIONS_READY: case ClipBoard.DISCARDED_ANNOTATIONS: model.getParentModel().setStatus("", -1); break; } } }
|
public void stateChanged(ChangeEvent ce) { Object source = ce.getSource(); if (source instanceof HiViewer) { HiViewer parentModel = model.getParentModel(); if (parentModel.getState() == HiViewer.READY) { parentModel.getBrowser().addPropertyChangeListener( Browser.SELECTED_DISPLAY_PROPERTY, this); parentModel.getBrowser().addPropertyChangeListener( Browser.MOUSE_OVER_PROPERTY, this); } } else if (source instanceof ClipBoard) { switch (model.getState()) { //We don't know how long the call is going to take so set to // indeterminate case ClipBoard.EDIT_ANNOTATIONS: model.getParentModel().setStatus(EDIT_MSG, -1); break; case ClipBoard.LOADING_CLASSIFICATIONS: case ClipBoard.LOADING_ANNOTATIONS: case ClipBoard.LOADING_CHANNELS_METADATA: model.getParentModel().setStatus(LOADING_MSG, -1); break; case ClipBoard.READY: case ClipBoard.ANNOTATIONS_READY: case ClipBoard.CLASSIFICATIONS_READY: case ClipBoard.DISCARDED_ANNOTATIONS: model.getParentModel().setStatus("", -1); break; } } }
| 3,237,688
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
| 3,237,689
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
| 3,237,690
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
| 3,237,691
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
| 3,237,692
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
| 3,237,693
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
| 3,237,694
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
|
protected boolean nextArgsFile() { RubyArray args = (RubyArray)runtime.getGlobalVar("$*"); if (!init_p) { if (args.getLength() > 0) { next_p = 1; } else { next_p = -1; currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue("-"); } init_p = true; first_p = false; currentLineNumber = 0; } // retry : while (true) { if (next_p == 1) { next_p = 0; if (args.getLength() > 0) { String filename = ((RubyString) args.shift()).getValue(); ((RubyString) runtime.getGlobalVar("$FILENAME")).setValue(filename); if (filename.equals("-")) { currentFile = (RubyIO) runtime.getGlobalVar("$stdin"); /*if (ruby_inplace_mode) { rb_warn("Can't do inplace edit for stdio"); rb_defout = rb_stdout; }*/ } else { File file = new File(filename); try { RubyInputStream inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); // FILE *fr = rb_fopen(fn, "r"); /*if (ruby_inplace_mode) { struct stat st, st2; VALUE str; FILE *fw; if (TYPE(rb_defout) == T_FILE && rb_defout != rb_stdout) { rb_io_close(rb_defout); } fstat(fileno(fr), &st); if (*ruby_inplace_mode) { str = rb_str_new2(fn); #ifdef NO_LONG_FNAME ruby_add_suffix(str, ruby_inplace_mode); #else rb_str_cat2(str, ruby_inplace_mode); #endif #ifdef NO_SAFE_RENAME (void)fclose(fr); (void)unlink(RSTRING(str)->ptr); (void)rename(fn, RSTRING(str)->ptr); fr = rb_fopen(RSTRING(str)->ptr, "r"); #else if (rename(fn, RSTRING(str)->ptr) < 0) { rb_warn("Can't rename %s to %s: %s, skipping file", fn, RSTRING(str)->ptr, strerror(errno)); fclose(fr); goto retry; } #endif } else { #ifdef NO_SAFE_RENAME rb_fatal("Can't do inplace edit without backup"); #else if (unlink(fn) < 0) { rb_warn("Can't remove %s: %s, skipping file", fn, strerror(errno)); fclose(fr); goto retry; } #endif } fw = rb_fopen(fn, "w"); #ifndef NO_SAFE_RENAME fstat(fileno(fw), &st2); #ifdef HAVE_FCHMOD fchmod(fileno(fw), st.st_mode); #else chmod(fn, st.st_mode); #endif if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) { fchown(fileno(fw), st.st_uid, st.st_gid); } #endif rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile); prep_path(rb_defout, fn); }*/ currentFile = new RubyFile(runtime, runtime.getClasses().getFileClass()); currentFile.initIO(inStream, null, filename); // prep_stdio(fr, FMODE_READABLE, rb_cFile); // prep_path(current_file, fn); } catch (FileNotFoundException fnfExcptn) { throw new IOError(runtime, fnfExcptn.getMessage()); } } /*if (binmode) rb_io_binmode(current_file);*/ } else { init_p = false; return false; } } //break; //} return true; }
| 3,237,695
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); RosterEntry entry = roster.getEntry(participantJID); tabIcon = SparkManager.getUserManager().getTabIconForPresence(presence); PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText(Res.getString("message.view.information.about.this.user")); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText(Res.getString("message.add.this.user.to.your.roster")); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { if (!sendTypingNotification) { return; } long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); lastActivity = System.currentTimeMillis(); String time = formatter.format(new Date()); transcriptWindow.setInnerHTML("chatName", participantNickname); transcriptWindow.setInnerHTML("timeOpened", "Conversation started on " + time); URL url = SparkManager.getVCardManager().getAvatar(SparkManager.getSessionManager().getJID()); if (url != null) { transcriptWindow.setInnerHTML("incomingIconPath", "<img src=\"" + url.toExternalForm() + "\">"); } }
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); RosterEntry entry = roster.getEntry(participantJID); tabIcon = SparkManager.getUserManager().getTabIconForPresence(presence); PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText(Res.getString("message.view.information.about.this.user")); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText(Res.getString("message.add.this.user.to.your.roster")); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { if (!sendTypingNotification) { return; } long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); lastActivity = System.currentTimeMillis(); String time = formatter.format(new Date()); transcriptWindow.setInnerHTML("chatName", participantNickname); transcriptWindow.setInnerHTML("timeOpened", "Conversation started on " + time); URL url = SparkManager.getVCardManager().getAvatar(participantJID); if (url != null) { transcriptWindow.setInnerHTML("incomingIconPath", "<img src=\"" + url.toExternalForm() + "\">"); } }
| 3,237,696
|
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); return this; }
|
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); return this; }
| 3,237,697
|
private void createRoom() { ConferenceCreator mucRoomDialog = new ConferenceCreator(); final MultiUserChat groupChat = mucRoomDialog.createGroupChat(SparkManager.getMainWindow(), serviceName); final ChatPreferences pref = (ChatPreferences)SparkManager.getPreferenceManager().getPreferenceData(ChatPreference.NAMESPACE); if (null != groupChat) { // Join Room try { GroupChatRoom room = new GroupChatRoom(groupChat); chatManager.getChatContainer().addChatRoom(room); chatManager.getChatContainer().activateChatRoom(room); groupChat.create(pref.getNickname()); // Send Form Form form = groupChat.getConfigurationForm().createAnswerForm(); if (mucRoomDialog.isPasswordProtected()) { String password = mucRoomDialog.getPassword(); form.setAnswer("muc#roomconfig_passwordprotectedroom", true); form.setAnswer("muc#roomconfig_roomsecret", password); } form.setAnswer("muc#roomconfig_roomname", mucRoomDialog.getRoomName()); if (mucRoomDialog.isPermanent()) { form.setAnswer("muc#roomconfig_persistentroom", true); } List owners = new ArrayList(); owners.add(SparkManager.getSessionManager().getBareAddress()); form.setAnswer("muc#roomconfig_roomowners", owners); // new DataFormDialog(groupChat, form); groupChat.sendConfigurationForm(form); } catch (XMPPException e1) { Log.error("Error creating new room.", e1); } addRoomToTable(groupChat.getRoom(), StringUtils.parseName(groupChat.getRoom()), 1); } }
|
private void createRoom() { ConferenceCreator mucRoomDialog = new ConferenceCreator(); final MultiUserChat groupChat = mucRoomDialog.createGroupChat(SparkManager.getMainWindow(), serviceName); LocalPreferences pref = SettingsManager.getLocalPreferences(); if (null != groupChat) { // Join Room try { GroupChatRoom room = new GroupChatRoom(groupChat); chatManager.getChatContainer().addChatRoom(room); chatManager.getChatContainer().activateChatRoom(room); groupChat.create(pref.getNickname()); // Send Form Form form = groupChat.getConfigurationForm().createAnswerForm(); if (mucRoomDialog.isPasswordProtected()) { String password = mucRoomDialog.getPassword(); form.setAnswer("muc#roomconfig_passwordprotectedroom", true); form.setAnswer("muc#roomconfig_roomsecret", password); } form.setAnswer("muc#roomconfig_roomname", mucRoomDialog.getRoomName()); if (mucRoomDialog.isPermanent()) { form.setAnswer("muc#roomconfig_persistentroom", true); } List owners = new ArrayList(); owners.add(SparkManager.getSessionManager().getBareAddress()); form.setAnswer("muc#roomconfig_roomowners", owners); // new DataFormDialog(groupChat, form); groupChat.sendConfigurationForm(form); } catch (XMPPException e1) { Log.error("Error creating new room.", e1); } addRoomToTable(groupChat.getRoom(), StringUtils.parseName(groupChat.getRoom()), 1); } }
| 3,237,698
|
EqualCondition(Condition l, Condition r) { _l = l; _r = r; }
|
EqualCondition(Condition l, Condition r) { _l = l; _r = r; }
| 3,237,699
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
| 3,237,700
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lmacro && !rmacro) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
| 3,237,701
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
| 3,237,702
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
| 3,237,703
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Condition) r, l); } }
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); boolean lcond = (l instanceof Condition); boolean rcond = (r instanceof Condition); if (!lcond && !rcond) { if ((l == null) || (r == null)) { return (l == r) ? Boolean.TRUE : Boolean.FALSE; } else { return (l.equals(r)) ? Boolean.TRUE : Boolean.FALSE; } } if (lcond && rcond) { return new EqualCondition((Condition) l, (Condition) r); } if (lcond) { return new EqualConstantCondition((Condition) l, r); } else { return new EqualConstantCondition((Macro) r, l); } }
| 3,237,704
|
EqualConstantCondition(Condition l, Object r) { _l = l; _r = r; }
|
EqualConstantCondition(Condition l, Object r) { _l = l; _r = r; }
| 3,237,705
|
public final boolean test(Object context) { Object left; try { left = _l.evaluate(context); } catch (Exception e) { left = null; } if ((left == null) || (_r == null)) { return (left == _r); } return left.equals(_r); }
|
public final boolean test(Object context) { Object left; try { left = _l.evaluate(context); } catch (Exception e) { left = null; } if ((left == null) || (_r == null)) { return (left == _r); } return left.equals(_r); }
| 3,237,706
|
public void execute(EvaluationState state, InstructionContext ctx) { Colon2Node iVisited = (Colon2Node)ctx; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { state.setResult(state.runtime.getObject().getConstant(iVisited.getName())); } else { state.clearResult(); state.addInstruction(ctx, colon2NodeVisitor1); state.addNodeInstruction(iVisited.getLeftNode()); } }
|
public void execute(EvaluationState state, InstructionContext ctx) { Colon2Node iVisited = (Colon2Node)ctx; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { state.setResult(state.runtime.getObject().getConstantFrom(iVisited.getName())); } else { state.clearResult(); state.addInstruction(ctx, colon2NodeVisitor1); state.addNodeInstruction(iVisited.getLeftNode()); } }
| 3,237,707
|
public void execute(EvaluationState state, InstructionContext ctx) { Colon2Node iVisited = (Colon2Node)ctx; if (state.getResult() instanceof RubyModule) { state.setResult(((RubyModule) state.getResult()).getConstantAtOrConstantMissing(iVisited.getName())); } else { state.setResult(state.getResult().callMethod(iVisited.getName())); } }
|
public void execute(EvaluationState state, InstructionContext ctx) { Colon2Node iVisited = (Colon2Node)ctx; if (state.getResult() instanceof RubyModule) { state.setResult(((RubyModule) state.getResult()).getConstantFrom(iVisited.getName())); } else { state.setResult(state.getResult().callMethod(iVisited.getName())); } }
| 3,237,708
|
public void execute(EvaluationState state, InstructionContext ctx) { Colon3Node iVisited = (Colon3Node)ctx; state.setResult(state.runtime.getObject().getConstant(iVisited.getName())); }
|
public void execute(EvaluationState state, InstructionContext ctx) { Colon3Node iVisited = (Colon3Node)ctx; state.setResult(state.runtime.getObject().getConstantFrom(iVisited.getName())); }
| 3,237,709
|
public void execute(EvaluationState state, InstructionContext ctx) { ConstDeclNode iVisited = (ConstDeclNode)ctx; state.getThreadContext().getRubyClass().setConstant(iVisited.getName(), state.getResult()); }
|
public void execute(EvaluationState state, InstructionContext ctx) { ConstDeclNode iVisited = (ConstDeclNode)ctx; ((RubyModule)state.getThreadContext().peekCRef().getValue()).setConstant(iVisited.getName(), state.getResult()); }
| 3,237,710
|
public void execute(EvaluationState state, InstructionContext ctx) { ConstNode iVisited = (ConstNode)ctx; state.setResult(state.getThreadContext().getRubyClass().getConstant(iVisited.getName())); }
|
public void execute(EvaluationState state, InstructionContext ctx) { ConstNode iVisited = (ConstNode)ctx; state.setResult(state.getThreadContext().getConstant(iVisited.getName())); }
| 3,237,711
|
public void execute(EvaluationState state, InstructionContext ctx) { DefnNode iVisited = (DefnNode)ctx; RubyModule containingClass = state.getThreadContext().getRubyClass(); if (containingClass == null) { throw state.runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == state.runtime.getObject() && name.equals("initialize")) { state.runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = state.getThreadContext().getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } else if (visibility.isPublic() && containingClass == state.runtime.getObject()) { visibility = iVisited.getVisibility(); } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, state.getThreadContext().getRubyClass()); iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); containingClass.addMethod(name, newMethod); if (state.getThreadContext().getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod(name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod("singleton_method_added", state.runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass)containingClass).getAttachedObject().callMethod("singleton_method_added", state.runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod("method_added", state.runtime.newSymbol(name)); } }
|
public void execute(EvaluationState state, InstructionContext ctx) { DefnNode iVisited = (DefnNode)ctx; RubyModule containingClass = state.getThreadContext().getRubyClass(); if (containingClass == null) { throw state.runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == state.runtime.getObject() && name.equals("initialize")) { state.runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = state.getThreadContext().getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } else if (visibility.isPublic() && containingClass == state.runtime.getObject()) { visibility = iVisited.getVisibility(); } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, state.getThreadContext().peekCRef()); iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); containingClass.addMethod(name, newMethod); if (state.getThreadContext().getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod(name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod("singleton_method_added", state.runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass)containingClass).getAttachedObject().callMethod("singleton_method_added", state.runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod("method_added", state.runtime.newSymbol(name)); } }
| 3,237,712
|
public void execute(EvaluationState state, InstructionContext ctx) { DefsNode iVisited = (DefsNode)ctx; IRubyObject receiver = state.begin(iVisited.getReceiverNode()); if (state.runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw state.runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw state.runtime.newFrozenError("object"); } if (! receiver.singletonMethodsAllowed()) { throw state.runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (state.runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw state.runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, state.getThreadContext().getRubyClass()); iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod("singleton_method_added", state.runtime.newSymbol(iVisited.getName())); state.clearResult(); }
|
public void execute(EvaluationState state, InstructionContext ctx) { DefsNode iVisited = (DefsNode)ctx; IRubyObject receiver = state.begin(iVisited.getReceiverNode()); if (state.runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw state.runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw state.runtime.newFrozenError("object"); } if (! receiver.singletonMethodsAllowed()) { throw state.runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (state.runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw state.runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, state.getThreadContext().peekCRef()); iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod("singleton_method_added", state.runtime.newSymbol(iVisited.getName())); state.clearResult(); }
| 3,237,713
|
public SetDirective(Variable target, Object result) { this.target = target; this.result = result; }
|
public SetDirective(Variable target, Object result) { this.target = target; this.result = result; }
| 3,237,714
|
public RubyClass defineClass(String name, RubyClass superClass) { if (superClass == null) { superClass = getClasses().getObjectClass(); } RubyClass newClass = RubyClass.newClass(this, superClass, name); newClass.makeMetaClass(superClass.getMetaClass()); newClass.inheritedBy(superClass); classes.putClass(name, newClass); return newClass; }
|
publicRubyClassdefineClass(Stringname,RubyClasssuperClass){if(superClass==null){superClass=getClasses().getObjectClass();}RubyClassnewClass=RubyClass.newClass(this,superClass,name);newClass.makeMetaClass(superClass.getMetaClass());newClass.inheritedBy(superClass);classes.putClass(name,newClass);returnnewClass;}
| 3,237,715
|
public RubyClass defineClass(String name, RubyClass superClass) { if (superClass == null) { superClass = getClasses().getObjectClass(); } RubyClass newClass = RubyClass.newClass(this, superClass, name); newClass.makeMetaClass(superClass.getMetaClass()); newClass.inheritedBy(superClass); classes.putClass(name, newClass); return newClass; }
|
publicRubyClassdefineClass(Stringname,RubyClasssuperClass){if(superClass==null){superClass=getClasses().getObjectClass();}RubyClassnewClass=RubyClass.newClass(this,superClass,name);newClass.makeMetaClass(superClass.getMetaClass());newClass.inheritedBy(superClass);classes.putClass(name,newClass);returnnewClass;}
| 3,237,716
|
public RubyClass defineClass(String name, RubyClass superClass) { if (superClass == null) { superClass = getClasses().getObjectClass(); } RubyClass newClass = RubyClass.newClass(this, superClass, name); newClass.makeMetaClass(superClass.getMetaClass()); newClass.inheritedBy(superClass); classes.putClass(name, newClass); return newClass; }
|
publicRubyClassdefineClass(Stringname,RubyClasssuperClass){if(superClass==null){superClass=getClasses().getObjectClass();}RubyClassnewClass=RubyClass.newClass(this,superClass,name);newClass.makeMetaClass(superClass.getMetaClass());newClass.inheritedBy(superClass);classes.putClass(name,newClass);returnnewClass;}
| 3,237,717
|
public RubyClass defineClass(String name, RubyClass superClass) { if (superClass == null) { superClass = getClasses().getObjectClass(); } RubyClass newClass = RubyClass.newClass(this, superClass, name); newClass.makeMetaClass(superClass.getMetaClass()); newClass.inheritedBy(superClass); classes.putClass(name, newClass); return newClass; }
|
publicRubyClassdefineClass(Stringname,RubyClasssuperClass){if(superClass==null){superClass=getClasses().getObjectClass();}RubyClassnewClass=RubyClass.newClass(this,superClass,name);newClass.makeMetaClass(superClass.getMetaClass());newClass.inheritedBy(superClass);classes.putClass(name,newClass);returnnewClass;}
| 3,237,718
|
protected void setUp() throws Exception { super.setUp(); qf = new QueryFactory(); impl = new PojosImpl(); impl.setQueryFactory( qf ); ProxyFactory factory = new ProxyFactory(impl); factory.addAdvice(new ServiceHandler()); manager = (IPojos) factory.getProxy(); }
|
protected void setUp() throws Exception { super.setUp(); impl = new PojosImpl(); impl.setQueryFactory( qf ); ProxyFactory factory = new ProxyFactory(impl); factory.addAdvice(new ServiceHandler()); manager = (IPojos) factory.getProxy(); }
| 3,237,719
|
protected void setUp() throws Exception { super.setUp(); qf = new QueryFactory(); impl = new PojosImpl(); impl.setQueryFactory( qf ); ProxyFactory factory = new ProxyFactory(impl); factory.addAdvice(new ServiceHandler()); manager = (IPojos) factory.getProxy(); }
|
protected void setUp() throws Exception { super.setUp(); qf = new QueryFactory(); impl = new PojosImpl(); ProxyFactory factory = new ProxyFactory(impl); factory.addAdvice(new ServiceHandler()); manager = (IPojos) factory.getProxy(); }
| 3,237,720
|
public void testGetUserImages() throws Exception { T t = new T(ApiUsageException.class){ @Override public void doTest(Object[] arg) { manager.getUserImages((Map)arg[0]); } }; t.blowup(true,new PojoOptions().allExps().map()); t.blowup(false,new PojoOptions().exp(1L).map()); }
|
public void testGetUserImages() throws Exception { T t = new T(ApiUsageException.class){ @Override public void doTest(Object[] arg) { manager.getUserImages((Map)arg[0]); } }; t.blowup(true,new PojoOptions().allExps().map()); t.blowup(false,new PojoOptions().exp(1L).map()); }
| 3,237,721
|
public void test_simple_usage() throws Exception { Long doesntExist = -1L; q= new PojosLoadHierarchyQueryDefinition( new Parameters() .addIds(Arrays.asList( doesntExist )) .addOptions(null) .addClass(Project.class) ); list = (List) iQuery.execute(q); PojoOptions po = new PojoOptions().exp( doesntExist ); q= new PojosLoadHierarchyQueryDefinition( new Parameters() .addIds(null) .addOptions(po.map()) .addClass(Project.class) ); list = (List) iQuery.execute(q); }
|
public void test_simple_usage() throws Exception { Long doesntExist = -1L; q= new PojosLoadHierarchyQueryDefinition( new Parameters() .addIds(Arrays.asList( doesntExist )) .addOptions(null) .addClass(Project.class) ); list = (List) iQuery.execute(q); PojoOptions po = new PojoOptions().exp( doesntExist ); q= new PojosLoadHierarchyQueryDefinition( new Parameters() .addIds(Arrays.asList( doesntExist )) .addOptions(po.map()) .addClass(Project.class) ); list = (List) iQuery.execute(q); }
| 3,237,722
|
ViewerUIF(ViewerCtrl control, Registry registry, PixelsDimensions pxsDims, int defaultT, int defaultZ) { super("", registry.getTaskBar()); active = false; this.control = control; im = IconManager.getInstance(registry); int maxT = pxsDims.sizeT-1; int maxZ = pxsDims.sizeZ-1; setJMenuBar(createMenuBar(maxZ, maxT)); initBars(registry, maxT, defaultT, maxZ, defaultZ); initSliders(maxT, defaultT, maxZ, defaultZ); initContainers(); buildGUI(); }
|
ViewerUIF(ViewerCtrl control, Registry registry, PixelsDimensions pxsDims, int defaultT, int defaultZ) { super("", registry.getTaskBar()); this.control = control; im = IconManager.getInstance(registry); int maxT = pxsDims.sizeT-1; int maxZ = pxsDims.sizeZ-1; setJMenuBar(createMenuBar(maxZ, maxT)); initBars(registry, maxT, defaultT, maxZ, defaultZ); initSliders(maxT, defaultT, maxZ, defaultZ); initContainers(); buildGUI(); }
| 3,237,723
|
ViewerUIF(ViewerCtrl control, Registry registry, PixelsDimensions pxsDims, int defaultT, int defaultZ) { super("", registry.getTaskBar()); active = false; this.control = control; im = IconManager.getInstance(registry); int maxT = pxsDims.sizeT-1; int maxZ = pxsDims.sizeZ-1; setJMenuBar(createMenuBar(maxZ, maxT)); initBars(registry, maxT, defaultT, maxZ, defaultZ); initSliders(maxT, defaultT, maxZ, defaultZ); initContainers(); buildGUI(); }
|
ViewerUIF(ViewerCtrl control, Registry registry, PixelsDimensions pxsDims, int defaultT, int defaultZ) { super("", registry.getTaskBar()); active = false; this.control = control; im = IconManager.getInstance(registry); int maxT = pxsDims.sizeT-1; int maxZ = pxsDims.sizeZ-1; setJMenuBar(createMenuBar(maxZ, maxT)); initBars(registry, maxT, defaultT, maxZ, defaultZ); initSliders(maxT, defaultT, maxZ, defaultZ); initContainers(); buildGUI(); }
| 3,237,724
|
void resetLens() { canvas.resetLens(); //canvas.repaint(); }
|
void resetLens() { canvas.resetLens(); //canvas.repaint(); }
| 3,237,725
|
void setDefaultZT(int t, int z, int sizeT, int sizeZ) { ToolBarManager tbm = toolBar.getManager(); tbm.onTChange(t); tbm.onZChange(z); int maxZ = sizeZ-1; int maxT = sizeT-1; tbm.setMaxT(maxT); tbm.setMaxZ(maxZ); toolBar.getZLabel().setText("/"+maxZ); toolBar.getTLabel().setText("/"+maxT); resetSliders(maxT, t, maxZ, z); boolean bT = false, bZ = false, bZT = false; if (maxT != 0) bT = true; if (maxZ != 0) bZ = true; toolBar.getTField().setEditable(bT); toolBar.getZField().setEditable(bZ); toolBar.getViewer3D().setEnabled(bZ); if (bT || bZ) bZT = true; viewer3DItem.setEnabled(bZ); toolBar.getMovie().setEnabled(bZT); movieItem.setEnabled(bZT); }
|
void setDefaultZT(int t, int z, int sizeT, int sizeZ) { ToolBarManager tbm = toolBar.getManager(); tbm.onTChange(t); tbm.onZChange(z); int maxZ = sizeZ-1; int maxT = sizeT-1; tbm.setMaxT(maxT); tbm.setMaxZ(maxZ); toolBar.getZLabel().setText("/"+maxZ); toolBar.getTLabel().setText("/"+maxT); resetSliders(maxT, t, maxZ, z); boolean bT = false, bZ = false, bZT = false; if (maxT != 0) bT = true; if (maxZ != 0) bZ = true; toolBar.getTField().setEditable(bT); toolBar.getZField().setEditable(bZ); toolBar.getViewer3D().setEnabled(bZ); if (bT || bZ) bZT = true; viewer3DItem.setEnabled(bZ); toolBar.getMovie().setEnabled(bZT); movieItem.setEnabled(bZT); }
| 3,237,726
|
private void setWindowSize(int w, int h) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = 7*(screenSize.width/10); int height = 7*(screenSize.height/10); if (w > width) w = width; if (h > height) h = height; setSize(w, h); }
|
private void setWindowSize(int w, int h) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = 7*(screenSize.width/10); int height = 7*(screenSize.height/10); if (w > width) w = width; if (h > height) h = height; setSize(w, h); }
| 3,237,727
|
private void setWindowSize(int w, int h) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = 7*(screenSize.width/10); int height = 7*(screenSize.height/10); if (w > width) w = width; if (h > height) h = height; setSize(w, h); }
|
private void setWindowSize(int w, int h) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = 7*(screenSize.width/10); int height = 7*(screenSize.height/10); if (w > width) w = width; if (h > height) h = height; windowWidth = w; windowHeight = h; }
| 3,237,728
|
private void handleAddROICanvas(AddROICanvas response) { if (response.isOnOff()) bringUpPresentation(); else if (!postedAdd) closePresentation(); postedAdd = false; }
|
private void handleAddROICanvas(AddROICanvas response) { if (response.isOnOff()) bringUpPresentation(); else if (!postedAdd) closePresentation(); postedAdd = false; }
| 3,237,730
|
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); return receiver.callMethod(context, iVisited.getName(), args, callType); } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), null); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; context.preIterEval(Block.createBlock(iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; // FIXME: don't pass null return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), null); } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("True"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("False"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); }
|
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); return receiver.callMethod(context, iVisited.getName(), args, callType); } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), null); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; context.preIterEval(Block.createBlock(iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; // FIXME: don't pass null return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), null); } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("TrueClass"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("False"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); }
| 3,237,731
|
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); return receiver.callMethod(context, iVisited.getName(), args, callType); } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), null); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; context.preIterEval(Block.createBlock(iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; // FIXME: don't pass null return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), null); } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("True"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("False"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); }
|
private static IRubyObject evalInternal(ThreadContext context, Node node, IRubyObject self) { IRuby runtime = context.getRuntime(); bigloop: do { if (node == null) return runtime.getNil(); switch (node.nodeId) { case NodeTypes.ALIASNODE: { AliasNode iVisited = (AliasNode) node; if (context.getRubyClass() == null) { throw runtime.newTypeError("no class to make alias"); } context.getRubyClass().defineAlias(iVisited.getNewName(), iVisited.getOldName()); context.getRubyClass().callMethod(context, "method_added", runtime.newSymbol(iVisited.getNewName())); return runtime.getNil(); } case NodeTypes.ANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.ARGSCATNODE: { ArgsCatNode iVisited = (ArgsCatNode) node; IRubyObject args = evalInternal(context, iVisited.getFirstNode(), self); IRubyObject secondArgs = splatValue(evalInternal(context, iVisited.getSecondNode(), self)); RubyArray list = args instanceof RubyArray ? (RubyArray) args : runtime.newArray(args); return list.concat(secondArgs); } // case NodeTypes.ARGSNODE: // EvaluateVisitor.argsNodeVisitor.execute(this, node); // break; // case NodeTypes.ARGUMENTNODE: // EvaluateVisitor.argumentNodeVisitor.execute(this, node); // break; case NodeTypes.ARRAYNODE: { ArrayNode iVisited = (ArrayNode) node; IRubyObject[] array = new IRubyObject[iVisited.size()]; int i = 0; for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node next = (Node) iterator.next(); array[i++] = evalInternal(context, next, self); } return runtime.newArray(array); } // case NodeTypes.ASSIGNABLENODE: // EvaluateVisitor.assignableNodeVisitor.execute(this, node); // break; case NodeTypes.BACKREFNODE: { BackRefNode iVisited = (BackRefNode) node; IRubyObject backref = context.getBackref(); switch (iVisited.getType()) { case '~': return backref; case '&': return RubyRegexp.last_match(backref); case '`': return RubyRegexp.match_pre(backref); case '\'': return RubyRegexp.match_post(backref); case '+': return RubyRegexp.match_last(backref); } break; } case NodeTypes.BEGINNODE: { BeginNode iVisited = (BeginNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.BIGNUMNODE: { BignumNode iVisited = (BignumNode) node; return RubyBignum.newBignum(runtime, iVisited.getValue()); } // case NodeTypes.BINARYOPERATORNODE: // EvaluateVisitor.binaryOperatorNodeVisitor.execute(this, node); // break; // case NodeTypes.BLOCKARGNODE: // EvaluateVisitor.blockArgNodeVisitor.execute(this, node); // break; case NodeTypes.BLOCKNODE: { BlockNode iVisited = (BlockNode) node; IRubyObject result = runtime.getNil(); for (Iterator iter = iVisited.iterator(); iter.hasNext();) { result = evalInternal(context, (Node) iter.next(), self); } return result; } case NodeTypes.BLOCKPASSNODE: { BlockPassNode iVisited = (BlockPassNode) node; IRubyObject proc = evalInternal(context, iVisited.getBodyNode(), self); if (proc.isNil()) { context.setNoBlock(); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearNoBlock(); } } // If not already a proc then we should try and make it one. if (!(proc instanceof RubyProc)) { proc = proc.convertToType("Proc", "to_proc", false); if (!(proc instanceof RubyProc)) { throw runtime.newTypeError("wrong argument type " + proc.getMetaClass().getName() + " (expected Proc)"); } } // TODO: Add safety check for taintedness Block block = (Block) context.getCurrentBlock(); if (block != null) { IRubyObject blockObject = block.getBlockObject(); // The current block is already associated with the proc. No need to create new // block for it. Just eval! if (blockObject != null && blockObject == proc) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } finally { context.clearBlockAvailable(); } } } context.preBlockPassEval(((RubyProc) proc).getBlock()); try { return evalInternal(context, iVisited.getIterNode(), self); } finally { context.postBlockPassEval(); } } case NodeTypes.BREAKNODE: { BreakNode iVisited = (BreakNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.BreakJump); je.setPrimaryData(result); je.setSecondaryData(node); throw je; } case NodeTypes.CALLNODE: { CallNode iVisited = (CallNode) node; context.beginCallArgs(); IRubyObject receiver = null; IRubyObject[] args = null; try { receiver = evalInternal(context, iVisited.getReceiverNode(), self); args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } assert receiver.getMetaClass() != null : receiver.getClass().getName(); // If reciever is self then we do the call the same way as vcall CallType callType = (receiver == self ? CallType.VARIABLE : CallType.NORMAL); return receiver.callMethod(context, iVisited.getName(), args, callType); } case NodeTypes.CASENODE: { CaseNode iVisited = (CaseNode) node; IRubyObject expression = null; if (iVisited.getCaseNode() != null) { expression = evalInternal(context, iVisited.getCaseNode(), self); } context.pollThreadEvents(); IRubyObject result = runtime.getNil(); Node firstWhenNode = iVisited.getFirstWhenNode(); while (firstWhenNode != null) { if (!(firstWhenNode instanceof WhenNode)) { node = firstWhenNode; continue bigloop; } WhenNode whenNode = (WhenNode) firstWhenNode; if (whenNode.getExpressionNodes() instanceof ArrayNode) { for (Iterator iter = ((ArrayNode) whenNode.getExpressionNodes()).iterator(); iter .hasNext();) { Node tag = (Node) iter.next(); context.setPosition(tag.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // Ruby grammar has nested whens in a case body because of // productions case_body and when_args. if (tag instanceof WhenNode) { RubyArray expressions = (RubyArray) evalInternal(context, ((WhenNode) tag) .getExpressionNodes(), self); for (int j = 0; j < expressions.getLength(); j++) { IRubyObject condition = expressions.entry(j); if ((expression != null && condition.callMethod(context, "===", expression) .isTrue()) || (expression == null && condition.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } continue; } result = evalInternal(context, tag, self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = whenNode.getBodyNode(); continue bigloop; } } } else { result = evalInternal(context, whenNode.getExpressionNodes(), self); if ((expression != null && result.callMethod(context, "===", expression).isTrue()) || (expression == null && result.isTrue())) { node = ((WhenNode) firstWhenNode).getBodyNode(); continue bigloop; } } context.pollThreadEvents(); firstWhenNode = whenNode.getNextCase(); } return runtime.getNil(); } case NodeTypes.CLASSNODE: { ClassNode iVisited = (ClassNode) node; Node superNode = iVisited.getSuperNode(); RubyClass superClass = superNode == null ? null : (RubyClass) evalInternal(context, superNode, self); Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingClass = getEnclosingModule(context, classNameNode, self); RubyClass rubyClass = enclosingClass.defineOrGetClassUnder(name, superClass); if (context.getWrapper() != null) { rubyClass.extendObject(context.getWrapper()); rubyClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), rubyClass, self); } case NodeTypes.CLASSVARASGNNODE: { ClassVarAsgnNode iVisited = (ClassVarAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule) rubyClass.getInstanceVariable("__attached__"); } rubyClass.setClassVar(iVisited.getName(), result); return result; } case NodeTypes.CLASSVARDECLNODE: { ClassVarDeclNode iVisited = (ClassVarDeclNode) node; // FIXME: shouldn't we use cref here? if (context.getRubyClass() == null) { throw runtime.newTypeError("no class/module to define class variable"); } IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); ((RubyModule) context.peekCRef().getValue()).setClassVar(iVisited.getName(), result); return runtime.getNil(); } case NodeTypes.CLASSVARNODE: { ClassVarNode iVisited = (ClassVarNode) node; RubyModule rubyClass = (RubyModule) context.peekCRef().getValue(); if (rubyClass == null) { rubyClass = self.getMetaClass(); } else if (rubyClass.isSingleton()) { rubyClass = (RubyModule)rubyClass.getInstanceVariable("__attached__"); } return rubyClass.getClassVar(iVisited.getName()); } case NodeTypes.COLON2NODE: { Colon2Node iVisited = (Colon2Node) node; Node leftNode = iVisited.getLeftNode(); // TODO: Made this more colon3 friendly because of cpath production // rule in grammar (it is convenient to think of them as the same thing // at a grammar level even though evaluation is). if (leftNode == null) { return runtime.getObject().getConstantFrom(iVisited.getName()); } else { IRubyObject result = evalInternal(context, iVisited.getLeftNode(), self); if (result instanceof RubyModule) { return ((RubyModule) result).getConstantFrom(iVisited.getName()); } else { return result.callMethod(context, iVisited.getName()); } } } case NodeTypes.COLON3NODE: { Colon3Node iVisited = (Colon3Node) node; return runtime.getObject().getConstantFrom(iVisited.getName()); } case NodeTypes.CONSTDECLNODE: { ConstDeclNode iVisited = (ConstDeclNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); IRubyObject module; if (iVisited.getPathNode() != null) { module = evalInternal(context, iVisited.getPathNode(), self); } else { // FIXME: why do we check RubyClass and then use CRef? if (context.getRubyClass() == null) { // TODO: wire into new exception handling mechanism throw runtime.newTypeError("no class/module to define constant"); } module = (RubyModule) context.peekCRef().getValue(); } // FIXME: shouldn't we use the result of this set in setResult? ((RubyModule) module).setConstant(iVisited.getName(), result); return result; } case NodeTypes.CONSTNODE: { ConstNode iVisited = (ConstNode) node; return context.getConstant(iVisited.getName()); } case NodeTypes.DASGNNODE: { DAsgnNode iVisited = (DAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("DSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.DEFINEDNODE: { DefinedNode iVisited = (DefinedNode) node; String definition = getDefinition(context, iVisited.getExpressionNode(), self); if (definition != null) { return runtime.newString(definition); } else { return runtime.getNil(); } } case NodeTypes.DEFNNODE: { DefnNode iVisited = (DefnNode) node; RubyModule containingClass = context.getRubyClass(); if (containingClass == null) { throw runtime.newTypeError("No class to add method."); } String name = iVisited.getName(); if (containingClass == runtime.getObject() && name.equals("initialize")) { runtime.getWarnings().warn("redefining Object#initialize may cause infinite loop"); } Visibility visibility = context.getCurrentVisibility(); if (name.equals("initialize") || visibility.isModuleFunction()) { visibility = Visibility.PRIVATE; } DefaultMethod newMethod = new DefaultMethod(containingClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), visibility, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } containingClass.addMethod(name, newMethod); if (context.getCurrentVisibility().isModuleFunction()) { containingClass.getSingletonClass().addMethod( name, new WrapperCallable(containingClass.getSingletonClass(), newMethod, Visibility.PUBLIC)); containingClass.callMethod(context, "singleton_method_added", runtime.newSymbol(name)); } // 'class << state.self' and 'class << obj' uses defn as opposed to defs if (containingClass.isSingleton()) { ((MetaClass) containingClass).getAttachedObject().callMethod( context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); } else { containingClass.callMethod(context, "method_added", runtime.newSymbol(name)); } return runtime.getNil(); } case NodeTypes.DEFSNODE: { DefsNode iVisited = (DefsNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure; can't define singleton method."); } if (receiver.isFrozen()) { throw runtime.newFrozenError("object"); } if (!receiver.singletonMethodsAllowed()) { throw runtime.newTypeError("can't define singleton method \"" + iVisited.getName() + "\" for " + receiver.getType()); } RubyClass rubyClass = receiver.getSingletonClass(); if (runtime.getSafeLevel() >= 4) { ICallable method = (ICallable) rubyClass.getMethods().get(iVisited.getName()); if (method != null) { throw runtime.newSecurityError("Redefining method prohibited."); } } DefaultMethod newMethod = new DefaultMethod(rubyClass, iVisited.getScope(), iVisited.getBodyNode(), (ArgsNode) iVisited.getArgsNode(), Visibility.PUBLIC, context.peekCRef()); if (iVisited.getBodyNode() != null) { iVisited.getBodyNode().accept(new CreateJumpTargetVisitor(newMethod)); } rubyClass.addMethod(iVisited.getName(), newMethod); receiver.callMethod(context, "singleton_method_added", runtime.newSymbol(iVisited.getName())); return runtime.getNil(); } case NodeTypes.DOTNODE: { DotNode iVisited = (DotNode) node; return RubyRange.newRange(runtime, evalInternal(context, iVisited.getBeginNode(), self), evalInternal(context, iVisited .getEndNode(), self), iVisited.isExclusive()); } case NodeTypes.DREGEXPNODE: { DRegexpNode iVisited = (DRegexpNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return RubyRegexp.newRegexp(runtime, sb.toString(), iVisited.getOptions(), null); } case NodeTypes.DSTRNODE: { DStrNode iVisited = (DStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newString(sb.toString()); } case NodeTypes.DSYMBOLNODE: { DSymbolNode iVisited = (DSymbolNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.getNode().iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return runtime.newSymbol(sb.toString()); } case NodeTypes.DVARNODE: { DVarNode iVisited = (DVarNode) node; // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; } case NodeTypes.DXSTRNODE: { DXStrNode iVisited = (DXStrNode) node; StringBuffer sb = new StringBuffer(); for (Iterator iterator = iVisited.iterator(); iterator.hasNext();) { Node iterNode = (Node) iterator.next(); sb.append(evalInternal(context, iterNode, self).toString()); } return self.callMethod(context, "`", runtime.newString(sb.toString())); } case NodeTypes.ENSURENODE: { EnsureNode iVisited = (EnsureNode) node; // save entering the try if there's nothing to ensure if (iVisited.getEnsureNode() != null) { IRubyObject result = runtime.getNil(); try { result = evalInternal(context, iVisited.getBodyNode(), self); } finally { evalInternal(context, iVisited.getEnsureNode(), self); } return result; } node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.EVSTRNODE: { EvStrNode iVisited = (EvStrNode) node; node = iVisited.getBody(); continue bigloop; } case NodeTypes.FALSENODE: { context.pollThreadEvents(); return runtime.getFalse(); } case NodeTypes.FCALLNODE: { FCallNode iVisited = (FCallNode) node; context.beginCallArgs(); IRubyObject[] args; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return self.callMethod(context, iVisited.getName(), args, CallType.FUNCTIONAL); } case NodeTypes.FIXNUMNODE: { FixnumNode iVisited = (FixnumNode) node; return runtime.newFixnum(iVisited.getValue()); } case NodeTypes.FLIPNODE: { FlipNode iVisited = (FlipNode) node; IRubyObject result = runtime.getNil(); if (iVisited.isExclusive()) { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { result = evalInternal(context, iVisited.getBeginNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } else { if (!context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()).isTrue()) { if (evalInternal(context, iVisited.getBeginNode(), self).isTrue()) { context.getCurrentScope().setValue( iVisited.getIndex(), evalInternal(context, iVisited.getEndNode(), self).isTrue() ? runtime.getFalse() : runtime.getTrue(), iVisited.getDepth()); return runtime.getTrue(); } else { return runtime.getFalse(); } } else { if (evalInternal(context, iVisited.getEndNode(), self).isTrue()) { context.getCurrentScope().setValue(iVisited.getIndex(), runtime.getFalse(), iVisited.getDepth()); } return runtime.getTrue(); } } } case NodeTypes.FLOATNODE: { FloatNode iVisited = (FloatNode) node; return RubyFloat.newFloat(runtime, iVisited.getValue()); } case NodeTypes.FORNODE: { ForNode iVisited = (ForNode) node; // For nodes do not have to create an addition scope so we just pass null context.preForLoopEval(Block.createBlock(iVisited.getVarNode(), null, iVisited.getCallable(), self)); try { while (true) { try { ISourcePosition position = context.getPosition(); context.beginCallArgs(); IRubyObject recv = null; try { recv = evalInternal(context, iVisited.getIterNode(), self); } finally { context.setPosition(position); context.endCallArgs(); } return recv.callMethod(context, "each", IRubyObject.NULL_ARRAY, CallType.NORMAL); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // do nothing, allow loop to retry break; default: throw je; } } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postForLoopEval(); } } case NodeTypes.GLOBALASGNNODE: { GlobalAsgnNode iVisited = (GlobalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); runtime.getGlobalVariables().set(iVisited.getName(), result); return result; } case NodeTypes.GLOBALVARNODE: { GlobalVarNode iVisited = (GlobalVarNode) node; return runtime.getGlobalVariables().get(iVisited.getName()); } case NodeTypes.HASHNODE: { HashNode iVisited = (HashNode) node; Map hash = null; if (iVisited.getListNode() != null) { hash = new HashMap(iVisited.getListNode().size() / 2); for (Iterator iterator = iVisited.getListNode().iterator(); iterator.hasNext();) { // insert all nodes in sequence, hash them in the final instruction // KEY IRubyObject key = evalInternal(context, (Node) iterator.next(), self); IRubyObject value = evalInternal(context, (Node) iterator.next(), self); hash.put(key, value); } } if (hash == null) { return RubyHash.newHash(runtime); } return RubyHash.newHash(runtime, hash, runtime.getNil()); } case NodeTypes.IFNODE: { IfNode iVisited = (IfNode) node; IRubyObject result = evalInternal(context, iVisited.getCondition(), self); if (result.isTrue()) { node = iVisited.getThenBody(); continue bigloop; } else { node = iVisited.getElseBody(); continue bigloop; } } case NodeTypes.INSTASGNNODE: { InstAsgnNode iVisited = (InstAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); self.setInstanceVariable(iVisited.getName(), result); return result; } case NodeTypes.INSTVARNODE: { InstVarNode iVisited = (InstVarNode) node; IRubyObject variable = self.getInstanceVariable(iVisited.getName()); return variable == null ? runtime.getNil() : variable; } // case NodeTypes.ISCOPINGNODE: // EvaluateVisitor.iScopingNodeVisitor.execute(this, node); // break; case NodeTypes.ITERNODE: { IterNode iVisited = (IterNode) node; context.preIterEval(Block.createBlock(iVisited.getVarNode(), new DynamicScope(iVisited.getScope(), context.getCurrentScope()), iVisited.getCallable(), self)); try { while (true) { try { context.setBlockAvailable(); return evalInternal(context, iVisited.getIterNode(), self); } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.RETRY: // allow loop to retry break; default: throw je; } } finally { context.clearBlockAvailable(); } } } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.BREAK: IRubyObject breakValue = (IRubyObject) je.getPrimaryData(); return breakValue == null ? runtime.getNil() : breakValue; default: throw je; } } finally { context.postIterEval(); } } case NodeTypes.LOCALASGNNODE: { LocalAsgnNode iVisited = (LocalAsgnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // System.out.println("LSetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth() + " and set " + result); context.getCurrentScope().setValue(iVisited.getIndex(), result, iVisited.getDepth()); return result; } case NodeTypes.LOCALVARNODE: { LocalVarNode iVisited = (LocalVarNode) node; //System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(iVisited.getIndex(), iVisited.getDepth()); return result == null ? runtime.getNil() : result; } case NodeTypes.MATCH2NODE: { Match2Node iVisited = (Match2Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); return ((RubyRegexp) recv).match(value); } case NodeTypes.MATCH3NODE: { Match3Node iVisited = (Match3Node) node; IRubyObject recv = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = evalInternal(context, iVisited.getValueNode(), self); if (value instanceof RubyString) { return ((RubyRegexp) recv).match(value); } else { return value.callMethod(context, "=~", recv); } } case NodeTypes.MATCHNODE: { MatchNode iVisited = (MatchNode) node; return ((RubyRegexp) evalInternal(context, iVisited.getRegexpNode(), self)).match2(); } case NodeTypes.MODULENODE: { ModuleNode iVisited = (ModuleNode) node; Node classNameNode = iVisited.getCPath(); String name = ((INameNode) classNameNode).getName(); RubyModule enclosingModule = getEnclosingModule(context, classNameNode, self); if (enclosingModule == null) { throw runtime.newTypeError("no outer class/module"); } RubyModule module; if (enclosingModule == runtime.getObject()) { module = runtime.getOrCreateModule(name); } else { module = enclosingModule.defineModuleUnder(name); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), module, self); } case NodeTypes.MULTIPLEASGNNODE: { MultipleAsgnNode iVisited = (MultipleAsgnNode) node; return AssignmentVisitor.assign(context, self, iVisited, evalInternal(context, iVisited.getValueNode(), self), false); } case NodeTypes.NEWLINENODE: { NewlineNode iVisited = (NewlineNode) node; // something in here is used to build up ruby stack trace... context.setPosition(iVisited.getPosition()); if (isTrace(runtime)) { callTraceFunction(context, "line", self); } // TODO: do above but not below for additional newline nodes node = iVisited.getNextNode(); continue bigloop; } case NodeTypes.NEXTNODE: { NextNode iVisited = (NextNode) node; context.pollThreadEvents(); IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.NextJump); je.setPrimaryData(result); je.setSecondaryData(iVisited); //state.setCurrentException(je); throw je; } case NodeTypes.NILNODE: return runtime.getNil(); case NodeTypes.NOTNODE: { NotNode iVisited = (NotNode) node; IRubyObject result = evalInternal(context, iVisited.getConditionNode(), self); return result.isTrue() ? runtime.getFalse() : runtime.getTrue(); } case NodeTypes.NTHREFNODE: { NthRefNode iVisited = (NthRefNode) node; return RubyRegexp.nth_match(iVisited.getMatchNumber(), context.getBackref()); } case NodeTypes.OPASGNANDNODE: { BinaryOperatorNode iVisited = (BinaryOperatorNode) node; // add in reverse order IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) return result; node = iVisited.getSecondNode(); continue bigloop; } case NodeTypes.OPASGNNODE: { OpAsgnNode iVisited = (OpAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject value = receiver.callMethod(context, iVisited.getVariableName()); if (iVisited.getOperatorName().equals("||")) { if (value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!value.isTrue()) { return value; } value = evalInternal(context, iVisited.getValueNode(), self); } else { value = value.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited.getValueNode(), self)); } receiver.callMethod(context, iVisited.getVariableName() + "=", value); context.pollThreadEvents(); return value; } case NodeTypes.OPASGNORNODE: { OpAsgnOrNode iVisited = (OpAsgnOrNode) node; String def = getDefinition(context, iVisited.getFirstNode(), self); IRubyObject result = runtime.getNil(); if (def != null) { result = evalInternal(context, iVisited.getFirstNode(), self); } if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } case NodeTypes.OPELEMENTASGNNODE: { OpElementAsgnNode iVisited = (OpElementAsgnNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); IRubyObject[] args = setupArgs(context, iVisited.getArgsNode(), self); IRubyObject firstValue = receiver.callMethod(context, "[]", args); if (iVisited.getOperatorName().equals("||")) { if (firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else if (iVisited.getOperatorName().equals("&&")) { if (!firstValue.isTrue()) { return firstValue; } firstValue = evalInternal(context, iVisited.getValueNode(), self); } else { firstValue = firstValue.callMethod(context, iVisited.getOperatorName(), evalInternal(context, iVisited .getValueNode(), self)); } IRubyObject[] expandedArgs = new IRubyObject[args.length + 1]; System.arraycopy(args, 0, expandedArgs, 0, args.length); expandedArgs[expandedArgs.length - 1] = firstValue; return receiver.callMethod(context, "[]=", expandedArgs); } case NodeTypes.OPTNNODE: { OptNNode iVisited = (OptNNode) node; IRubyObject result = runtime.getNil(); while (RubyKernel.gets(runtime.getTopSelf(), IRubyObject.NULL_ARRAY).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: // do nothing, this iteration restarts break; case JumpType.NEXT: // recheck condition break loop; case JumpType.BREAK: // end loop return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.ORNODE: { OrNode iVisited = (OrNode) node; IRubyObject result = evalInternal(context, iVisited.getFirstNode(), self); if (!result.isTrue()) { result = evalInternal(context, iVisited.getSecondNode(), self); } return result; } // case NodeTypes.POSTEXENODE: // EvaluateVisitor.postExeNodeVisitor.execute(this, node); // break; case NodeTypes.REDONODE: { context.pollThreadEvents(); // now used as an interpreter event JumpException je = new JumpException(JumpException.JumpType.RedoJump); je.setSecondaryData(node); throw je; } case NodeTypes.REGEXPNODE: { RegexpNode iVisited = (RegexpNode) node; // FIXME: don't pass null return RubyRegexp.newRegexp(runtime, iVisited.getPattern(), null); } case NodeTypes.RESCUEBODYNODE: { RescueBodyNode iVisited = (RescueBodyNode) node; node = iVisited.getBodyNode(); continue bigloop; } case NodeTypes.RESCUENODE: { RescueNode iVisited = (RescueNode)node; RescuedBlock : while (true) { try { // Execute rescue block IRubyObject result = evalInternal(context, iVisited.getBodyNode(), self); // If no exception is thrown execute else block if (iVisited.getElseNode() != null) { if (iVisited.getRescueNode() == null) { runtime.getWarnings().warn(iVisited.getElseNode().getPosition(), "else without rescue is useless"); } result = evalInternal(context, iVisited.getElseNode(), self); } return result; } catch (RaiseException raiseJump) { RubyException raisedException = raiseJump.getException(); // TODO: Rubicon TestKernel dies without this line. A cursory glance implies we // falsely set $! to nil and this sets it back to something valid. This should // get fixed at the same time we address bug #1296484. runtime.getGlobalVariables().set("$!", raisedException); RescueBodyNode rescueNode = iVisited.getRescueNode(); while (rescueNode != null) { Node exceptionNodes = rescueNode.getExceptionNodes(); ListNode exceptionNodesList; if (exceptionNodes instanceof SplatNode) { exceptionNodesList = (ListNode) evalInternal(context, exceptionNodes, self); } else { exceptionNodesList = (ListNode) exceptionNodes; } if (isRescueHandled(context, raisedException, exceptionNodesList, self)) { try { return evalInternal(context, rescueNode, self); } catch (JumpException je) { if (je.getJumpType() == JumpException.JumpType.RetryJump) { // should be handled in the finally block below //state.runtime.getGlobalVariables().set("$!", state.runtime.getNil()); //state.threadContext.setRaisedException(null); continue RescuedBlock; } else { throw je; } } } rescueNode = rescueNode.getOptRescueNode(); } // no takers; bubble up throw raiseJump; } finally { // clear exception when handled or retried runtime.getGlobalVariables().set("$!", runtime.getNil()); } } } case NodeTypes.RETRYNODE: { context.pollThreadEvents(); JumpException je = new JumpException(JumpException.JumpType.RetryJump); throw je; } case NodeTypes.RETURNNODE: { ReturnNode iVisited = (ReturnNode) node; IRubyObject result = evalInternal(context, iVisited.getValueNode(), self); JumpException je = new JumpException(JumpException.JumpType.ReturnJump); je.setPrimaryData(iVisited.getTarget()); je.setSecondaryData(result); je.setTertiaryData(iVisited); throw je; } case NodeTypes.ROOTNODE: { RootNode iVisited = (RootNode) node; DynamicScope scope = iVisited.getScope(); // Serialization killed our dynamic scope. We can just create an empty one // since serialization cannot serialize an eval (which is the only thing // which is capable of having a non-empty dynamic scope). if (scope == null) { scope = new DynamicScope(iVisited.getStaticScope(), null); } // Each root node has a top-level scope that we need to push context.preRootNode(scope); // FIXME: Wire up BEGIN and END nodes try { return eval(context, iVisited.getBodyNode(), self); } finally { context.postRootNode(); } } case NodeTypes.SCLASSNODE: { SClassNode iVisited = (SClassNode) node; IRubyObject receiver = evalInternal(context, iVisited.getReceiverNode(), self); RubyClass singletonClass; if (receiver.isNil()) { singletonClass = runtime.getNilClass(); } else if (receiver == runtime.getTrue()) { singletonClass = runtime.getClass("True"); } else if (receiver == runtime.getFalse()) { singletonClass = runtime.getClass("FalseClass"); } else { if (runtime.getSafeLevel() >= 4 && !receiver.isTaint()) { throw runtime.newSecurityError("Insecure: can't extend object."); } singletonClass = receiver.getSingletonClass(); } if (context.getWrapper() != null) { singletonClass.extendObject(context.getWrapper()); singletonClass.includeModule(context.getWrapper()); } return evalClassDefinitionBody(context, iVisited.getScope(), iVisited.getBodyNode(), singletonClass, self); } case NodeTypes.SELFNODE: return self; case NodeTypes.SPLATNODE: { SplatNode iVisited = (SplatNode) node; return splatValue(evalInternal(context, iVisited.getValue(), self)); } //// case NodeTypes.STARNODE: //// EvaluateVisitor.starNodeVisitor.execute(this, node); //// break; case NodeTypes.STRNODE: { StrNode iVisited = (StrNode) node; return runtime.newString(iVisited.getValue()); } case NodeTypes.SUPERNODE: { SuperNode iVisited = (SuperNode) node; if (context.getFrameLastClass() == null) { throw runtime.newNameError("Superclass method '" + context.getFrameLastFunc() + "' disabled."); } context.beginCallArgs(); IRubyObject[] args = null; try { args = setupArgs(context, iVisited.getArgsNode(), self); } finally { context.endCallArgs(); } return context.callSuper(args); } case NodeTypes.SVALUENODE: { SValueNode iVisited = (SValueNode) node; return aValueSplat(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.SYMBOLNODE: { SymbolNode iVisited = (SymbolNode) node; return runtime.newSymbol(iVisited.getName()); } case NodeTypes.TOARYNODE: { ToAryNode iVisited = (ToAryNode) node; return aryToAry(evalInternal(context, iVisited.getValue(), self)); } case NodeTypes.TRUENODE: { context.pollThreadEvents(); return runtime.getTrue(); } case NodeTypes.UNDEFNODE: { UndefNode iVisited = (UndefNode) node; if (context.getRubyClass() == null) { throw runtime .newTypeError("No class to undef method '" + iVisited.getName() + "'."); } context.getRubyClass().undef(iVisited.getName()); return runtime.getNil(); } case NodeTypes.UNTILNODE: { UntilNode iVisited = (UntilNode) node; IRubyObject result = runtime.getNil(); while (!(result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { loop: while (true) { // Used for the 'redo' command try { result = evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return (IRubyObject) je.getPrimaryData(); default: throw je; } } } } return result; } case NodeTypes.VALIASNODE: { VAliasNode iVisited = (VAliasNode) node; runtime.getGlobalVariables().alias(iVisited.getNewName(), iVisited.getOldName()); return runtime.getNil(); } case NodeTypes.VCALLNODE: { VCallNode iVisited = (VCallNode) node; return self.callMethod(context, iVisited.getName(), IRubyObject.NULL_ARRAY, CallType.VARIABLE); } case NodeTypes.WHENNODE: assert false; return null; case NodeTypes.WHILENODE: { WhileNode iVisited = (WhileNode) node; IRubyObject result = runtime.getNil(); boolean firstTest = iVisited.evaluateAtStart(); while (!firstTest || (result = evalInternal(context, iVisited.getConditionNode(), self)).isTrue()) { firstTest = true; loop: while (true) { // Used for the 'redo' command try { evalInternal(context, iVisited.getBodyNode(), self); break loop; } catch (JumpException je) { switch (je.getJumpType().getTypeId()) { case JumpType.REDO: continue; case JumpType.NEXT: break loop; case JumpType.BREAK: return result; default: throw je; } } } } return result; } case NodeTypes.XSTRNODE: { XStrNode iVisited = (XStrNode) node; return self.callMethod(context, "`", runtime.newString(iVisited.getValue())); } case NodeTypes.YIELDNODE: { YieldNode iVisited = (YieldNode) node; IRubyObject result = evalInternal(context, iVisited.getArgsNode(), self); if (iVisited.getArgsNode() == null) { result = null; } return context.yieldCurrentBlock(result, null, null, iVisited.getCheckState()); } case NodeTypes.ZARRAYNODE: { return runtime.newArray(); } case NodeTypes.ZSUPERNODE: { if (context.getFrameLastClass() == null) { throw runtime.newNameError("superclass method '" + context.getFrameLastFunc() + "' disabled"); } return context.callSuper(context.getFrameArgs()); } } } while (true); }
| 3,237,732
|
private static Node getParsedScript(Ruby runtime, Reader reader, String filename) { Node result = runtime.parse(reader, filename); if (commandline.assumePrinting) { result = new ParserSupport().appendPrintToBlock(result); } if (commandline.assumeLoop) { result = new ParserSupport().appendWhileLoopToBlock(result, commandline.processLineEnds, commandline.sDoSplit); } return result; }
|
private static Node getParsedScript(Ruby runtime, Reader reader, String filename) { Node result = runtime.parse(reader, filename); if (commandline.isAssumePrinting()) { result = new ParserSupport().appendPrintToBlock(result); } if (commandline.assumeLoop) { result = new ParserSupport().appendWhileLoopToBlock(result, commandline.processLineEnds, commandline.sDoSplit); } return result; }
| 3,237,733
|
private static Node getParsedScript(Ruby runtime, Reader reader, String filename) { Node result = runtime.parse(reader, filename); if (commandline.assumePrinting) { result = new ParserSupport().appendPrintToBlock(result); } if (commandline.assumeLoop) { result = new ParserSupport().appendWhileLoopToBlock(result, commandline.processLineEnds, commandline.sDoSplit); } return result; }
|
private static Node getParsedScript(Ruby runtime, Reader reader, String filename) { Node result = runtime.parse(reader, filename); if (commandline.assumePrinting) { result = new ParserSupport().appendPrintToBlock(result); } if (commandline.assumeLoop) { result = new ParserSupport().appendWhileLoopToBlock(result, commandline.processLineEnds, commandline.sDoSplit); } return result; }
| 3,237,734
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); defineGlobalVERBOSE(runtime); runtime.getObject().setConstant("$VERBOSE", commandline.verbose ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); // TODO this is a fake cause we have no real process number in Java runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(runtime.hashCode()))); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); defineGlobalVERBOSE(runtime); runtime.getObject().setConstant("$VERBOSE", commandline.verbose ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); // TODO this is a fake cause we have no real process number in Java runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(runtime.hashCode()))); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
| 3,237,735
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); defineGlobalVERBOSE(runtime); runtime.getObject().setConstant("$VERBOSE", commandline.verbose ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); // TODO this is a fake cause we have no real process number in Java runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(runtime.hashCode()))); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); defineGlobalVERBOSE(runtime); runtime.getObject().setConstant("$VERBOSE", commandline.isVerbose() ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); // TODO this is a fake cause we have no real process number in Java runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(runtime.hashCode()))); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
| 3,237,736
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); defineGlobalVERBOSE(runtime); runtime.getObject().setConstant("$VERBOSE", commandline.verbose ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); // TODO this is a fake cause we have no real process number in Java runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(runtime.hashCode()))); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); defineGlobalVERBOSE(runtime); runtime.getObject().setConstant("$VERBOSE", commandline.verbose ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); // TODO this is a fake cause we have no real process number in Java runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(runtime.hashCode()))); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
| 3,237,737
|
public static void main(String[] args) { commandline = new CommandlineParser(args); if (commandline.showVersion) { showVersion(); } if (! commandline.shouldRunInterpreter()) { return; } long now = -1; if (commandline.isBenchmarking) { now = System.currentTimeMillis(); } int status = runInterpreter(commandline.getScriptSource(), commandline.displayedFileName()); if (commandline.isBenchmarking) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } // Only do an explicit exit if the interpreter has had an error. We // do not want to exit on non-errors since the interpreter may have // started background threads (ala samples/swing2.rb) if (status != 0) { System.exit(status); } }
|
public static void main(String[] args) { commandline = new CommandlineParser(args); if (commandline.isShowVersion()) { showVersion(); } if (! commandline.shouldRunInterpreter()) { return; } long now = -1; if (commandline.isBenchmarking) { now = System.currentTimeMillis(); } int status = runInterpreter(commandline.getScriptSource(), commandline.displayedFileName()); if (commandline.isBenchmarking) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } // Only do an explicit exit if the interpreter has had an error. We // do not want to exit on non-errors since the interpreter may have // started background threads (ala samples/swing2.rb) if (status != 0) { System.exit(status); } }
| 3,237,738
|
public static void main(String[] args) { commandline = new CommandlineParser(args); if (commandline.showVersion) { showVersion(); } if (! commandline.shouldRunInterpreter()) { return; } long now = -1; if (commandline.isBenchmarking) { now = System.currentTimeMillis(); } int status = runInterpreter(commandline.getScriptSource(), commandline.displayedFileName()); if (commandline.isBenchmarking) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } // Only do an explicit exit if the interpreter has had an error. We // do not want to exit on non-errors since the interpreter may have // started background threads (ala samples/swing2.rb) if (status != 0) { System.exit(status); } }
|
public static void main(String[] args) { commandline = new CommandlineParser(args); if (commandline.showVersion) { showVersion(); } if (! commandline.shouldRunInterpreter()) { return; } long now = -1; if (commandline.isBenchmarking()) { now = System.currentTimeMillis(); } int status = runInterpreter(commandline.getScriptSource(), commandline.displayedFileName()); if (commandline.isBenchmarking()) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } // Only do an explicit exit if the interpreter has had an error. We // do not want to exit on non-errors since the interpreter may have // started background threads (ala samples/swing2.rb) if (status != 0) { System.exit(status); } }
| 3,237,739
|
public static void main(String[] args) { commandline = new CommandlineParser(args); if (commandline.showVersion) { showVersion(); } if (! commandline.shouldRunInterpreter()) { return; } long now = -1; if (commandline.isBenchmarking) { now = System.currentTimeMillis(); } int status = runInterpreter(commandline.getScriptSource(), commandline.displayedFileName()); if (commandline.isBenchmarking) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } // Only do an explicit exit if the interpreter has had an error. We // do not want to exit on non-errors since the interpreter may have // started background threads (ala samples/swing2.rb) if (status != 0) { System.exit(status); } }
|
public static void main(String[] args) { commandline = new CommandlineParser(args); if (commandline.showVersion) { showVersion(); } if (! commandline.shouldRunInterpreter()) { return; } long now = -1; if (commandline.isBenchmarking()) { now = System.currentTimeMillis(); } int status = runInterpreter(commandline.getScriptSource(), commandline.displayedFileName()); if (commandline.isBenchmarking()) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } // Only do an explicit exit if the interpreter has had an error. We // do not want to exit on non-errors since the interpreter may have // started background threads (ala samples/swing2.rb) if (status != 0) { System.exit(status); } }
| 3,237,740
|
public RubyArray singleton_methods() { RubyArray result = getRuntime().newArray(); for (RubyClass type = getMetaClass(); type != null && type instanceof MetaClass; type = type.getSuperClass()) { for (Iterator iter = type.getMethods().entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); // We do not want to capture cached methods if (method.getImplementationClass() != type) { continue; } RubyString methodName = getRuntime().newString((String) entry.getKey()); if (method.getVisibility().isPublic() && ! result.includes(methodName)) { result.append(methodName); } } } return result; }
|
public RubyArray singleton_methods(IRubyObject[] args) { boolean all = true; if(checkArgumentCount(args,0,1) == 1) { all = args[0].isTrue(); } RubyArray result = getRuntime().newArray(); for (RubyClass type = getMetaClass(); type != null && type instanceof MetaClass; type = type.getSuperClass()) { for (Iterator iter = type.getMethods().entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); // We do not want to capture cached methods if (method.getImplementationClass() != type) { continue; } RubyString methodName = getRuntime().newString((String) entry.getKey()); if (method.getVisibility().isPublic() && ! result.includes(methodName)) { result.append(methodName); } } } return result; }
| 3,237,741
|
public RubyArray singleton_methods() { RubyArray result = getRuntime().newArray(); for (RubyClass type = getMetaClass(); type != null && type instanceof MetaClass; type = type.getSuperClass()) { for (Iterator iter = type.getMethods().entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); // We do not want to capture cached methods if (method.getImplementationClass() != type) { continue; } RubyString methodName = getRuntime().newString((String) entry.getKey()); if (method.getVisibility().isPublic() && ! result.includes(methodName)) { result.append(methodName); } } } return result; }
|
public RubyArray singleton_methods() { RubyArray result = getRuntime().newArray(); for (RubyClass type = getMetaClass(); type != null && ((type instanceof MetaClass) || (all && type.isIncluded())); type = type.getSuperClass()) { for (Iterator iter = type.getMethods().entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); // We do not want to capture cached methods if (method.getImplementationClass() != type) { continue; } RubyString methodName = getRuntime().newString((String) entry.getKey()); if (method.getVisibility().isPublic() && ! result.includes(methodName)) { result.append(methodName); } } } return result; }
| 3,237,742
|
public RubyArray singleton_methods() { RubyArray result = getRuntime().newArray(); for (RubyClass type = getMetaClass(); type != null && type instanceof MetaClass; type = type.getSuperClass()) { for (Iterator iter = type.getMethods().entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); // We do not want to capture cached methods if (method.getImplementationClass() != type) { continue; } RubyString methodName = getRuntime().newString((String) entry.getKey()); if (method.getVisibility().isPublic() && ! result.includes(methodName)) { result.append(methodName); } } } return result; }
|
public RubyArray singleton_methods() { RubyArray result = getRuntime().newArray(); for (RubyClass type = getMetaClass(); type != null && type instanceof MetaClass; type = type.getSuperClass()) { for (Iterator iter = type.getMethods().entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); ICallable method = (ICallable) entry.getValue(); // We do not want to capture cached methods if (method.getImplementationClass() != type && !(all && type.isIncluded())) { continue; } RubyString methodName = getRuntime().newString((String) entry.getKey()); if (method.getVisibility().isPublic() && ! result.includes(methodName)) { result.append(methodName); } } } return result; }
| 3,237,743
|
public Context(final Broker broker) { _broker = broker; _bean = null; _tools = null; _toolbox = null; _locals = null; }
|
public Context(final Broker broker) { _broker = broker; _bean = null; _toolbox = null; _locals = null; }
| 3,237,744
|
public Context(final Broker broker) { _broker = broker; _bean = null; _tools = null; _toolbox = null; _locals = null; }
|
public Context(final Broker broker) { _broker = broker; _bean = null; _tools = null; _toolbox = null; }
| 3,237,745
|
protected Object clone() { try { return super.clone(); } catch (CloneNotSupportedException cnse) { return null; } }
|
public Object clone() { Context c = null; try { return super.clone(); } catch (CloneNotSupportedException cnse) { return null; } }
| 3,237,747
|
protected Object clone() { try { return super.clone(); } catch (CloneNotSupportedException cnse) { return null; } }
|
protected Object clone() { try { return super.clone(); } catch (CloneNotSupportedException cnse) { return null; } }
| 3,237,748
|
public final Object getProperty(final Object[] names) throws PropertyException, InvalidContextException { if (names.length == 0) { return null; } else if (_bean == null) { Object res = get(names[0]); if (names.length == 1) { return res; } return PropertyOperator.getProperty(this,get(names[0]),names,1); } else { return PropertyOperator.getProperty(this,_bean,names); } }
|
public final Object getProperty(final Object[] names) throws PropertyException, InvalidContextException { if (names.length == 0) { return null; } else if (_bean == null) { Object res = get(names[0]); if (names.length == 1) { return res; } return PropertyOperator.getProperty(this,get(names[0]),names,1); } else { return PropertyOperator.getProperty(this,_bean,names); } }
| 3,237,750
|
final public Object getTool(String name) throws InvalidContextException { try { if (_toolbox == null) { return null; } Object ret = (_tools != null) ? _tools.get(name) : null; if (ret == null) { ContextTool tool = (ContextTool) _toolbox.get(name); if (tool != null) { if (_tools == null) { _tools = new HashMap(); } ret = tool.init(this); _tools.put(name,ret); } } return ret; } catch (ClassCastException ce) { throw new InvalidContextException("Tool" + name + " does not implement the ContextTool interface!"); } }
|
final public Object getTool(Object name) throws InvalidContextException { try { if (_toolbox == null) { return null; } Object ret = (_tools != null) ? _tools.get(name) : null; if (ret == null) { ContextTool tool = (ContextTool) _toolbox.get(name); if (tool != null) { if (_tools == null) { _tools = new HashMap(); } ret = tool.init(this); _tools.put(name,ret); } } return ret; } catch (ClassCastException ce) { throw new InvalidContextException("Tool" + name + " does not implement the ContextTool interface!"); } }
| 3,237,751
|
final public boolean setProperty(final Object[] names, final Object value) throws PropertyException, InvalidContextException { if (names.length == 0) { return false; } else if (_bean == null) { if (names.length == 1) { put(names[0], value); return true; } return PropertyOperator.setProperty(this,get(names[0]),names,1,value); } else { return PropertyOperator.setProperty(this,_bean,names,value); } }
|
final public boolean setProperty(final Object[] names, final Object value) throws PropertyException, InvalidContextException { if (names.length == 0) { return false; } else if (_bean == null) { if (names.length == 1) { put(names[0], value); return true; } return PropertyOperator.setProperty(this,get(names[0]),names,1,value); } else { return PropertyOperator.setProperty(this,_bean,names,value); } }
| 3,237,752
|
public void setPaneIndex(int index);
|
public void setPaneIndex(int index);
| 3,237,753
|
HistogramDialog(QuantumPaneManager control, int mini, int maxi, int start, int end, PixelsStatsEntry[] histogramData) { super(control.getReferenceFrame(), "Histogram", true); manager = new HistogramDialogManager(this, control); int yStart, yEnd; yStart = manager.convertRealIntoGraphics(start); yEnd = manager.convertRealIntoGraphics(end); histogramPanel = new HistogramPanel(mini, maxi, start, end, yStart, yEnd, histogramData); manager.initRectangles(yStart, yEnd); manager.attachListeners(); buildGUI(); }
|
HistogramDialog(QuantumPaneManager control, int mini, int maxi, int start, int end, PixelsStatsEntry[] histogramData) { super(control.getReferenceFrame(), "Histogram", true); manager = new HistogramDialogManager(this, control); int yStart, yEnd; yStart = manager.convertRealIntoGraphics(start); yEnd = manager.convertRealIntoGraphics(end); histogramPanel = new HistogramPanel(mini, maxi, start, end, yStart, yEnd, histogramData); manager.initRectangles(yStart, yEnd); manager.attachListeners(); buildGUI(); }
| 3,237,754
|
public void saveRenderingSettings(int pixelsID, int imageID, RenderingDef rDef) throws DSOutOfServiceException, DSAccessException { UserDetails uc = registry.getDataManagementService().getUserDetails(); Criteria c = ImageMapper.buildRenderingSettingsCriteria( STSMapper.IMAGE_GRANULARITY, imageID, uc.getUserID()); List list = (List) gateway.retrieveListSTSData("RenderingSettings", c); //List of renderingSettings to save in DB. List l = new ArrayList(); if (list != null) { if (list.size() == 0) //nothing previously saved by the user. l = saveRSFirstTime(imageID, rDef); else l = saveRS(rDef, list); gateway.updateAttributes(l); } }
|
public void saveRenderingSettings(int pixelsID, int imageID, RenderingDef rDef) throws DSOutOfServiceException, DSAccessException { UserDetails uc = registry.getDataManagementService().getUserDetails(); Criteria c = ImageMapper.buildRenderingSettingsCriteria( STSMapper.IMAGE_GRANULARITY, imageID, uc.getUserID()); List list = (List) gateway.retrieveListSTSData("RenderingSettings", c); //List of renderingSettings to save in DB. List l = new ArrayList(); if (list != null) { if (list.size() == 0) { //nothing previously saved by the user. l = saveRSFirstTime(imageID, rDef); else l = saveRS(rDef, list); gateway.updateAttributes(l); } }
| 3,237,755
|
public void saveRenderingSettings(int pixelsID, int imageID, RenderingDef rDef) throws DSOutOfServiceException, DSAccessException { UserDetails uc = registry.getDataManagementService().getUserDetails(); Criteria c = ImageMapper.buildRenderingSettingsCriteria( STSMapper.IMAGE_GRANULARITY, imageID, uc.getUserID()); List list = (List) gateway.retrieveListSTSData("RenderingSettings", c); //List of renderingSettings to save in DB. List l = new ArrayList(); if (list != null) { if (list.size() == 0) //nothing previously saved by the user. l = saveRSFirstTime(imageID, rDef); else l = saveRS(rDef, list); gateway.updateAttributes(l); } }
|
public void saveRenderingSettings(int pixelsID, int imageID, RenderingDef rDef) throws DSOutOfServiceException, DSAccessException { UserDetails uc = registry.getDataManagementService().getUserDetails(); Criteria c = ImageMapper.buildRenderingSettingsCriteria( STSMapper.IMAGE_GRANULARITY, imageID, uc.getUserID()); List list = (List) gateway.retrieveListSTSData("RenderingSettings", c); //List of renderingSettings to save in DB. List l = new ArrayList(); if (list != null) { if (list.size() == 0) //nothing previously saved by the user. l = saveRSFirstTime(imageID, rDef); gateway.annotateAttributesData(l); } else l = saveRS(rDef, list); gateway.updateAttributes(l); } }
| 3,237,756
|
private JMenu createViewMenu() { JMenu menu = new JMenu("View"); menu.setMnemonic(KeyEvent.VK_V); //menu.add(new JMenuItem(controller.getAction(HiViewerControl.VIEW_PDI))); menu.add(new JMenuItem( controller.getAction(HiViewerControl.VIEW_CGCI))); //menu.add(new JSeparator(JSeparator.HORIZONTAL)); JCheckBoxMenuItem item = new JCheckBoxMenuItem(); item.setSelected(false); item.setText(TreeViewAction.NAME); item.setAction(controller.getAction(HiViewerControl.TREE_VIEW)); //menu.add(item); item = new JCheckBoxMenuItem(); item.setSelected(true); item.setAction(controller.getAction(HiViewerControl.CLIPBOARD_VIEW)); item.setText(ClipBoardViewAction.NAME); //menu.add(item); item = new JCheckBoxMenuItem(); item.setSelected(model.isTitleBarVisible()); item.setAction(controller.getAction(HiViewerControl.SHOW_TITLEBAR)); menu.add(item); //item = new JCheckBoxMenuItem(); //item.setSelected(model.isRollOver()); //item.setAction(controller.getAction(HiViewerControl.ROLL_OVER)); //menu.add(item); menu.add(new JSeparator(SwingConstants.HORIZONTAL)); JMenuItem mi = new JMenuItem( controller.getAction(HiViewerControl.ZOOM_IN)); mi.setText(ZoomInAction.NAME); menu.add(mi); mi = new JMenuItem(controller.getAction(HiViewerControl.ZOOM_OUT)); mi.setText(ZoomOutAction.NAME); menu.add(mi); mi = new JMenuItem(controller.getAction(HiViewerControl.ZOOM_FIT)); mi.setText(ZoomFitAction.NAME); menu.add(mi); menu.add(new JSeparator(SwingConstants.HORIZONTAL)); menu.add(createLayoutMenu()); return menu; }
|
private JMenu createViewMenu() { JMenu menu = new JMenu("View"); menu.setMnemonic(KeyEvent.VK_V); //menu.add(new JMenuItem(controller.getAction(HiViewerControl.VIEW_PDI))); menu.add(new JMenuItem( controller.getAction(HiViewerControl.VIEW_CGCI))); //menu.add(new JSeparator(JSeparator.HORIZONTAL)); JCheckBoxMenuItem item = new JCheckBoxMenuItem(); item.setSelected(false); item.setText(TreeViewAction.NAME); item.setAction(controller.getAction(HiViewerControl.TREE_VIEW)); //menu.add(item); item = new JCheckBoxMenuItem(); item.setSelected(true); item.setAction(controller.getAction(HiViewerControl.CLIPBOARD_VIEW)); item.setText(ClipBoardViewAction.NAME); //menu.add(item); item = new JCheckBoxMenuItem(); item.setSelected(model.isTitleBarVisible()); item.setAction(controller.getAction(HiViewerControl.SHOW_TITLEBAR)); menu.add(item); //item = new JCheckBoxMenuItem(); //item.setSelected(model.isRollOver()); //item.setAction(controller.getAction(HiViewerControl.ROLL_OVER)); //menu.add(item); menu.add(new JSeparator(SwingConstants.HORIZONTAL)); JMenuItem mi = new JMenuItem( controller.getAction(HiViewerControl.ZOOM_IN)); mi.setText(ZoomInAction.NAME); menu.add(mi); mi = new JMenuItem(controller.getAction(HiViewerControl.ZOOM_OUT)); mi.setText(ZoomOutAction.NAME); menu.add(mi); mi = new JMenuItem(controller.getAction(HiViewerControl.ZOOM_FIT)); mi.setText(ZoomFitAction.NAME); menu.add(mi); menu.add(new JSeparator(SwingConstants.HORIZONTAL)); menu.add(createLayoutMenu()); return menu; }
| 3,237,757
|
public RubyModule getCBase() { return cBase; }
|
public RubyModule getCBase() { return (RubyModule)getRubyFrame().getCbase().getClassValue(); }
| 3,237,758
|
public void setCBase(RubyModule cBase) { this.cBase = cBase; }
|
public void setCBase(RubyModule cBase) { getRubyFrame().getCbase().setClassValue(cBase); }
| 3,237,759
|
private void processQueue() { // reference queue is sychronized, so no need to do it ourself Node node; while ((node = (Node)queue.poll()) != null) { int hash = (node.hash & 0x7FFFFFFF) % tab.length; Node last=null; synchronized (locks[hash]) { if (!node.cleaned) { Node current = tab[hash]; while (current != null) { // clear other expired weak refs, too, to // prevent the same lock of being taken // more than once. if (current == node) { if (last == null) { tab[hash] = current.next; } else { last.next = current.next; } current.cleaned = true; break; } last = current; current = current.next; } } } } }
|
private void processQueue() { // reference queue is sychronized, so no need to do it ourself Node node; while ((node = (Node)queue.poll()) != null) {int hash = (node.hash & 0x7FFFFFFF) % tab.length;Node last=null;synchronized (locks[hash]) { if (!node.cleaned) { Node current = tab[hash]; while (current != null) {// clear other expired weak refs, too, to// prevent the same lock of being taken// more than once.if (current == node) { if (last == null) { tab[hash] = current.next; } else { last.next = current.next; } current.cleaned = true; break;}last = current;current = current.next; } }} } }
| 3,237,760
|
public IRubyObject setValue(IRubyObject value) { runtime.getLoadService().require("java"); if (value.isKindOf(runtime.getClass("JavaProxy"))) { value = value.getInstanceVariable("java_object"); } value = Java.primitive_to_java(value, value); bean.bean = JavaUtil.convertArgument(value, bean.type); return value; }
|
public IRubyObject setValue(IRubyObject value) { runtime.getLoadService().require("java"); if (value.isKindOf(runtime.getClasses().getClass("JavaProxy"))) { value = value.getInstanceVariable("java_object"); } value = Java.primitive_to_java(value, value); bean.bean = JavaUtil.convertArgument(value, bean.type); return value; }
| 3,237,762
|
private Object convertToJava(IRubyObject value, Class type) { runtime.getLoadService().require("java"); if (value.isKindOf(runtime.getClass("JavaProxy"))) { value = value.getInstanceVariable("java_object"); } value = Java.primitive_to_java(value, value); return JavaUtil.convertArgument(value, type); }
|
private Object convertToJava(IRubyObject value, Class type) { runtime.getLoadService().require("java"); if (value.isKindOf(runtime.getClasses().getClass("JavaProxy"))) { value = value.getInstanceVariable("java_object"); } value = Java.primitive_to_java(value, value); return JavaUtil.convertArgument(value, type); }
| 3,237,763
|
public RubyObject call(Ruby ruby, RubyObject recv, RubyId id, RubyObject[] args, boolean noSuper) { return eval(ruby, recv); }
|
public RubyObject call(Ruby ruby, RubyObject recv, RubyId id, RubyPointer args, boolean noSuper) { return eval(ruby, recv); }
| 3,237,764
|
public RubyObject eval(Ruby ruby, RubyObject self) { // TMP_PROTECT; if (ruby.getRubyFrame().getLastClass() == null) { throw new RubyNameException("superclass method '" + ruby.getRubyFrame().getLastFunc().toName() + "' disabled"); } List argsList = ruby.getRubyFrame().getArgs(); RubyObject[] argsObj = (RubyObject[])argsList.toArray(new RubyObject[argsList.size()]); ruby.getIter().push(ruby.getIter().getIter() != RubyIter.ITER_NOT ? RubyIter.ITER_PRE : RubyIter.ITER_NOT); RubyObject result = ruby.getRubyFrame().getLastClass().getSuperClass().call( ruby.getRubyFrame().getSelf(), ruby.getRubyFrame().getLastFunc(), argsObj, 3); ruby.getIter().pop(); return result; }
|
public RubyObject eval(Ruby ruby, RubyObject self) { // TMP_PROTECT; if (ruby.getRubyFrame().getLastClass() == null) { throw new RubyNameException("superclass method '" + ruby.getRubyFrame().getLastFunc().toName() + "' disabled"); } List argsList = ruby.getRubyFrame().getArgs(); RubyObject[] argsObj = (RubyObject[])argsList.toArray(new RubyObject[argsList.size()]); ruby.getIter().push(ruby.getIter().getIter() != RubyIter.ITER_NOT ? RubyIter.ITER_PRE : RubyIter.ITER_NOT); RubyObject result = ruby.getRubyFrame().getLastClass().getSuperClass().call( ruby.getRubyFrame().getSelf(), ruby.getRubyFrame().getLastFunc(), argsObj, 3); ruby.getIter().pop(); return result; }
| 3,237,765
|
public RubyObject eval(Ruby ruby, RubyObject self) { // TMP_PROTECT; if (ruby.getRubyFrame().getLastClass() == null) { throw new RubyNameException("superclass method '" + ruby.getRubyFrame().getLastFunc().toName() + "' disabled"); } List argsList = ruby.getRubyFrame().getArgs(); RubyObject[] argsObj = (RubyObject[])argsList.toArray(new RubyObject[argsList.size()]); ruby.getIter().push(ruby.getIter().getIter() != RubyIter.ITER_NOT ? RubyIter.ITER_PRE : RubyIter.ITER_NOT); RubyObject result = ruby.getRubyFrame().getLastClass().getSuperClass().call( ruby.getRubyFrame().getSelf(), ruby.getRubyFrame().getLastFunc(), argsObj, 3); ruby.getIter().pop(); return result; }
|
public RubyObject eval(Ruby ruby, RubyObject self) { // TMP_PROTECT; if (ruby.getRubyFrame().getLastClass() == null) { throw new RubyNameException("superclass method '" + ruby.getRubyFrame().getLastFunc().toName() + "' disabled"); } List argsList = ruby.getRubyFrame().getArgs(); RubyObject[] argsObj = (RubyObject[])argsList.toArray(new RubyObject[argsList.size()]); ruby.getIter().push(ruby.getIter().getIter() != RubyIter.ITER_NOT ? RubyIter.ITER_PRE : RubyIter.ITER_NOT); RubyObject result = ruby.getRubyFrame().getLastClass().getSuperClass().call( ruby.getRubyFrame().getSelf(), ruby.getRubyFrame().getLastFunc(), args, 3); ruby.getIter().pop(); return result; }
| 3,237,766
|
public void actionPerformed(ActionEvent e) { if (model.getTreeView() == null) return; model.showTreeView(!model.getTreeView().isDisplay()); }
|
public void actionPerformed(ActionEvent e) { if (model.getTreeView() == null) return; model.showTreeView(!model.getTreeView().isDisplay()); }
| 3,237,767
|
private void createMenuBar() { menuBar = new JToolBar(); menuBar.setBorder(null); menuBar.setRollover(true); menuBar.setFloatable(false); JButton button = new JButton( controller.getAction(BrowserControl.BACKWARD_NAV)); button.setBorderPainted(false); //menuBar.add(button); button = new JButton(controller.getAction(BrowserControl.FORWARD_NAV)); //menuBar.add(button); //menuBar.add(new JSeparator(SwingConstants.VERTICAL)); ButtonGroup group = new ButtonGroup(); JToggleButton b = new JToggleButton(); group.add(b); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); b.setSelected(true); b.setAction(controller.getAction(BrowserControl.SORT)); menuBar.add(b); b = new JToggleButton(controller.getAction(BrowserControl.SORT_DATE)); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); group.add(b); //b.setBorderPainted(false); menuBar.add(b); button = new JButton(controller.getAction(BrowserControl.FILTER_MENU)); button.addMouseListener((FilterMenuAction) controller.getAction(BrowserControl.FILTER_MENU)); button.setBorderPainted(false); menuBar.add(button); menuBar.add(new JSeparator(SwingConstants.VERTICAL)); button = new JButton(controller.getAction(BrowserControl.COLLAPSE)); button.setBorderPainted(false); menuBar.add(button); }
|
privatevoidcreateMenuBar(){menuBar=newJToolBar();menuBar.setBorder(null);menuBar.setRollover(true);menuBar.setFloatable(false);JButtonbutton=newJButton(controller.getAction(BrowserControl.BACKWARD_NAV));button.setBorderPainted(false);//menuBar.add(button);button=newJButton(controller.getAction(BrowserControl.FORWARD_NAV));//menuBar.add(button);//menuBar.add(newJSeparator(SwingConstants.VERTICAL));ButtonGroupgroup=newButtonGroup();JToggleButtonb=newJToggleButton();group.add(b);//UIUtilities.unifiedButtonLookAndFeel(b);b.setBorderPainted(true);b.setSelected(true);b.setAction(controller.getAction(BrowserControl.SORT));menuBar.add(b);b=newJToggleButton(controller.getAction(BrowserControl.SORT_DATE));//UIUtilities.unifiedButtonLookAndFeel(b);b.setBorderPainted(true);group.add(b);//b.setBorderPainted(false);menuBar.add(b);button=newJButton(controller.getAction(BrowserControl.FILTER_MENU));button.addMouseListener((FilterMenuAction)controller.getAction(BrowserControl.FILTER_MENU));button.setBorderPainted(false);menuBar.add(button);menuBar.add(newJSeparator(SwingConstants.VERTICAL));button=newJButton(controller.getAction(BrowserControl.COLLAPSE));button.setBorderPainted(false);menuBar.add(button);}
| 3,237,770
|
private void createMenuBar() { menuBar = new JToolBar(); menuBar.setBorder(null); menuBar.setRollover(true); menuBar.setFloatable(false); JButton button = new JButton( controller.getAction(BrowserControl.BACKWARD_NAV)); button.setBorderPainted(false); //menuBar.add(button); button = new JButton(controller.getAction(BrowserControl.FORWARD_NAV)); //menuBar.add(button); //menuBar.add(new JSeparator(SwingConstants.VERTICAL)); ButtonGroup group = new ButtonGroup(); JToggleButton b = new JToggleButton(); group.add(b); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); b.setSelected(true); b.setAction(controller.getAction(BrowserControl.SORT)); menuBar.add(b); b = new JToggleButton(controller.getAction(BrowserControl.SORT_DATE)); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); group.add(b); //b.setBorderPainted(false); menuBar.add(b); button = new JButton(controller.getAction(BrowserControl.FILTER_MENU)); button.addMouseListener((FilterMenuAction) controller.getAction(BrowserControl.FILTER_MENU)); button.setBorderPainted(false); menuBar.add(button); menuBar.add(new JSeparator(SwingConstants.VERTICAL)); button = new JButton(controller.getAction(BrowserControl.COLLAPSE)); button.setBorderPainted(false); menuBar.add(button); }
|
private void createMenuBar() { menuBar = new JToolBar(); menuBar.setBorder(null); menuBar.setRollover(true); menuBar.setFloatable(false); JButton button = new JButton( controller.getAction(BrowserControl.BACKWARD_NAV)); button.setBorderPainted(false); //menuBar.add(button); button = new JButton(controller.getAction(BrowserControl.FORWARD_NAV)); //menuBar.add(button); //menuBar.add(new JSeparator(SwingConstants.VERTICAL)); ButtonGroup group = new ButtonGroup(); JToggleButton b = new JToggleButton(); group.add(b); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); b.setSelected(true); b.setAction(controller.getAction(BrowserControl.SORT)); menuBar.add(b); b = new JToggleButton(controller.getAction(BrowserControl.SORT_DATE)); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); group.add(b); //b.setBorderPainted(false); menuBar.add(b); button = new JButton(controller.getAction(BrowserControl.FILTER_MENU)); button.addMouseListener((FilterMenuAction) controller.getAction(BrowserControl.FILTER_MENU)); button.setBorderPainted(false); menuBar.add(button); menuBar.add(new JSeparator(SwingConstants.VERTICAL)); button = new JButton(controller.getAction(BrowserControl.COLLAPSE)); button.setBorderPainted(false); menuBar.add(button); }
| 3,237,771
|
private void createMenuBar() { menuBar = new JToolBar(); menuBar.setBorder(null); menuBar.setRollover(true); menuBar.setFloatable(false); JButton button = new JButton( controller.getAction(BrowserControl.BACKWARD_NAV)); button.setBorderPainted(false); //menuBar.add(button); button = new JButton(controller.getAction(BrowserControl.FORWARD_NAV)); //menuBar.add(button); //menuBar.add(new JSeparator(SwingConstants.VERTICAL)); ButtonGroup group = new ButtonGroup(); JToggleButton b = new JToggleButton(); group.add(b); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); b.setSelected(true); b.setAction(controller.getAction(BrowserControl.SORT)); menuBar.add(b); b = new JToggleButton(controller.getAction(BrowserControl.SORT_DATE)); //UIUtilities.unifiedButtonLookAndFeel(b); b.setBorderPainted(true); group.add(b); //b.setBorderPainted(false); menuBar.add(b); button = new JButton(controller.getAction(BrowserControl.FILTER_MENU)); button.addMouseListener((FilterMenuAction) controller.getAction(BrowserControl.FILTER_MENU)); button.setBorderPainted(false); menuBar.add(button); menuBar.add(new JSeparator(SwingConstants.VERTICAL)); button = new JButton(controller.getAction(BrowserControl.COLLAPSE)); button.setBorderPainted(false); menuBar.add(button); }
|
private void createMenuBar(){menuBar = new JToolBar();menuBar.setBorder(null);menuBar.setRollover(true);menuBar.setFloatable(false);JButton button = new JButton(controller.getAction(BrowserControl.BACKWARD_NAV));button.setBorderPainted(false);//menuBar.add(button);button = new JButton(controller.getAction(BrowserControl.FORWARD_NAV));//menuBar.add(button);//menuBar.add(new JSeparator(SwingConstants.VERTICAL));ButtonGroup group = new ButtonGroup();JToggleButton b = new JToggleButton();group.add(b);//UIUtilities.unifiedButtonLookAndFeel(b);b.setBorderPainted(true);b.setSelected(true);b.setAction(controller.getAction(BrowserControl.SORT));menuBar.add(b);b = new JToggleButton(controller.getAction(BrowserControl.SORT_DATE));//UIUtilities.unifiedButtonLookAndFeel(b);b.setBorderPainted(true);group.add(b);//b.setBorderPainted(false);menuBar.add(b);button = new JButton(controller.getAction(BrowserControl.FILTER_MENU));button.addMouseListener((FilterMenuAction) controller.getAction(BrowserControl.FILTER_MENU));button.setBorderPainted(false);menuBar.add(button);menuBar.add(new JSeparator(SwingConstants.VERTICAL));button = new JButton(controller.getAction(BrowserControl.COLLAPSE));button.setBorderPainted(false);menuBar.add(button);}
| 3,237,772
|
public static File createTempFile(String prefix, String suffix) throws IOException { File file = File.createTempFile(prefix, suffix); return new NormalizedFile(file.getPath()); }
|
public static File createTempFile(String prefix, String suffix) throws IOException { File file = File.createTempFile(prefix, suffix); return new NormalizedFile(file.getPath()); }
| 3,237,774
|
public Object build(BuildContext bc) throws BuildException { MacroDefinition md = bc.getMacro(name); if (md == null) throw new BuildException("No such macro " + name); Object[] args = (Object[]) argsBuilder.buildAsArray(bc); return md.expand(args, bc); }
|
public Object build(BuildContext bc) throws BuildException { MacroDefinition md = bc.getMacro(name); if (md == null) throw new BuildException("No such macro " + name); Object[] args = argsBuilder.buildAsArray(bc); return md.expand(args, bc); }
| 3,237,775
|
public static RubyModule createKernelModule(IRuby runtime) { RubyModule module = runtime.defineModule("Kernel"); CallbackFactory callbackFactory = runtime.callbackFactory(RubyKernel.class); module.defineModuleFunction("Array", callbackFactory.getSingletonMethod("new_array", IRubyObject.class)); module.defineModuleFunction("Float", callbackFactory.getSingletonMethod("new_float", IRubyObject.class)); module.defineModuleFunction("Integer", callbackFactory.getSingletonMethod("new_integer", IRubyObject.class)); module.defineModuleFunction("String", callbackFactory.getSingletonMethod("new_string", IRubyObject.class)); module.defineModuleFunction("`", callbackFactory.getSingletonMethod("backquote", IRubyObject.class)); // TODO: Implement Kernel#abort module.defineModuleFunction("at_exit", callbackFactory.getSingletonMethod("at_exit")); module.defineModuleFunction("autoload", callbackFactory.getSingletonMethod("autoload", IRubyObject.class, IRubyObject.class)); // TODO: Implement Kernel#autoload? // TODO: Implement Kernel#binding module.defineModuleFunction("block_given?", callbackFactory.getSingletonMethod("block_given")); // TODO: Implement Kernel#callcc module.defineModuleFunction("caller", callbackFactory.getOptSingletonMethod("caller")); module.defineModuleFunction("catch", callbackFactory.getSingletonMethod("rbCatch", IRubyObject.class)); module.defineModuleFunction("chomp", callbackFactory.getOptSingletonMethod("chomp")); module.defineModuleFunction("chomp!", callbackFactory.getOptSingletonMethod("chomp_bang")); module.defineModuleFunction("chop", callbackFactory.getSingletonMethod("chop")); module.defineModuleFunction("chop!", callbackFactory.getSingletonMethod("chop_bang")); module.defineModuleFunction("eval", callbackFactory.getOptSingletonMethod("eval")); // TODO: Implement Kernel#exec module.defineModuleFunction("exit", callbackFactory.getOptSingletonMethod("exit")); // TODO: Implement Kernel#exit! module.defineModuleFunction("fail", callbackFactory.getOptSingletonMethod("raise")); // TODO: Implement Kernel#fork module.defineModuleFunction("format", callbackFactory.getOptSingletonMethod("sprintf")); module.defineModuleFunction("gets", callbackFactory.getOptSingletonMethod("gets")); module.defineModuleFunction("global_variables", callbackFactory.getSingletonMethod("global_variables")); module.defineModuleFunction("gsub", callbackFactory.getOptSingletonMethod("gsub")); module.defineModuleFunction("gsub!", callbackFactory.getOptSingletonMethod("gsub_bang")); // TODO: Add deprecation to Kernel#iterator? (maybe formal deprecation mech.) module.defineAlias("iterator?", "block_given?"); module.defineModuleFunction("lambda", callbackFactory.getSingletonMethod("proc")); module.defineModuleFunction("load", callbackFactory.getOptSingletonMethod("load")); module.defineModuleFunction("local_variables", callbackFactory.getSingletonMethod("local_variables")); module.defineModuleFunction("loop", callbackFactory.getSingletonMethod("loop")); // Note: method_missing is documented as being in Object, but ruby appears to stick it in Kernel. module.defineModuleFunction("method_missing", callbackFactory.getOptSingletonMethod("method_missing")); module.defineModuleFunction("open", callbackFactory.getOptSingletonMethod("open")); module.defineModuleFunction("p", callbackFactory.getOptSingletonMethod("p")); module.defineModuleFunction("print", callbackFactory.getOptSingletonMethod("print")); module.defineModuleFunction("printf", callbackFactory.getOptSingletonMethod("printf")); module.defineModuleFunction("proc", callbackFactory.getSingletonMethod("proc")); // TODO: implement Kernel#putc module.defineModuleFunction("puts", callbackFactory.getOptSingletonMethod("puts")); module.defineAlias("raise", "fail"); module.defineModuleFunction("rand", callbackFactory.getOptSingletonMethod("rand")); module.defineModuleFunction("readline", callbackFactory.getOptSingletonMethod("readline")); module.defineModuleFunction("readlines", callbackFactory.getOptSingletonMethod("readlines")); module.defineModuleFunction("require", callbackFactory.getSingletonMethod("require", IRubyObject.class)); module.defineModuleFunction("scan", callbackFactory.getSingletonMethod("scan", IRubyObject.class)); // TODO: Implement Kernel#select module.defineModuleFunction("set_trace_func", callbackFactory.getSingletonMethod("set_trace_func", IRubyObject.class)); module.defineModuleFunction("sleep", callbackFactory.getSingletonMethod("sleep", IRubyObject.class)); module.defineModuleFunction("split", callbackFactory.getOptSingletonMethod("split")); module.defineAlias("sprintf", "format"); module.defineModuleFunction("srand", callbackFactory.getOptSingletonMethod("srand")); module.defineModuleFunction("sub", callbackFactory.getOptSingletonMethod("sub")); module.defineModuleFunction("sub!", callbackFactory.getOptSingletonMethod("sub_bang")); // Skipping: Kernel#syscall (too system dependent) module.defineModuleFunction("system", callbackFactory.getOptSingletonMethod("system")); // TODO: Implement Kernel#test (partial impl) module.defineModuleFunction("throw", callbackFactory.getOptSingletonMethod("rbThrow")); // TODO: Implement Kernel#trace_var // TODO: Implement Kernel#trap // TODO: Implement Kernel#untrace_var // TODO: Implement Kernel#warn // Defined p411 Pickaxe 2nd ed. module.defineModuleFunction("singleton_method_added", callbackFactory.getSingletonMethod("singleton_method_added", IRubyObject.class)); return module; }
|
module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); publicmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); staticmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); RubyModulemodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); createKernelModule(IRubymodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); runtime)module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); {module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); RubyModulemodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); modulemodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); =module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); runtime.defineModule("Kernel");module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); CallbackFactorymodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactorymodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); =module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); runtime.callbackFactory(RubyKernel.class);module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("Array",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("new_array",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("Float",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("new_float",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("Integer",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("new_integer",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("String",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("new_string",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("`",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("backquote",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#abortmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("at_exit",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("at_exit"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("autoload",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("autoload",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class,module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#autoload?module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#bindingmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("block_given?",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("block_given"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#callccmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("caller",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("caller"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("catch",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("rbCatch",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("chomp",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("chomp"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("chomp!",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("chomp_bang"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("chop",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("chop"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("chop!",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("chop_bang"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("eval",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("eval"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#execmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("exit",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("exit"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#exit!module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("fail",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("raise"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#forkmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("format",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("sprintf"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("gets",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("gets"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("global_variables",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("global_variables"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("gsub",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("gsub"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("gsub!",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("gsub_bang"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Addmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); deprecationmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); tomodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#iterator?module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); (maybemodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); formalmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); deprecationmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); mech.)module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineAlias("iterator?",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); "block_given?");module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("lambda",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("proc"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("load",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("load"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("local_variables",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("local_variables"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("loop",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("loop"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Note:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); method_missingmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); ismodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); documentedmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); asmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); beingmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); inmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Object,module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); butmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); rubymodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); appearsmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); tomodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); stickmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); itmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); inmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel.module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("method_missing",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("method_missing"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("open",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("open"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("p",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("p"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("print",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("print"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("printf",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("printf"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("proc",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("proc"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#putcmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("puts",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("puts"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineAlias("raise",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); "fail");module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("rand",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("rand"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("readline",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("readline"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("readlines",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("readlines"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("require",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("require",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("scan",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("scan",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#selectmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("set_trace_func",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("set_trace_func",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("sleep",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("sleep",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("split",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("split"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineAlias("sprintf",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); "format");module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("srand",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("srand"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("sub",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("sub"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("sub!",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("sub_bang"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Skipping:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#syscallmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); (toomodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); systemmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); dependent)module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("system",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("system"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#testmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); (partialmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); impl)module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("throw",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getOptSingletonMethod("rbThrow"));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#trace_varmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#trapmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#untrace_varmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); TODO:module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Implementmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Kernel#warnmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); //module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Definedmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); p411module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); Pickaxemodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); 2ndmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); ed.module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("singleton_method_added",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); callbackFactory.getSingletonMethod("singleton_method_added",module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); IRubyObject.class));module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); returnmodule.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module;module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); }
| 3,237,777
|
public static IRubyObject rbThrow(IRubyObject recv, IRubyObject[] args) { IRuby runtime = recv.getRuntime(); JumpException je = new JumpException(JumpException.JumpType.ThrowJump); String tag = args[0].asSymbol(); IRubyObject value = args.length > 1 ? args[1] : recv.getRuntime().getNil(); RubyException nameException = new RubyException(runtime, runtime.getClass("NameError"), "uncaught throw '" + tag + '\''); je.setPrimaryData(tag); je.setSecondaryData(value); je.setTertiaryData(nameException); throw je; }
|
public static IRubyObject rbThrow(IRubyObject recv, IRubyObject[] args) { IRuby runtime = recv.getRuntime(); JumpException je = new JumpException(JumpException.JumpType.ThrowJump); String tag = args[0].asSymbol(); IRubyObject value = args.length > 1 ? args[1] : recv.getRuntime().getNil(); RubyException nameException = new RubyException(runtime, runtime.getClass("NameError"), "uncaught throw '" + tag + '\''); je.setPrimaryData(tag); je.setSecondaryData(value); je.setTertiaryData(nameException); throw je; }
| 3,237,778
|
public RubyClass newSubClass(String name, RubyModule parent) { return new IntegerMetaClass(name, this, parent); }
|
public RubyClass newSubClass(String name, RubyModule parent) { return new IntegerMetaClass(name, this, parent); }
| 3,237,779
|
public static void autoJoinConferenceRoom(final String roomName, String roomJID, String password) { ChatManager chatManager = SparkManager.getChatManager(); final MultiUserChat groupChat = new MultiUserChat(SparkManager.getConnection(), roomJID); LocalPreferences pref = SettingsManager.getLocalPreferences(); final String nickname = pref.getNickname().trim(); try { GroupChatRoom chatRoom = (GroupChatRoom)chatManager.getChatContainer().getChatRoom(roomJID); MultiUserChat muc = chatRoom.getMultiUserChat(); if (!muc.isJoined()) { joinRoom(muc, nickname, password); } chatManager.getChatContainer().activateChatRoom(chatRoom); return; } catch (ChatRoomNotFoundException e) { } final GroupChatRoom room = new GroupChatRoom(groupChat); room.setTabTitle(roomName); if (requiresPassword(roomJID) && password == null) { password = JOptionPane.showInputDialog(null, "Enter Room Password", "Need Password", JOptionPane.QUESTION_MESSAGE); if (!ModelUtil.hasLength(password)) { return; } } final List errors = new ArrayList(); final String userPassword = password; final SwingWorker startChat = new SwingWorker() { public Object construct() { if (!groupChat.isJoined()) { int groupChatCounter = 0; while (true) { groupChatCounter++; String joinName = nickname; if (groupChatCounter > 1) { joinName = joinName + groupChatCounter; } if (groupChatCounter < 10) { try { if (ModelUtil.hasLength(userPassword)) { groupChat.join(joinName, userPassword); } else { groupChat.join(joinName); } break; } catch (XMPPException ex) { int code = 0; if (ex.getXMPPError() != null) { code = ex.getXMPPError().getCode(); } if (code == 0) { errors.add("No response from server."); } else if (code == 401) { errors.add("The password did not match the room's password."); } else if (code == 403) { errors.add("You have been banned from this room."); } else if (code == 404) { errors.add("The room you are trying to enter does not exist."); } else if (code == 407) { errors.add("You are not a member of this room.\nThis room requires you to be a member to join."); } else if (code != 409) { break; } } } else { break; } } } return "ok"; } public void finished() { if (errors.size() > 0) { String error = (String)errors.get(0); JOptionPane.showMessageDialog(SparkManager.getMainWindow(), error, "Unable to join the room at this time.", JOptionPane.ERROR_MESSAGE); return; } else if (groupChat.isJoined()) { ChatManager chatManager = SparkManager.getChatManager(); chatManager.getChatContainer().addChatRoom(room); chatManager.getChatContainer().activateChatRoom(room); } else { JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to join the room.", "Error", JOptionPane.ERROR_MESSAGE); return; } } }; startChat.start(); }
|
public static void autoJoinConferenceRoom(final String roomName, String roomJID, String password) { ChatManager chatManager = SparkManager.getChatManager(); final MultiUserChat groupChat = new MultiUserChat(SparkManager.getConnection(), roomJID); LocalPreferences pref = SettingsManager.getLocalPreferences(); final String nickname = pref.getNickname().trim(); try { GroupChatRoom chatRoom = (GroupChatRoom)chatManager.getChatContainer().getChatRoom(roomJID); MultiUserChat muc = chatRoom.getMultiUserChat(); if (!muc.isJoined()) { joinRoom(muc, nickname, password); } chatManager.getChatContainer().activateChatRoom(chatRoom); return; } catch (ChatRoomNotFoundException e) { } final GroupChatRoom room = new GroupChatRoom(groupChat); room.setTabTitle(roomName); if (requiresPassword(roomJID) && password == null) { password = JOptionPane.showInputDialog(null, Res.getString("message.enter.room.password"), Res.getString("title.password"), JOptionPane.QUESTION_MESSAGE); if (!ModelUtil.hasLength(password)) { return; } } final List errors = new ArrayList(); final String userPassword = password; final SwingWorker startChat = new SwingWorker() { public Object construct() { if (!groupChat.isJoined()) { int groupChatCounter = 0; while (true) { groupChatCounter++; String joinName = nickname; if (groupChatCounter > 1) { joinName = joinName + groupChatCounter; } if (groupChatCounter < 10) { try { if (ModelUtil.hasLength(userPassword)) { groupChat.join(joinName, userPassword); } else { groupChat.join(joinName); } break; } catch (XMPPException ex) { int code = 0; if (ex.getXMPPError() != null) { code = ex.getXMPPError().getCode(); } if (code == 0) { errors.add("No response from server."); } else if (code == 401) { errors.add("The password did not match the room's password."); } else if (code == 403) { errors.add("You have been banned from this room."); } else if (code == 404) { errors.add("The room you are trying to enter does not exist."); } else if (code == 407) { errors.add("You are not a member of this room.\nThis room requires you to be a member to join."); } else if (code != 409) { break; } } } else { break; } } } return "ok"; } public void finished() { if (errors.size() > 0) { String error = (String)errors.get(0); JOptionPane.showMessageDialog(SparkManager.getMainWindow(), error, "Unable to join the room at this time.", JOptionPane.ERROR_MESSAGE); return; } else if (groupChat.isJoined()) { ChatManager chatManager = SparkManager.getChatManager(); chatManager.getChatContainer().addChatRoom(room); chatManager.getChatContainer().activateChatRoom(room); } else { JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to join the room.", "Error", JOptionPane.ERROR_MESSAGE); return; } } }; startChat.start(); }
| 3,237,780
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
| 3,237,781
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
| 3,237,782
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
| 3,237,783
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
| 3,237,784
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
|
public void execute() throws BuildException { Header.print(System.out); getJava().createArg().setValue("--format"); getJava().createArg().setValue(format); if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } getJava().createArg().setValue("--destination"); getJava().createArg().setValue(destDir.toString()); getJava().createArg().setValue("--source"); getJava().createArg().setValue(src.toString()); if (getJava().executeJava() != 0) { throw new BuildException("Error generating report. See messages above."); } }
| 3,237,785
|
public void setDataFile(String dataFile) { this.dataFile = dataFile; }
|
public void setDataFile(String dataFile) { this.dataFile = dataFile; }
| 3,237,787
|
public void setDestDir(File destDir) { this.destDir = destDir; }
|
public void setDestDir(File destDir) { this.destDir = destDir; }
| 3,237,788
|
public void setFormat(String format) { this.format = format; }
|
public void setFormat(String format) { this.format = format; }
| 3,237,789
|
public void setSrcDir(Path srcDir) { if (src == null) { src = srcDir; } else { src.append(srcDir); } }
|
public void setSrcDir(Path srcDir) { if (src == null) { src = srcDir; } else { src.append(srcDir); } }
| 3,237,790
|
public static IRubyObject exit(IRubyObject recv, IRubyObject args[]) { int status = 0; if (args.length > 0) { status = RubyNumeric.fix2int(args[0]); } System.exit(status); return recv.getRuntime().getNil(); }
|
publicstaticIRubyObjectexit(IRubyObjectrecv,IRubyObjectargs[]){intstatus=0;if(args.length>0){status=RubyNumeric.fix2int(args[0]);}System.exit(status);returnrecv.getRuntime().getNil();}
| 3,237,791
|
public static IRubyObject exit(IRubyObject recv, IRubyObject args[]) { int status = 0; if (args.length > 0) { status = RubyNumeric.fix2int(args[0]); } System.exit(status); return recv.getRuntime().getNil(); }
|
public static IRubyObject exit(IRubyObject recv, IRubyObject args[]) { int status = 0; if (args.length > 0) { status = RubyNumeric.fix2int(args[0]); } System.exit(status); return recv.getRuntime().getNil(); }
| 3,237,792
|
public void propertyChange(PropertyChangeEvent pce) { String propName = pce.getPropertyName(); if (Browser.POPUP_POINT_PROPERTY.equals(propName)) { Browser browser = model.getBrowser(); if (browser == null) return; ImageDisplay d = browser.getLastSelectedDisplay(); Point p = browser.getPopupPoint(); if (d != null && p != null) view.showPopup(d, p); } else if (Browser.THUMB_SELECTED_PROPERTY.equals(propName)) { ImageNode d = (ImageNode) pce.getNewValue(); if (d != null) ThumbWinManager.display(d, model); } else if (Browser.SELECTED_DISPLAY_PROPERTY.equals(propName)) { TreeView treeView = model.getTreeView(); if (treeView == null) return; Browser browser = model.getBrowser(); if (browser == null) return; ImageDisplay d = browser.getLastSelectedDisplay(); treeView.accept(new SelectedNodeVisitor(treeView, d)); } else if (TreeView.TREE_POPUP_POINT_PROPERTY.equals(propName)) { TreeView treeView = model.getTreeView(); if (treeView == null) return; //tree shouldn't be null Point p = treeView.getPopupPoint(); if (p != null) view.showPopup(((JComponent) pce.getNewValue()), p); } else if (TreeView.CLOSE_PROPERTY.equals(propName)) { model.showTreeView(false); } else if (TreeView.TREE_SELECTED_DISPLAY_PROPERTY.equals(propName)) { TreeView treeView = model.getTreeView(); if (treeView == null) return; //tree shouldn't be null Browser browser = model.getBrowser(); ImageDisplay img = (ImageDisplay) pce.getNewValue(); if (img != null) { if (!(img.equals(browser.getLastSelectedDisplay()))) browser.setSelectedDisplay(img); } else browser.setSelectedDisplay(img); } else if (HiViewer.SCROLL_TO_NODE_PROPERTY.equals(propName)) { scrollToNode((ImageDisplay) pce.getNewValue()); } else if (Browser.ANNOTATED_NODE_PROPERTY.equals(propName)) { ImageDisplay n = (ImageDisplay) pce.getNewValue(); model.getClipBoard().setSelectedPane(ClipBoard.ANNOTATION_PANE, n); model.getBrowser().setSelectedDisplay(n); } else if (Browser.CLASSIFIED_NODE_PROPERTY.equals(propName)) { ImageDisplay n = (ImageDisplay) pce.getNewValue(); model.getClipBoard().setSelectedPane(ClipBoard.CLASSIFICATION_PANE, n); model.getBrowser().setSelectedDisplay(n); } else if (Browser.ROLL_OVER_PROPERTY.equals(propName)) { if (model.isRollOver()) { ImageDisplay n = (ImageDisplay) pce.getNewValue(); if (n instanceof ImageNode) ThumbWinManager.rollOverDisplay((ImageNode) n, model.getBrowser()); else ThumbWinManager.rollOverDisplay(null, model.getBrowser()); } } else if (TreeView.REMOVE_ROLL_OVER_PROPERTY.equals(propName) || ClipBoard.REMOVE_ROLL_OVER_PROPERTY.equals(propName)) { if (model.isRollOver()) { ThumbWinManager.rollOverDisplay(null, model.getBrowser()); } } else if (propName.equals(DataHandler.ANNOTATED_PROPERTY)) { if (view.getDataHandler() == null) return; //TODO: refresh view.discardDataHandler(); } }
|
publicvoidpropertyChange(PropertyChangeEventpce){StringpropName=pce.getPropertyName();if(Browser.POPUP_POINT_PROPERTY.equals(propName)){Browserbrowser=model.getBrowser();if(browser==null)return;ImageDisplayd=browser.getLastSelectedDisplay();Pointp=browser.getPopupPoint();if(d!=null&&p!=null)view.showPopup(d,p);}elseif(Browser.THUMB_SELECTED_PROPERTY.equals(propName)){ImageNoded=(ImageNode)pce.getNewValue();if(d!=null)ThumbWinManager.display(d,model);}elseif(Browser.SELECTED_DISPLAY_PROPERTY.equals(propName)){ TreeViewtreeView=model.getTreeView(); if(treeView==null)return; Browserbrowser=model.getBrowser();if(browser==null)return; ImageDisplayd=browser.getLastSelectedDisplay(); treeView.accept(newSelectedNodeVisitor(treeView,d));}elseif(TreeView.TREE_POPUP_POINT_PROPERTY.equals(propName)){TreeViewtreeView=model.getTreeView();if(treeView==null)return;//treeshouldn'tbenullPointp=treeView.getPopupPoint();if(p!=null)view.showPopup(((JComponent)pce.getNewValue()),p);}elseif(TreeView.CLOSE_PROPERTY.equals(propName)){model.showTreeView(false);}elseif(TreeView.TREE_SELECTED_DISPLAY_PROPERTY.equals(propName)){TreeViewtreeView=model.getTreeView();if(treeView==null)return;//treeshouldn'tbenullBrowserbrowser=model.getBrowser();ImageDisplayimg=(ImageDisplay)pce.getNewValue();if(img!=null){if(!(img.equals(browser.getLastSelectedDisplay())))browser.setSelectedDisplay(img);}elsebrowser.setSelectedDisplay(img);}elseif(HiViewer.SCROLL_TO_NODE_PROPERTY.equals(propName)){scrollToNode((ImageDisplay)pce.getNewValue());}elseif(Browser.ANNOTATED_NODE_PROPERTY.equals(propName)){ImageDisplayn=(ImageDisplay)pce.getNewValue();model.getClipBoard().setSelectedPane(ClipBoard.ANNOTATION_PANE,n);model.getBrowser().setSelectedDisplay(n);}elseif(Browser.CLASSIFIED_NODE_PROPERTY.equals(propName)){ImageDisplayn=(ImageDisplay)pce.getNewValue();model.getClipBoard().setSelectedPane(ClipBoard.CLASSIFICATION_PANE,n);model.getBrowser().setSelectedDisplay(n);}elseif(Browser.ROLL_OVER_PROPERTY.equals(propName)){if(model.isRollOver()){ImageDisplayn=(ImageDisplay)pce.getNewValue();if(ninstanceofImageNode)ThumbWinManager.rollOverDisplay((ImageNode)n,model.getBrowser());elseThumbWinManager.rollOverDisplay(null,model.getBrowser());}}elseif(TreeView.REMOVE_ROLL_OVER_PROPERTY.equals(propName)|| ClipBoard.REMOVE_ROLL_OVER_PROPERTY.equals(propName)){if(model.isRollOver()){ ThumbWinManager.rollOverDisplay(null,model.getBrowser());}}elseif(propName.equals(DataHandler.ANNOTATED_PROPERTY)){ if(view.getDataHandler()==null)return; //TODO:refresh view.discardDataHandler();} }
| 3,237,793
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.