Added license to source code

This commit is contained in:
Jindra Pet��k
2010-09-08 11:38:16 +02:00
parent 01f7d0fa72
commit c9e01ed9d2
568 changed files with 25967 additions and 17089 deletions
+450 -378
View File
@@ -1,378 +1,450 @@
package com.jpexs.asdec;
import com.jpexs.asdec.abc.NotSameException;
import com.jpexs.asdec.gui.LoadingDialog;
import com.jpexs.asdec.gui.ModeFrame;
import com.jpexs.asdec.gui.View;
import com.jpexs.asdec.gui.proxy.ProxyFrame;
import com.jpexs.asdec.tags.DoABCTag;
import com.jpexs.asdec.tags.Tag;
import com.jpexs.proxy.Replacement;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* Main executable class
*
* @author JPEXS
*/
public class Main {
public static com.jpexs.asdec.abc.gui.MainFrame abcMainFrame;
public static com.jpexs.asdec.action.gui.MainFrame actionMainFrame;
public static ProxyFrame proxyFrame;
public static String file;
public static String maskURL;
public static SWF swf;
public static final String version = "alpha7";
public static String applicationName = "JP ActionScript Decompiler v." + version;
public static LoadingDialog loadingDialog = new LoadingDialog();
public static ModeFrame modeFrame;
private static boolean working = false;
private static TrayIcon trayIcon;
private static MenuItem stopMenuItem;
public static boolean DEBUG_COPY = false;
public static boolean DEBUG_MODE = false;
public static boolean DISABLE_DANGEROUS = false;
public static String getFileTitle() {
if (maskURL != null) return maskURL;
return file;
}
/**
* List of replacements
*/
public static java.util.List<Replacement> replacements = new ArrayList<Replacement>();
private static String getASDecHome() {
String dir = ".";//System.getProperty("user.home");
if (!dir.endsWith(File.separator)) dir += File.separator;
dir += "config" + File.separator;
return dir;
}
private static String getReplacementsFile() {
return getASDecHome() + "replacements.ini";
}
/**
* Saves replacements to file for future use
*/
public static void saveReplacements() {
try {
File f = new File(getASDecHome());
if (!f.exists()) f.mkdir();
PrintWriter pw = new PrintWriter(new FileWriter(getReplacementsFile()));
for (Replacement r : replacements) {
pw.println(r.urlPattern);
pw.println(r.targetFile);
}
pw.close();
} catch (IOException e) {
}
}
/**
* Load replacements from file
*/
public static void loadReplacements() {
replacements = new ArrayList<Replacement>();
try {
BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile()));
String s = "";
while ((s = br.readLine()) != null) {
Replacement r = new Replacement(s, br.readLine());
replacements.add(r);
}
br.close();
} catch (IOException e) {
}
}
public static boolean isWorking() {
return working;
}
public static void showProxy() {
if (proxyFrame == null) proxyFrame = new ProxyFrame();
proxyFrame.setVisible(true);
proxyFrame.setState(Frame.NORMAL);
}
public static void startWork(String name) {
working = true;
if(abcMainFrame!=null)
abcMainFrame.setStatus(name);
if(actionMainFrame!=null)
actionMainFrame.setStatus(name);
}
public static void stopWork() {
working = false;
if(abcMainFrame!=null)
abcMainFrame.setStatus("");
if(actionMainFrame!=null)
actionMainFrame.setStatus("");
}
public static SWF parseSWF(String file) throws Exception {
FileInputStream fis = new FileInputStream(file);
SWF locswf = new SWF(fis);
return locswf;
}
public static void saveFile(String outfile) throws IOException {
file = outfile;
swf.saveTo(new FileOutputStream(outfile));
}
private static class OpenFileWorker extends SwingWorker {
@Override
protected Object doInBackground() throws Exception {
try {
swf = parseSWF(Main.file);
FileInputStream fis = new FileInputStream(file);
DEBUG_COPY = true;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
swf.saveTo(baos);
} catch (NotSameException nse) {
if (DEBUG_MODE) {
nse.printStackTrace();
System.exit(0);
}
JOptionPane.showMessageDialog(null, "WARNING: The SWF decompiler may have problems saving this file. Recommended usage is READ ONLY.");
}
DEBUG_COPY = false;
//DEBUG_COPY=true;
} catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Cannot load SWF file.");
loadingDialog.setVisible(false);
return false;
}
List<Tag> listAbc = new ArrayList<Tag>();
for (Tag t : swf.tags) {
if (t instanceof DoABCTag) listAbc.add(t);
}
if (false) {
JOptionPane.showMessageDialog(null, "This SWF file does not contain any ActionScript parts");
loadingDialog.setVisible(false);
if (!openFileDialog()) {
System.exit(0);
}
} else {
if (listAbc.size() > 0) {
List<DoABCTag> listAbc2 = new ArrayList<DoABCTag>();
for (Tag tag : listAbc) {
listAbc2.add((DoABCTag) tag);
}
abcMainFrame = new com.jpexs.asdec.abc.gui.MainFrame(listAbc2);
abcMainFrame.display();
} else {
actionMainFrame = new com.jpexs.asdec.action.gui.MainFrame(swf.tags);
actionMainFrame.display();
}
}
loadingDialog.setVisible(false);
return true;
}
}
public static boolean openFile(String swfFile) {
if (abcMainFrame != null)
abcMainFrame.setVisible(false);
if (actionMainFrame != null)
actionMainFrame.setVisible(false);
Main.file = swfFile;
Main.loadingDialog.setVisible(true);
(new OpenFileWorker()).execute();
return true;
}
public static boolean saveFileDialog(Frame f) {
JFileChooser fc = new JFileChooser();
int returnVal = fc.showSaveDialog(f);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try {
Main.saveFile(file.getAbsolutePath());
maskURL = null;
return true;
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Cannot write to the file");
}
}
return false;
}
public static boolean openFileDialog() {
maskURL = null;
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
return (f.getName().endsWith(".swf")) || (f.isDirectory());
}
@Override
public String getDescription() {
return "SWF files (*.swf)";
}
});
int returnVal = fc.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File selfile = fc.getSelectedFile();
Main.openFile(selfile.getAbsolutePath());
return true;
} else {
return false;
}
}
public static void showModeFrame() {
if (modeFrame == null) modeFrame = new ModeFrame();
modeFrame.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
View.setWinLookAndFeel();
loadReplacements();
if (args.length < 1) {
showModeFrame();
} else {
if (args[0].equals("-proxy")) {
int port = 55555;
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-P")) {
try {
port = Integer.parseInt(args[i].substring(2));
} catch (NumberFormatException nex) {
System.err.println("Bad port number");
}
}
}
if (proxyFrame == null) proxyFrame = new ProxyFrame();
proxyFrame.setPort(port);
addTrayIcon();
switchProxy();
} else {
openFile(args[0]);
}
}
}
public static String tempFile(String url) {
File f = new File(getASDecHome() + "saved" + File.separator);
if (!f.exists()) f.mkdirs();
return getASDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp";
}
public static void removeTrayIcon() {
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
if (trayIcon != null) {
tray.remove(trayIcon);
trayIcon = null;
}
}
}
public static void switchProxy() {
proxyFrame.switchState();
if (stopMenuItem != null) {
if (proxyFrame.isRunning()) {
stopMenuItem.setLabel("Stop proxy");
} else {
stopMenuItem.setLabel("Start proxy");
}
}
}
public static void addTrayIcon() {
if (trayIcon != null) return;
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(View.loadImage("com/jpexs/asdec/gui/graphics/proxy16.png"), "JP ASDec Proxy");
trayIcon.setImageAutoSize(true);
PopupMenu trayPopup = new PopupMenu();
ActionListener trayListener = new ActionListener() {
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("EXIT")) Main.exit();
if (e.getActionCommand().equals("SHOW")) Main.showProxy();
if (e.getActionCommand().equals("SWITCH")) Main.switchProxy();
}
};
MenuItem showMenuItem = new MenuItem("Show proxy");
showMenuItem.setActionCommand("SHOW");
showMenuItem.addActionListener(trayListener);
trayPopup.add(showMenuItem);
stopMenuItem = new MenuItem("Start proxy");
stopMenuItem.setActionCommand("SWITCH");
stopMenuItem.addActionListener(trayListener);
trayPopup.add(stopMenuItem);
trayPopup.addSeparator();
MenuItem exitMenuItem = new MenuItem("Exit");
exitMenuItem.setActionCommand("EXIT");
exitMenuItem.addActionListener(trayListener);
trayPopup.add(exitMenuItem);
trayIcon.setPopupMenu(trayPopup);
trayIcon.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
Main.showProxy();
}
}
});
try {
tray.add(trayIcon);
} catch (AWTException ex) {
}
}
}
public static void exit() {
saveReplacements();
System.exit(0);
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec;
import com.jpexs.asdec.abc.NotSameException;
import com.jpexs.asdec.gui.LoadingDialog;
import com.jpexs.asdec.gui.ModeFrame;
import com.jpexs.asdec.gui.View;
import com.jpexs.asdec.gui.proxy.ProxyFrame;
import com.jpexs.asdec.tags.DoABCTag;
import com.jpexs.asdec.tags.Tag;
import com.jpexs.proxy.Replacement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* Main executable class
*
* @author JPEXS
*/
public class Main {
public static com.jpexs.asdec.abc.gui.MainFrame abcMainFrame;
public static com.jpexs.asdec.action.gui.MainFrame actionMainFrame;
public static ProxyFrame proxyFrame;
public static String file;
public static String maskURL;
public static SWF swf;
public static final String version = "alpha7";
public static String applicationName = "JP ActionScript Decompiler v." + version;
public static LoadingDialog loadingDialog = new LoadingDialog();
public static ModeFrame modeFrame;
private static boolean working = false;
private static TrayIcon trayIcon;
private static MenuItem stopMenuItem;
public static boolean DEBUG_COPY = false;
public static boolean DEBUG_MODE = false;
public static boolean DISABLE_DANGEROUS = false;
public static String getFileTitle() {
if (maskURL != null) return maskURL;
return file;
}
/**
* List of replacements
*/
public static java.util.List<Replacement> replacements = new ArrayList<Replacement>();
private static String getASDecHome() {
String dir = ".";//System.getProperty("user.home");
if (!dir.endsWith(File.separator)) dir += File.separator;
dir += "config" + File.separator;
return dir;
}
private static String getReplacementsFile() {
return getASDecHome() + "replacements.ini";
}
/**
* Saves replacements to file for future use
*/
public static void saveReplacements() {
try {
File f = new File(getASDecHome());
if (!f.exists()) f.mkdir();
PrintWriter pw = new PrintWriter(new FileWriter(getReplacementsFile()));
for (Replacement r : replacements) {
pw.println(r.urlPattern);
pw.println(r.targetFile);
}
pw.close();
} catch (IOException e) {
}
}
/**
* Load replacements from file
*/
public static void loadReplacements() {
replacements = new ArrayList<Replacement>();
try {
BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile()));
String s = "";
while ((s = br.readLine()) != null) {
Replacement r = new Replacement(s, br.readLine());
replacements.add(r);
}
br.close();
} catch (IOException e) {
}
}
public static boolean isWorking() {
return working;
}
public static void showProxy() {
if (proxyFrame == null) proxyFrame = new ProxyFrame();
proxyFrame.setVisible(true);
proxyFrame.setState(Frame.NORMAL);
}
public static void startWork(String name) {
working = true;
if(abcMainFrame!=null)
abcMainFrame.setStatus(name);
if(actionMainFrame!=null)
actionMainFrame.setStatus(name);
}
public static void stopWork() {
working = false;
if(abcMainFrame!=null)
abcMainFrame.setStatus("");
if(actionMainFrame!=null)
actionMainFrame.setStatus("");
}
public static SWF parseSWF(String file) throws Exception {
FileInputStream fis = new FileInputStream(file);
SWF locswf = new SWF(fis);
return locswf;
}
public static void saveFile(String outfile) throws IOException {
file = outfile;
swf.saveTo(new FileOutputStream(outfile));
}
private static class OpenFileWorker extends SwingWorker {
@Override
protected Object doInBackground() throws Exception {
try {
swf = parseSWF(Main.file);
FileInputStream fis = new FileInputStream(file);
DEBUG_COPY = true;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
swf.saveTo(baos);
} catch (NotSameException nse) {
if (DEBUG_MODE) {
nse.printStackTrace();
System.exit(0);
}
JOptionPane.showMessageDialog(null, "WARNING: The SWF decompiler may have problems saving this file. Recommended usage is READ ONLY.");
}
DEBUG_COPY = false;
//DEBUG_COPY=true;
} catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Cannot load SWF file.");
loadingDialog.setVisible(false);
return false;
}
List<Tag> listAbc = new ArrayList<Tag>();
for (Tag t : swf.tags) {
if (t instanceof DoABCTag) listAbc.add(t);
}
if (false) {
JOptionPane.showMessageDialog(null, "This SWF file does not contain any ActionScript parts");
loadingDialog.setVisible(false);
if (!openFileDialog()) {
System.exit(0);
}
} else {
if (listAbc.size() > 0) {
List<DoABCTag> listAbc2 = new ArrayList<DoABCTag>();
for (Tag tag : listAbc) {
listAbc2.add((DoABCTag) tag);
}
abcMainFrame = new com.jpexs.asdec.abc.gui.MainFrame(listAbc2);
abcMainFrame.display();
} else {
actionMainFrame = new com.jpexs.asdec.action.gui.MainFrame(swf.tags);
actionMainFrame.display();
}
}
loadingDialog.setVisible(false);
return true;
}
}
public static boolean openFile(String swfFile) {
if (abcMainFrame != null)
abcMainFrame.setVisible(false);
if (actionMainFrame != null)
actionMainFrame.setVisible(false);
Main.file = swfFile;
Main.loadingDialog.setVisible(true);
(new OpenFileWorker()).execute();
return true;
}
public static boolean saveFileDialog(Frame f) {
JFileChooser fc = new JFileChooser();
int returnVal = fc.showSaveDialog(f);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try {
Main.saveFile(file.getAbsolutePath());
maskURL = null;
return true;
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Cannot write to the file");
}
}
return false;
}
public static boolean openFileDialog() {
maskURL = null;
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
return (f.getName().endsWith(".swf")) || (f.isDirectory());
}
@Override
public String getDescription() {
return "SWF files (*.swf)";
}
});
int returnVal = fc.showOpenDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File selfile = fc.getSelectedFile();
Main.openFile(selfile.getAbsolutePath());
return true;
} else {
return false;
}
}
public static void showModeFrame() {
if (modeFrame == null) modeFrame = new ModeFrame();
modeFrame.setVisible(true);
}
public static void updateLicenseInDir(File dir){
String license="/*\r\n * Copyright (C) 2010 JPEXS\r\n * \r\n * This program is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU General Public License\r\n * as published by the Free Software Foundation; either version 2\r\n * of the License, or (at your option) any later version.\r\n * \r\n * This program is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n * GNU General Public License for more details.\r\n * \r\n * You should have received a copy of the GNU General Public License\r\n * along with this program; if not, write to the Free Software\r\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r\n */\r\n";
File files[]=dir.listFiles();
for(File f:files){
if(f.isDirectory()){
updateLicenseInDir(f);
}else{
if(f.getName().endsWith(".java")){
ByteArrayOutputStream baos=new ByteArrayOutputStream();
PrintWriter pw=null;
try {
pw = new PrintWriter(new OutputStreamWriter(baos, "utf8"));
} catch (UnsupportedEncodingException ex) {
}
try {
BufferedReader br=new BufferedReader(new FileReader(f));
String s="";
boolean packageFound=false;
while((s=br.readLine())!=null){
if(!packageFound){
if(s.trim().startsWith("package")){
packageFound=true;
pw.println(license);
}
}
if(packageFound){
pw.println(s);
}
}
br.close();
pw.close();
} catch (IOException ex) {
}
FileOutputStream fos;
try {
fos = new FileOutputStream(f);
fos.write(baos.toByteArray());
fos.close();
} catch (IOException ex) {
}
}
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
View.setWinLookAndFeel();
loadReplacements();
if (args.length < 1) {
showModeFrame();
} else {
if (args[0].equals("-proxy")) {
int port = 55555;
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-P")) {
try {
port = Integer.parseInt(args[i].substring(2));
} catch (NumberFormatException nex) {
System.err.println("Bad port number");
}
}
}
if (proxyFrame == null) proxyFrame = new ProxyFrame();
proxyFrame.setPort(port);
addTrayIcon();
switchProxy();
} else {
openFile(args[0]);
}
}
}
public static String tempFile(String url) {
File f = new File(getASDecHome() + "saved" + File.separator);
if (!f.exists()) f.mkdirs();
return getASDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp";
}
public static void removeTrayIcon() {
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
if (trayIcon != null) {
tray.remove(trayIcon);
trayIcon = null;
}
}
}
public static void switchProxy() {
proxyFrame.switchState();
if (stopMenuItem != null) {
if (proxyFrame.isRunning()) {
stopMenuItem.setLabel("Stop proxy");
} else {
stopMenuItem.setLabel("Start proxy");
}
}
}
public static void addTrayIcon() {
if (trayIcon != null) return;
if (SystemTray.isSupported()) {
SystemTray tray = SystemTray.getSystemTray();
trayIcon = new TrayIcon(View.loadImage("com/jpexs/asdec/gui/graphics/proxy16.png"), "JP ASDec Proxy");
trayIcon.setImageAutoSize(true);
PopupMenu trayPopup = new PopupMenu();
ActionListener trayListener = new ActionListener() {
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("EXIT")) Main.exit();
if (e.getActionCommand().equals("SHOW")) Main.showProxy();
if (e.getActionCommand().equals("SWITCH")) Main.switchProxy();
}
};
MenuItem showMenuItem = new MenuItem("Show proxy");
showMenuItem.setActionCommand("SHOW");
showMenuItem.addActionListener(trayListener);
trayPopup.add(showMenuItem);
stopMenuItem = new MenuItem("Start proxy");
stopMenuItem.setActionCommand("SWITCH");
stopMenuItem.addActionListener(trayListener);
trayPopup.add(stopMenuItem);
trayPopup.addSeparator();
MenuItem exitMenuItem = new MenuItem("Exit");
exitMenuItem.setActionCommand("EXIT");
exitMenuItem.addActionListener(trayListener);
trayPopup.add(exitMenuItem);
trayIcon.setPopupMenu(trayPopup);
trayIcon.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
Main.showProxy();
}
}
});
try {
tray.add(trayIcon);
} catch (AWTException ex) {
}
}
}
public static void exit() {
saveReplacements();
System.exit(0);
}
}
+208 -190
View File
@@ -1,190 +1,208 @@
package com.jpexs.asdec;
import com.jpexs.asdec.tags.Tag;
import com.jpexs.asdec.types.RECT;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
/**
* Class representing SWF file
*
* @author JPEXS
*/
public class SWF {
/**
* Tags inside of file
*/
public List<Tag> tags = new ArrayList<Tag>();
/**
* Rectangle for the display
*/
public RECT displayRect;
/**
* Movie frame rate
*/
public int frameRate;
/**
* Number of frames in movie
*/
public int frameCount;
/**
* Version of SWF
*/
public int version;
/**
* Size of the file
*/
public long fileSize;
/**
* Use compression
*/
public boolean compressed = false;
/**
* Gets all tags with specified id
*
* @param tagId Identificator of tag type
* @return List of tags
*/
public List<Tag> getTagData(int tagId) {
List<Tag> ret = new ArrayList<Tag>();
for (Tag tag : tags) {
if (tag.getId() == tagId) {
ret.add(tag);
}
}
return ret;
}
/**
* Saves this SWF into new file
*
* @param os OutputStream to save SWF in
* @throws IOException
*/
public void saveTo(OutputStream os) throws IOException {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
sos.writeRECT(displayRect);
sos.writeUI8(0);
sos.writeUI8(frameRate);
sos.writeUI16(frameCount);
sos.writeTags(tags);
sos.writeUI16(0);
sos.close();
if (compressed) {
os.write('C');
} else {
os.write('F');
}
os.write('W');
os.write('S');
os.write(version);
byte data[] = baos.toByteArray();
sos = new SWFOutputStream(os, version);
sos.writeUI32(data.length + 8);
if (compressed) {
os = new DeflaterOutputStream(os);
}
os.write(data);
}
finally {
if (os != null)
os.close();
}
}
/**
* Construct SWF from stream
*
* @param is Stream to read SWF from
* @throws IOException
*/
public SWF(InputStream is) throws IOException {
byte hdr[] = new byte[3];
is.read(hdr);
String shdr = new String(hdr);
if ((!shdr.equals("FWS")) && (!shdr.equals("CWS"))) {
throw new IOException("Invalid SWF file");
}
version = is.read();
SWFInputStream sis = new SWFInputStream(is, version);
fileSize = sis.readUI32();
if (hdr[0] == 'C') {
sis = new SWFInputStream(new InflaterInputStream(is), version);
compressed = true;
}
displayRect = sis.readRECT();
sis.readUI8();
frameRate = sis.readUI8();
frameCount = sis.readUI16();
tags = sis.readTagList();
}
/**
* Compress SWF file
*
* @param fis Input stream
* @param fos Output stream
*/
public static void fws2cws(InputStream fis, OutputStream fos) {
try {
byte swfHead[] = new byte[8];
fis.read(swfHead);
swfHead[0] = 'C';
fos.write(swfHead);
fos = new DeflaterOutputStream(fos);
int i = 0;
while ((i = fis.read()) != -1) {
fos.write(i);
}
fis.close();
fos.close();
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
}
}
/**
* Decompress SWF file
*
* @param fis Input stream
* @param fos Output stream
*/
public static void cws2fws(InputStream fis, OutputStream fos) {
try {
byte swfHead[] = new byte[8];
fis.read(swfHead);
InflaterInputStream iis = new InflaterInputStream(fis);
swfHead[0] = 'F';
fos.write(swfHead);
int i = 0;
while ((i = iis.read()) != -1) {
fos.write(i);
}
fis.close();
fos.close();
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
}
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec;
import com.jpexs.asdec.tags.Tag;
import com.jpexs.asdec.types.RECT;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
/**
* Class representing SWF file
*
* @author JPEXS
*/
public class SWF {
/**
* Tags inside of file
*/
public List<Tag> tags = new ArrayList<Tag>();
/**
* Rectangle for the display
*/
public RECT displayRect;
/**
* Movie frame rate
*/
public int frameRate;
/**
* Number of frames in movie
*/
public int frameCount;
/**
* Version of SWF
*/
public int version;
/**
* Size of the file
*/
public long fileSize;
/**
* Use compression
*/
public boolean compressed = false;
/**
* Gets all tags with specified id
*
* @param tagId Identificator of tag type
* @return List of tags
*/
public List<Tag> getTagData(int tagId) {
List<Tag> ret = new ArrayList<Tag>();
for (Tag tag : tags) {
if (tag.getId() == tagId) {
ret.add(tag);
}
}
return ret;
}
/**
* Saves this SWF into new file
*
* @param os OutputStream to save SWF in
* @throws IOException
*/
public void saveTo(OutputStream os) throws IOException {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
SWFOutputStream sos = new SWFOutputStream(baos, version);
sos.writeRECT(displayRect);
sos.writeUI8(0);
sos.writeUI8(frameRate);
sos.writeUI16(frameCount);
sos.writeTags(tags);
sos.writeUI16(0);
sos.close();
if (compressed) {
os.write('C');
} else {
os.write('F');
}
os.write('W');
os.write('S');
os.write(version);
byte data[] = baos.toByteArray();
sos = new SWFOutputStream(os, version);
sos.writeUI32(data.length + 8);
if (compressed) {
os = new DeflaterOutputStream(os);
}
os.write(data);
}
finally {
if (os != null)
os.close();
}
}
/**
* Construct SWF from stream
*
* @param is Stream to read SWF from
* @throws IOException
*/
public SWF(InputStream is) throws IOException {
byte hdr[] = new byte[3];
is.read(hdr);
String shdr = new String(hdr);
if ((!shdr.equals("FWS")) && (!shdr.equals("CWS"))) {
throw new IOException("Invalid SWF file");
}
version = is.read();
SWFInputStream sis = new SWFInputStream(is, version);
fileSize = sis.readUI32();
if (hdr[0] == 'C') {
sis = new SWFInputStream(new InflaterInputStream(is), version);
compressed = true;
}
displayRect = sis.readRECT();
sis.readUI8();
frameRate = sis.readUI8();
frameCount = sis.readUI16();
tags = sis.readTagList();
}
/**
* Compress SWF file
*
* @param fis Input stream
* @param fos Output stream
*/
public static void fws2cws(InputStream fis, OutputStream fos) {
try {
byte swfHead[] = new byte[8];
fis.read(swfHead);
swfHead[0] = 'C';
fos.write(swfHead);
fos = new DeflaterOutputStream(fos);
int i = 0;
while ((i = fis.read()) != -1) {
fos.write(i);
}
fis.close();
fos.close();
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
}
}
/**
* Decompress SWF file
*
* @param fis Input stream
* @param fos Output stream
*/
public static void cws2fws(InputStream fis, OutputStream fos) {
try {
byte swfHead[] = new byte[8];
fis.read(swfHead);
InflaterInputStream iis = new InflaterInputStream(fis);
swfHead[0] = 'F';
fos.write(swfHead);
int i = 0;
while ((i = iis.read()) != -1) {
fos.write(i);
}
fis.close();
fos.close();
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
}
}
}
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec;
import com.jpexs.asdec.action.Action;
@@ -1,3 +1,21 @@
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec;
import com.jpexs.asdec.action.Action;
File diff suppressed because it is too large Load Diff
+318 -304
View File
@@ -1,304 +1,318 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc;
import com.jpexs.asdec.abc.types.*;
import com.jpexs.asdec.abc.types.traits.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class ABCInputStream extends InputStream {
private InputStream is;
private long bytesRead = 0;
private ByteArrayOutputStream bufferOs = null;
public void startBuffer() {
bufferOs = new ByteArrayOutputStream();
}
public byte[] stopBuffer() {
if (bufferOs == null) return new byte[0];
byte ret[] = bufferOs.toByteArray();
bufferOs = null;
return ret;
}
public ABCInputStream(InputStream is) {
this.is = is;
}
@Override
public int read() throws IOException {
bytesRead++;
int i = is.read();
if (bufferOs != null) {
if (i != -1)
bufferOs.write(i);
}
return i;
}
public int readU8() throws IOException {
return read();
}
public int readU32() throws IOException {
int i = 0;
int ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte = false;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
} while (nextByte);
return ret;
}
public int readU30() throws IOException {
return readU32();
}
public int readS24() throws IOException {
int ret = (read()) + (read() << 8) + (read() << 16);
if ((ret >> 23) == 1) {
ret = ret | 0xff000000;
}
return ret;
}
public int readU16() throws IOException {
return (read()) + (read() << 8);
}
public long readS32() throws IOException {
int i = 0;
long ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte = false;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
if (bytePos == 35) {
if ((ret >> 31) == 1)
ret = -(ret & 0x7fffffff);
break;
}
} while (nextByte);
return ret;
}
@Override
public int available() throws IOException {
return is.available();
}
public final long readLong() throws IOException {
byte readBuffer[] = safeRead(8);
return (((long) readBuffer[7] << 56) +
((long) (readBuffer[6] & 255) << 48) +
((long) (readBuffer[5] & 255) << 40) +
((long) (readBuffer[4] & 255) << 32) +
((long) (readBuffer[3] & 255) << 24) +
((readBuffer[2] & 255) << 16) +
((readBuffer[1] & 255) << 8) +
((readBuffer[0] & 255) << 0));
}
public double readDouble() throws IOException {
long el = readLong();
double ret = Double.longBitsToDouble(el);
return ret;
}
private byte[] safeRead(int count) throws IOException {
byte ret[] = new byte[count];
for (int i = 0; i < count; i++) {
ret[i] = (byte) read();
}
return ret;
}
public Namespace readNamespace() throws IOException {
int kind = read();
int name_index = 0;
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == kind) {
name_index = readU30();
break;
}
}
return new Namespace(kind, name_index);
}
public Multiname readMultiname() throws IOException {
int kind = read();
int namespace_index = -1;
int name_index = -1;
int namespace_set_index = -1;
if ((kind == 7) || (kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
namespace_index = readU30();
name_index = readU30();
}
if ((kind == 9) || (kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
name_index = readU30();
namespace_set_index = readU30();
}
if ((kind == 0xf) || (kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
name_index = readU30();
}
if ((kind == 0x1B) || (kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
namespace_set_index = readU30();
}
//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
return new Multiname(kind, name_index, namespace_index, namespace_set_index);
}
public MethodInfo readMethodInfo() throws IOException {
int param_count = readU30();
int ret_type = readU30();
int param_types[] = new int[param_count];
for (int i = 0; i < param_count; i++) {
param_types[i] = readU30();
}
int name_index = readU30();
int flags = read();
//// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames
ValueKind optional[] = new ValueKind[0];
if ((flags & 8) == 8) { //if has_optional
int optional_count = readU30();
optional = new ValueKind[optional_count];
for (int i = 0; i < optional_count; i++) {
optional[i] = new ValueKind(readU30(), read());
}
}
int param_names[] = new int[param_count];
if ((flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < param_count; i++) {
param_names[i] = readU30();
}
}
return new MethodInfo(param_types, ret_type, name_index, flags, optional, param_names);
}
public Trait readTrait() throws IOException {
long pos = getPosition();
startBuffer();
int name_index = readU30();
int kind = read();
int kindType = 0xf & kind;
int kindFlags = kind >> 4;
Trait trait = new Trait();
switch (kindType) {
case 0: //slot
case 6: //const
TraitSlotConst t1 = new TraitSlotConst();
t1.slot_id = readU30();
t1.type_index = readU30();
t1.value_index = readU30();
if (t1.value_index != 0)
t1.value_kind = read();
trait = t1;
break;
case 1: //method
case 2: //getter
case 3: //setter
TraitMethodGetterSetter t2 = new TraitMethodGetterSetter();
t2.disp_id = readU30();
t2.method_info = readU30();
trait = t2;
break;
case 4: //class
TraitClass t3 = new TraitClass();
t3.slot_id = readU30();
t3.class_info = readU30();
trait = t3;
break;
case 5: //function
TraitFunction t4 = new TraitFunction();
t4.slot_index = readU30();
t4.method_info = readU30();
trait = t4;
break;
}
trait.fileOffset = pos;
trait.kindType = kindType;
trait.kindFlags = kindFlags;
trait.name_index = name_index;
if ((kindFlags & 4) == 4) {
int metadata_count = readU30();
trait.metadata = new int[metadata_count];
for (int i = 0; i < metadata_count; i++) {
trait.metadata[i] = readU30();
}
}
trait.bytes = stopBuffer();
return trait;
}
public Traits readTraits() throws IOException {
int count = readU30();
Traits traits = new Traits();
traits.traits = new Trait[count];
for (int i = 0; i < count; i++) {
traits.traits[i] = readTrait();
}
return traits;
}
public InstanceInfo readInstanceInfo() throws IOException {
InstanceInfo ret = new InstanceInfo();
ret.name_index = readU30();
ret.super_index = readU30();
ret.flags = read();
if ((ret.flags & 8) == 8) {
ret.protectedNS = readU30();
}
int interfaces_count = readU30();
ret.interfaces = new int[interfaces_count];
for (int i = 0; i < interfaces_count; i++) {
ret.interfaces[i] = readU30();
}
ret.iinit_index = readU30();
ret.instance_traits = readTraits();
return ret;
}
public String readString() throws IOException {
int length = readU30();
return new String(safeRead(length), "utf8");
}
/*public void markStart(){
bytesRead=0;
}*/
public long getPosition() {
return bytesRead;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc;
import com.jpexs.asdec.abc.types.*;
import com.jpexs.asdec.abc.types.traits.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class ABCInputStream extends InputStream {
private InputStream is;
private long bytesRead = 0;
private ByteArrayOutputStream bufferOs = null;
public void startBuffer() {
bufferOs = new ByteArrayOutputStream();
}
public byte[] stopBuffer() {
if (bufferOs == null) return new byte[0];
byte ret[] = bufferOs.toByteArray();
bufferOs = null;
return ret;
}
public ABCInputStream(InputStream is) {
this.is = is;
}
@Override
public int read() throws IOException {
bytesRead++;
int i = is.read();
if (bufferOs != null) {
if (i != -1)
bufferOs.write(i);
}
return i;
}
public int readU8() throws IOException {
return read();
}
public int readU32() throws IOException {
int i = 0;
int ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte = false;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
} while (nextByte);
return ret;
}
public int readU30() throws IOException {
return readU32();
}
public int readS24() throws IOException {
int ret = (read()) + (read() << 8) + (read() << 16);
if ((ret >> 23) == 1) {
ret = ret | 0xff000000;
}
return ret;
}
public int readU16() throws IOException {
return (read()) + (read() << 8);
}
public long readS32() throws IOException {
int i = 0;
long ret = 0;
int bytePos = 0;
int byteCount = 0;
boolean nextByte = false;
do {
i = read();
nextByte = (i >> 7) == 1;
i = i & 0x7f;
ret = ret + (i << bytePos);
byteCount++;
bytePos += 7;
if (bytePos == 35) {
if ((ret >> 31) == 1)
ret = -(ret & 0x7fffffff);
break;
}
} while (nextByte);
return ret;
}
@Override
public int available() throws IOException {
return is.available();
}
public final long readLong() throws IOException {
byte readBuffer[] = safeRead(8);
return (((long) readBuffer[7] << 56) +
((long) (readBuffer[6] & 255) << 48) +
((long) (readBuffer[5] & 255) << 40) +
((long) (readBuffer[4] & 255) << 32) +
((long) (readBuffer[3] & 255) << 24) +
((readBuffer[2] & 255) << 16) +
((readBuffer[1] & 255) << 8) +
((readBuffer[0] & 255) << 0));
}
public double readDouble() throws IOException {
long el = readLong();
double ret = Double.longBitsToDouble(el);
return ret;
}
private byte[] safeRead(int count) throws IOException {
byte ret[] = new byte[count];
for (int i = 0; i < count; i++) {
ret[i] = (byte) read();
}
return ret;
}
public Namespace readNamespace() throws IOException {
int kind = read();
int name_index = 0;
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == kind) {
name_index = readU30();
break;
}
}
return new Namespace(kind, name_index);
}
public Multiname readMultiname() throws IOException {
int kind = read();
int namespace_index = -1;
int name_index = -1;
int namespace_set_index = -1;
if ((kind == 7) || (kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
namespace_index = readU30();
name_index = readU30();
}
if ((kind == 9) || (kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
name_index = readU30();
namespace_set_index = readU30();
}
if ((kind == 0xf) || (kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
name_index = readU30();
}
if ((kind == 0x1B) || (kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
namespace_set_index = readU30();
}
//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
return new Multiname(kind, name_index, namespace_index, namespace_set_index);
}
public MethodInfo readMethodInfo() throws IOException {
int param_count = readU30();
int ret_type = readU30();
int param_types[] = new int[param_count];
for (int i = 0; i < param_count; i++) {
param_types[i] = readU30();
}
int name_index = readU30();
int flags = read();
//// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames
ValueKind optional[] = new ValueKind[0];
if ((flags & 8) == 8) { //if has_optional
int optional_count = readU30();
optional = new ValueKind[optional_count];
for (int i = 0; i < optional_count; i++) {
optional[i] = new ValueKind(readU30(), read());
}
}
int param_names[] = new int[param_count];
if ((flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < param_count; i++) {
param_names[i] = readU30();
}
}
return new MethodInfo(param_types, ret_type, name_index, flags, optional, param_names);
}
public Trait readTrait() throws IOException {
long pos = getPosition();
startBuffer();
int name_index = readU30();
int kind = read();
int kindType = 0xf & kind;
int kindFlags = kind >> 4;
Trait trait = new Trait();
switch (kindType) {
case 0: //slot
case 6: //const
TraitSlotConst t1 = new TraitSlotConst();
t1.slot_id = readU30();
t1.type_index = readU30();
t1.value_index = readU30();
if (t1.value_index != 0)
t1.value_kind = read();
trait = t1;
break;
case 1: //method
case 2: //getter
case 3: //setter
TraitMethodGetterSetter t2 = new TraitMethodGetterSetter();
t2.disp_id = readU30();
t2.method_info = readU30();
trait = t2;
break;
case 4: //class
TraitClass t3 = new TraitClass();
t3.slot_id = readU30();
t3.class_info = readU30();
trait = t3;
break;
case 5: //function
TraitFunction t4 = new TraitFunction();
t4.slot_index = readU30();
t4.method_info = readU30();
trait = t4;
break;
}
trait.fileOffset = pos;
trait.kindType = kindType;
trait.kindFlags = kindFlags;
trait.name_index = name_index;
if ((kindFlags & 4) == 4) {
int metadata_count = readU30();
trait.metadata = new int[metadata_count];
for (int i = 0; i < metadata_count; i++) {
trait.metadata[i] = readU30();
}
}
trait.bytes = stopBuffer();
return trait;
}
public Traits readTraits() throws IOException {
int count = readU30();
Traits traits = new Traits();
traits.traits = new Trait[count];
for (int i = 0; i < count; i++) {
traits.traits[i] = readTrait();
}
return traits;
}
public InstanceInfo readInstanceInfo() throws IOException {
InstanceInfo ret = new InstanceInfo();
ret.name_index = readU30();
ret.super_index = readU30();
ret.flags = read();
if ((ret.flags & 8) == 8) {
ret.protectedNS = readU30();
}
int interfaces_count = readU30();
ret.interfaces = new int[interfaces_count];
for (int i = 0; i < interfaces_count; i++) {
ret.interfaces[i] = readU30();
}
ret.iinit_index = readU30();
ret.instance_traits = readTraits();
return ret;
}
public String readString() throws IOException {
int length = readU30();
return new String(safeRead(length), "utf8");
}
/*public void markStart(){
bytesRead=0;
}*/
public long getPosition() {
return bytesRead;
}
}
+267 -253
View File
@@ -1,253 +1,267 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc;
import com.jpexs.asdec.abc.types.InstanceInfo;
import com.jpexs.asdec.abc.types.MethodInfo;
import com.jpexs.asdec.abc.types.Multiname;
import com.jpexs.asdec.abc.types.Namespace;
import com.jpexs.asdec.abc.types.traits.*;
import java.io.IOException;
import java.io.OutputStream;
public class ABCOutputStream extends OutputStream {
private OutputStream os;
public ABCOutputStream(OutputStream os) {
this.os = os;
}
@Override
public void write(int b) throws IOException {
os.write(b);
}
public void writeU30(long value) throws IOException {
writeS32(value);
/*boolean loop = true;
boolean underZero=value<0;
if(underZero){
value = value & 0xFFFFFFFF;
}else{
value = value & 0x7FFFFFFF;
}
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
loop = false;
}
if (value > 0x7F) {
ret += 0x80;
}
write(ret);
value = value >> 7;
} while (loop);
*/
}
public void writeU32(long value) throws IOException {
boolean loop = true;
value = value & 0xFFFFFFFF;
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
loop = false;
}
if (value > 0x7F) {
ret += 0x80;
}
write(ret);
value = value >> 7;
} while (loop);
}
public void writeS24(long value) throws IOException {
int ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
}
public void writeS32(long value) throws IOException {
boolean belowZero = value < 0;
/*if (belowZero) {
value = -value;
}*/
int bitcount = 0;
boolean loop = true;
//value = value & 0xFFFFFFFF;
do {
bitcount += 7;
int ret = (int) (value & 0x7F);
if (value < 0x80) {
if (belowZero) { //&& bitcount < 35
ret += 0x80;
} else {
loop = false;
}
} else {
ret += 0x80;
}
if (bitcount == 35) {
ret = ret & 0xf;
}
write(ret);
if (bitcount == 35) {
break;
}
value = value >> 7;
} while (loop);
}
public void writeLong(long value) throws IOException {
byte writeBuffer[] = new byte[8];
writeBuffer[7] = (byte) (value >>> 56);
writeBuffer[6] = (byte) (value >>> 48);
writeBuffer[5] = (byte) (value >>> 40);
writeBuffer[4] = (byte) (value >>> 32);
writeBuffer[3] = (byte) (value >>> 24);
writeBuffer[2] = (byte) (value >>> 16);
writeBuffer[1] = (byte) (value >>> 8);
writeBuffer[0] = (byte) (value >>> 0);
write(writeBuffer);
}
public void writeDouble(double value) throws IOException {
writeLong(Double.doubleToLongBits(value));
}
public void writeU8(int value) throws IOException {
write(value);
}
public void writeU16(int value) throws IOException {
write(value & 0xff);
write((value >> 8) & 0xff);
}
public void writeString(String s) throws IOException {
byte sbytes[] = s.getBytes("utf8");
writeU30(sbytes.length);
write(sbytes);
}
public void writeNamespace(Namespace ns) throws IOException {
write(ns.kind);
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == ns.kind) {
writeU30(ns.name_index);
break;
}
}
}
public void writeMultiname(Multiname m) throws IOException {
write(m.kind);
if ((m.kind == 7) || (m.kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
writeU30(m.namespace_index);
writeU30(m.name_index);
}
if ((m.kind == 9) || (m.kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
writeU30(m.name_index);
writeU30(m.namespace_set_index);
}
if ((m.kind == 0xf) || (m.kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
writeU30(m.name_index);
}
if ((m.kind == 0x1B) || (m.kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
writeU30(m.namespace_set_index);
}
//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
}
public void writeMethodInfo(MethodInfo mi) throws IOException {
writeU30(mi.param_types.length);
writeU30(mi.ret_type);
for (int i = 0; i < mi.param_types.length; i++) {
writeU30(mi.param_types[i]);
}
writeU30(mi.name_index);
write(mi.flags);
if ((mi.flags & 8) == 8) {
writeU30(mi.optional.length);
for (int i = 0; i < mi.optional.length; i++) {
writeU30(mi.optional[i].value_index);
write(mi.optional[i].value_kind);
}
}
if ((mi.flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < mi.paramNames.length; i++) {
writeU30(mi.paramNames[i]);
}
}
}
public void writeTrait(Trait t) throws IOException {
writeU30(t.name_index);
write((t.kindFlags << 4) + t.kindType);
if (t instanceof TraitSlotConst) {
TraitSlotConst t1 = (TraitSlotConst) t;
writeU30(t1.slot_id);
writeU30(t1.type_index);
writeU30(t1.value_index);
if (t1.value_index != 0) {
write(t1.value_kind);
}
}
if (t instanceof TraitMethodGetterSetter) {
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
writeU30(t2.disp_id);
writeU30(t2.method_info);
}
if (t instanceof TraitClass) {
TraitClass t3 = (TraitClass) t;
writeU30(t3.slot_id);
writeU30(t3.class_info);
}
if (t instanceof TraitFunction) {
TraitFunction t4 = (TraitFunction) t;
writeU30(t4.slot_index);
writeU30(t4.method_info);
}
if ((t.kindFlags & 4) == 4) {
writeU30(t.metadata.length);
for (int i = 0; i < t.metadata.length; i++) {
writeU30(t.metadata[i]);
}
}
}
public void writeTraits(Traits t) throws IOException {
writeU30(t.traits.length);
for (int i = 0; i < t.traits.length; i++) {
writeTrait(t.traits[i]);
}
}
public void writeInstanceInfo(InstanceInfo ii) throws IOException {
writeU30(ii.name_index);
writeU30(ii.super_index);
write(ii.flags);
if ((ii.flags & 8) == 8) {
writeU30(ii.protectedNS);
}
writeU30(ii.interfaces.length);
for (int i = 0; i < ii.interfaces.length; i++) {
writeU30(ii.interfaces[i]);
}
writeU30(ii.iinit_index);
writeTraits(ii.instance_traits);
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc;
import com.jpexs.asdec.abc.types.InstanceInfo;
import com.jpexs.asdec.abc.types.MethodInfo;
import com.jpexs.asdec.abc.types.Multiname;
import com.jpexs.asdec.abc.types.Namespace;
import com.jpexs.asdec.abc.types.traits.*;
import java.io.IOException;
import java.io.OutputStream;
public class ABCOutputStream extends OutputStream {
private OutputStream os;
public ABCOutputStream(OutputStream os) {
this.os = os;
}
@Override
public void write(int b) throws IOException {
os.write(b);
}
public void writeU30(long value) throws IOException {
writeS32(value);
/*boolean loop = true;
boolean underZero=value<0;
if(underZero){
value = value & 0xFFFFFFFF;
}else{
value = value & 0x7FFFFFFF;
}
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
loop = false;
}
if (value > 0x7F) {
ret += 0x80;
}
write(ret);
value = value >> 7;
} while (loop);
*/
}
public void writeU32(long value) throws IOException {
boolean loop = true;
value = value & 0xFFFFFFFF;
do {
int ret = (int) (value & 0x7F);
if (value < 0x80) {
loop = false;
}
if (value > 0x7F) {
ret += 0x80;
}
write(ret);
value = value >> 7;
} while (loop);
}
public void writeS24(long value) throws IOException {
int ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
ret = (int) (value & 0xff);
write(ret);
value = value >> 8;
}
public void writeS32(long value) throws IOException {
boolean belowZero = value < 0;
/*if (belowZero) {
value = -value;
}*/
int bitcount = 0;
boolean loop = true;
//value = value & 0xFFFFFFFF;
do {
bitcount += 7;
int ret = (int) (value & 0x7F);
if (value < 0x80) {
if (belowZero) { //&& bitcount < 35
ret += 0x80;
} else {
loop = false;
}
} else {
ret += 0x80;
}
if (bitcount == 35) {
ret = ret & 0xf;
}
write(ret);
if (bitcount == 35) {
break;
}
value = value >> 7;
} while (loop);
}
public void writeLong(long value) throws IOException {
byte writeBuffer[] = new byte[8];
writeBuffer[7] = (byte) (value >>> 56);
writeBuffer[6] = (byte) (value >>> 48);
writeBuffer[5] = (byte) (value >>> 40);
writeBuffer[4] = (byte) (value >>> 32);
writeBuffer[3] = (byte) (value >>> 24);
writeBuffer[2] = (byte) (value >>> 16);
writeBuffer[1] = (byte) (value >>> 8);
writeBuffer[0] = (byte) (value >>> 0);
write(writeBuffer);
}
public void writeDouble(double value) throws IOException {
writeLong(Double.doubleToLongBits(value));
}
public void writeU8(int value) throws IOException {
write(value);
}
public void writeU16(int value) throws IOException {
write(value & 0xff);
write((value >> 8) & 0xff);
}
public void writeString(String s) throws IOException {
byte sbytes[] = s.getBytes("utf8");
writeU30(sbytes.length);
write(sbytes);
}
public void writeNamespace(Namespace ns) throws IOException {
write(ns.kind);
for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) {
if (Namespace.nameSpaceKinds[k] == ns.kind) {
writeU30(ns.name_index);
break;
}
}
}
public void writeMultiname(Multiname m) throws IOException {
write(m.kind);
if ((m.kind == 7) || (m.kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA.
writeU30(m.namespace_index);
writeU30(m.name_index);
}
if ((m.kind == 9) || (m.kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA.
writeU30(m.name_index);
writeU30(m.namespace_set_index);
}
if ((m.kind == 0xf) || (m.kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA
writeU30(m.name_index);
}
if ((m.kind == 0x1B) || (m.kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA
writeU30(m.namespace_set_index);
}
//kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA.
}
public void writeMethodInfo(MethodInfo mi) throws IOException {
writeU30(mi.param_types.length);
writeU30(mi.ret_type);
for (int i = 0; i < mi.param_types.length; i++) {
writeU30(mi.param_types[i]);
}
writeU30(mi.name_index);
write(mi.flags);
if ((mi.flags & 8) == 8) {
writeU30(mi.optional.length);
for (int i = 0; i < mi.optional.length; i++) {
writeU30(mi.optional[i].value_index);
write(mi.optional[i].value_kind);
}
}
if ((mi.flags & 128) == 128) { //if has_paramnames
for (int i = 0; i < mi.paramNames.length; i++) {
writeU30(mi.paramNames[i]);
}
}
}
public void writeTrait(Trait t) throws IOException {
writeU30(t.name_index);
write((t.kindFlags << 4) + t.kindType);
if (t instanceof TraitSlotConst) {
TraitSlotConst t1 = (TraitSlotConst) t;
writeU30(t1.slot_id);
writeU30(t1.type_index);
writeU30(t1.value_index);
if (t1.value_index != 0) {
write(t1.value_kind);
}
}
if (t instanceof TraitMethodGetterSetter) {
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
writeU30(t2.disp_id);
writeU30(t2.method_info);
}
if (t instanceof TraitClass) {
TraitClass t3 = (TraitClass) t;
writeU30(t3.slot_id);
writeU30(t3.class_info);
}
if (t instanceof TraitFunction) {
TraitFunction t4 = (TraitFunction) t;
writeU30(t4.slot_index);
writeU30(t4.method_info);
}
if ((t.kindFlags & 4) == 4) {
writeU30(t.metadata.length);
for (int i = 0; i < t.metadata.length; i++) {
writeU30(t.metadata[i]);
}
}
}
public void writeTraits(Traits t) throws IOException {
writeU30(t.traits.length);
for (int i = 0; i < t.traits.length; i++) {
writeTrait(t.traits[i]);
}
}
public void writeInstanceInfo(InstanceInfo ii) throws IOException {
writeU30(ii.name_index);
writeU30(ii.super_index);
write(ii.flags);
if ((ii.flags & 8) == 8) {
writeU30(ii.protectedNS);
}
writeU30(ii.interfaces.length);
for (int i = 0; i < ii.interfaces.length; i++) {
writeU30(ii.interfaces[i]);
}
writeU30(ii.iinit_index);
writeTraits(ii.instance_traits);
}
}
@@ -1,54 +1,68 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class CopyOutputStream extends OutputStream {
private OutputStream os;
private InputStream is;
private long pos = 0;
private int TEMPSIZE = 5;
private int temp[] = new int[TEMPSIZE];
private int tempPos = 0;
public CopyOutputStream(OutputStream os, InputStream is) {
this.os = os;
this.is = is;
}
@Override
public void write(int b) throws IOException {
temp[tempPos] = b;
tempPos = (tempPos + 1) % TEMPSIZE;
pos++;
int r = is.read();
if ((b & 0xff) != r) {
os.flush();
boolean output = false;
if (output) {
System.out.print("Last written:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " ");
}
System.out.println("");
System.out.println("More expected:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.println("" + Integer.toHexString(is.read()));
}
System.out.println("");
System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found");
}
throw new NotSameException(pos);
}
os.write(b);
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
public class CopyOutputStream extends OutputStream {
private OutputStream os;
private InputStream is;
private long pos = 0;
private int TEMPSIZE = 5;
private int temp[] = new int[TEMPSIZE];
private int tempPos = 0;
public CopyOutputStream(OutputStream os, InputStream is) {
this.os = os;
this.is = is;
}
@Override
public void write(int b) throws IOException {
temp[tempPos] = b;
tempPos = (tempPos + 1) % TEMPSIZE;
pos++;
int r = is.read();
if ((b & 0xff) != r) {
os.flush();
boolean output = false;
if (output) {
System.out.print("Last written:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " ");
}
System.out.println("");
System.out.println("More expected:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.println("" + Integer.toHexString(is.read()));
}
System.out.println("");
System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found");
}
throw new NotSameException(pos);
}
os.write(b);
}
}
@@ -1,12 +1,26 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc;
public class NotSameException extends RuntimeException {
public NotSameException(long pos) {
super("Streams are not the same at pos:" + pos);
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc;
public class NotSameException extends RuntimeException {
public NotSameException(long pos) {
super("Streams are not the same at pos:" + pos);
}
}
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc;
/**
*
* @author JPEXS
*/
public class Usage {
}
File diff suppressed because it is too large Load Diff
@@ -1,122 +1,136 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2;
import com.jpexs.asdec.abc.types.Multiname;
import com.jpexs.asdec.abc.types.Namespace;
import com.jpexs.asdec.abc.types.NamespaceSet;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
public class ConstantPool {
public long constant_int[];
public long constant_uint[];
public double constant_double[];
public String constant_string[];
public Namespace constant_namespace[];
public NamespaceSet constant_namespace_set[];
public Multiname constant_multiname[];
public int addInt(long value) {
constant_int = Arrays.copyOf(constant_int, constant_int.length + 1);
constant_int[constant_int.length - 1] = value;
return constant_int.length - 1;
}
public int addUInt(long value) {
constant_uint = Arrays.copyOf(constant_uint, constant_uint.length + 1);
constant_uint[constant_uint.length - 1] = value;
return constant_uint.length - 1;
}
public int addDouble(double value) {
constant_double = Arrays.copyOf(constant_double, constant_double.length + 1);
constant_double[constant_double.length - 1] = value;
return constant_double.length - 1;
}
public int addString(String value) {
constant_string = Arrays.copyOf(constant_string, constant_string.length + 1);
constant_string[constant_string.length - 1] = value;
return constant_string.length - 1;
}
public int getIntId(long value) {
for (int i = 1; i < constant_int.length; i++) {
if (constant_int[i] == value) {
return i;
}
}
return 0;
}
public int getUIntId(long value) {
for (int i = 1; i < constant_uint.length; i++) {
if (constant_uint[i] == value) {
return i;
}
}
return 0;
}
public int getDoubleId(double value) {
for (int i = 1; i < constant_double.length; i++) {
if (constant_double[i] == value) {
return i;
}
}
return 0;
}
public int getStringId(String s) {
for (int i = 1; i < constant_string.length; i++) {
if (constant_string[i].equals(s)) {
return i;
}
}
return 0;
}
public int getMultiNameId(String s) {
for (int i = 1; i < constant_multiname.length; i++) {
if (constant_multiname[i].getName(this).equals(s)) {
return i;
}
}
return 0;
}
public void dump(OutputStream os) {
PrintStream output = new PrintStream(os);
String s = "";
for (int i = 1; i < constant_int.length; i++) {
output.println("INT[" + i + "]=" + constant_int[i]);
}
for (int i = 1; i < constant_uint.length; i++) {
output.println("UINT[" + i + "]=" + constant_uint[i]);
}
for (int i = 1; i < constant_double.length; i++) {
output.println("Double[" + i + "]=" + constant_double[i]);
}
for (int i = 1; i < constant_string.length; i++) {
output.println("String[" + i + "]=" + constant_string[i]);
}
for (int i = 1; i < constant_namespace.length; i++) {
output.println("Namespace[" + i + "]=" + constant_namespace[i].toString(this));
}
for (int i = 1; i < constant_namespace_set.length; i++) {
output.println("NamespaceSet[" + i + "]=" + constant_namespace_set[i].toString(this));
}
for (int i = 1; i < constant_multiname.length; i++) {
output.println("Multiname[" + i + "]=" + constant_multiname[i].toString(this));
}
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2;
import com.jpexs.asdec.abc.types.Multiname;
import com.jpexs.asdec.abc.types.Namespace;
import com.jpexs.asdec.abc.types.NamespaceSet;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
public class ConstantPool {
public long constant_int[];
public long constant_uint[];
public double constant_double[];
public String constant_string[];
public Namespace constant_namespace[];
public NamespaceSet constant_namespace_set[];
public Multiname constant_multiname[];
public int addInt(long value) {
constant_int = Arrays.copyOf(constant_int, constant_int.length + 1);
constant_int[constant_int.length - 1] = value;
return constant_int.length - 1;
}
public int addUInt(long value) {
constant_uint = Arrays.copyOf(constant_uint, constant_uint.length + 1);
constant_uint[constant_uint.length - 1] = value;
return constant_uint.length - 1;
}
public int addDouble(double value) {
constant_double = Arrays.copyOf(constant_double, constant_double.length + 1);
constant_double[constant_double.length - 1] = value;
return constant_double.length - 1;
}
public int addString(String value) {
constant_string = Arrays.copyOf(constant_string, constant_string.length + 1);
constant_string[constant_string.length - 1] = value;
return constant_string.length - 1;
}
public int getIntId(long value) {
for (int i = 1; i < constant_int.length; i++) {
if (constant_int[i] == value) {
return i;
}
}
return 0;
}
public int getUIntId(long value) {
for (int i = 1; i < constant_uint.length; i++) {
if (constant_uint[i] == value) {
return i;
}
}
return 0;
}
public int getDoubleId(double value) {
for (int i = 1; i < constant_double.length; i++) {
if (constant_double[i] == value) {
return i;
}
}
return 0;
}
public int getStringId(String s) {
for (int i = 1; i < constant_string.length; i++) {
if (constant_string[i].equals(s)) {
return i;
}
}
return 0;
}
public int getMultiNameId(String s) {
for (int i = 1; i < constant_multiname.length; i++) {
if (constant_multiname[i].getName(this).equals(s)) {
return i;
}
}
return 0;
}
public void dump(OutputStream os) {
PrintStream output = new PrintStream(os);
String s = "";
for (int i = 1; i < constant_int.length; i++) {
output.println("INT[" + i + "]=" + constant_int[i]);
}
for (int i = 1; i < constant_uint.length; i++) {
output.println("UINT[" + i + "]=" + constant_uint[i]);
}
for (int i = 1; i < constant_double.length; i++) {
output.println("Double[" + i + "]=" + constant_double[i]);
}
for (int i = 1; i < constant_string.length; i++) {
output.println("String[" + i + "]=" + constant_string[i]);
}
for (int i = 1; i < constant_namespace.length; i++) {
output.println("Namespace[" + i + "]=" + constant_namespace[i].toString(this));
}
for (int i = 1; i < constant_namespace_set.length; i++) {
output.println("NamespaceSet[" + i + "]=" + constant_namespace_set[i].toString(this));
}
for (int i = 1; i < constant_multiname.length; i++) {
output.println("Multiname[" + i + "]=" + constant_multiname[i].toString(this));
}
}
}
@@ -1,14 +1,28 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2;
public class ConvertException extends Exception {
public int line;
public ConvertException(String s,int line) {
super(s+" on line "+line);
this.line=line;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2;
public class ConvertException extends Exception {
public int line;
public ConvertException(String s,int line) {
super(s+" on line "+line);
this.line=line;
}
}
@@ -1,14 +1,28 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2;
public class InvalidInstructionArguments extends RuntimeException {
public InvalidInstructionArguments() {
super("Invalid method arguments");
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2;
public class InvalidInstructionArguments extends RuntimeException {
public InvalidInstructionArguments() {
super("Invalid method arguments");
}
}
@@ -1,17 +1,31 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class LocalDataArea {
public Stack operandStack = new Stack();
public Stack scopeStack = new Stack();
public List localRegisters = new ArrayList<Object>();
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class LocalDataArea {
public Stack operandStack = new Stack();
public Stack scopeStack = new Stack();
public List localRegisters = new ArrayList<Object>();
}
@@ -1,15 +1,29 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2;
public class UnknownInstructionCode extends RuntimeException {
public int code;
public UnknownInstructionCode(int code) {
super("Unknown instruction code:" + Integer.toHexString(code));
this.code = code;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2;
public class UnknownInstructionCode extends RuntimeException {
public int code;
public UnknownInstructionCode(int code) {
super("Unknown instruction code:" + Integer.toHexString(code));
this.code = code;
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import java.util.List;
import java.util.Stack;
public class UnknownJumpException extends RuntimeException {
public Stack stack;
public int ip;
public List<TreeItem> output;
public UnknownJumpException(Stack stack, int ip, List<TreeItem> output) {
this.stack = stack;
this.ip = ip;
this.output = output;
}
@Override
public String toString() {
return "Unknown jump to " + ip;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import java.util.List;
import java.util.Stack;
public class UnknownJumpException extends RuntimeException {
public Stack stack;
public int ip;
public List<TreeItem> output;
public UnknownJumpException(Stack stack, int ip, List<TreeItem> output) {
this.stack = stack;
this.ip = ip;
this.output = output;
}
@Override
public String toString() {
return "Unknown jump to " + ip;
}
}
@@ -1,172 +1,186 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.ABCOutputStream;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.helpers.Helper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class AVM2Instruction {
public InstructionDefinition definition;
public int operands[];
public long offset;
public byte bytes[];
public String comment;
public boolean ignored = false;
public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands, byte bytes[]) {
this.definition = definition;
this.operands = operands;
this.offset = offset;
this.bytes = bytes;
}
public byte[] getBytes() {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ABCOutputStream aos = new ABCOutputStream(bos);
aos.write(definition.instructionCode);
for (int i = 0; i < definition.operands.length; i++) {
int opt = definition.operands[i] & 0xff00;
switch (opt) {
case AVM2Code.OPT_S24:
aos.writeS24(operands[i]);
break;
case AVM2Code.OPT_U30:
aos.writeU30(operands[i]);
break;
case AVM2Code.OPT_U8:
aos.writeU8(operands[i]);
break;
case AVM2Code.OPT_BYTE:
aos.writeU8(0xff & operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
aos.writeU30(operands[i]); //case count
for (int j = i + 1; j < operands.length; j++) {
aos.writeS24(operands[j]);
}
break;
}
}
} catch (IOException ex) {
//ignored
}
return bos.toByteArray();
}
@Override
public String toString() {
String s = definition.instructionName;
for (int i = 0; i < operands.length; i++) {
s += " " + operands[i];
}
return s;
}
public List<Long> getOffsets() {
List<Long> ret = new ArrayList<Long>();
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_OFFSET:
ret.add(offset + operands[i] + getBytes().length);
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
ret.add(offset + operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
for (int j = i + 1; j < operands.length; j++) {
ret.add(offset + operands[j]);
}
break;
}
}
return ret;
}
public String getParams(ConstantPool constants) {
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_MULTINAME_INDEX:
s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants)) + "\"";
break;
case AVM2Code.DAT_STRING_INDEX:
s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\"";
break;
case AVM2Code.DAT_INT_INDEX:
s += " " + constants.constant_int[operands[i]] + "";
break;
case AVM2Code.DAT_UINT_INDEX:
s += " " + constants.constant_uint[operands[i]] + "";
break;
case AVM2Code.DAT_DOUBLE_INDEX:
s += " " + constants.constant_double[operands[i]] + "";
break;
case AVM2Code.DAT_OFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + "";
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i]) + "";
break;
case AVM2Code.OPT_CASE_OFFSETS:
s += " " + operands[i];
for (int j = i + 1; j < operands.length; j++) {
s += " ";
if (operands[j] > 0) {
//s += "+";
}//operands[j]
s += "ofs" + Helper.formatAddress(offset + operands[j]) + "";
}
break;
default:
s += " " + operands[i];
}
}
return s;
}
public String getComment() {
if (ignored) {
return " ;ignored";
}
if ((comment == null) || comment.equals("")) {
return "";
}
return " ;" + comment;
}
public String toString(ConstantPool constants) {
String s = Helper.formatAddress(offset) + " " + Helper.padSpaceRight(Helper.byteArrToString(getBytes()), 30) + definition.instructionName;
s += getParams(constants) + getComment();
return s;
}
public String toStringNoAddress(ConstantPool constants) {
String s = definition.instructionName;
s += getParams(constants) + getComment();
return s;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.ABCOutputStream;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.helpers.Helper;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class AVM2Instruction {
public InstructionDefinition definition;
public int operands[];
public long offset;
public byte bytes[];
public String comment;
public boolean ignored = false;
public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands, byte bytes[]) {
this.definition = definition;
this.operands = operands;
this.offset = offset;
this.bytes = bytes;
}
public byte[] getBytes() {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ABCOutputStream aos = new ABCOutputStream(bos);
aos.write(definition.instructionCode);
for (int i = 0; i < definition.operands.length; i++) {
int opt = definition.operands[i] & 0xff00;
switch (opt) {
case AVM2Code.OPT_S24:
aos.writeS24(operands[i]);
break;
case AVM2Code.OPT_U30:
aos.writeU30(operands[i]);
break;
case AVM2Code.OPT_U8:
aos.writeU8(operands[i]);
break;
case AVM2Code.OPT_BYTE:
aos.writeU8(0xff & operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
aos.writeU30(operands[i]); //case count
for (int j = i + 1; j < operands.length; j++) {
aos.writeS24(operands[j]);
}
break;
}
}
} catch (IOException ex) {
//ignored
}
return bos.toByteArray();
}
@Override
public String toString() {
String s = definition.instructionName;
for (int i = 0; i < operands.length; i++) {
s += " " + operands[i];
}
return s;
}
public List<Long> getOffsets() {
List<Long> ret = new ArrayList<Long>();
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_OFFSET:
ret.add(offset + operands[i] + getBytes().length);
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
ret.add(offset + operands[i]);
break;
case AVM2Code.OPT_CASE_OFFSETS:
for (int j = i + 1; j < operands.length; j++) {
ret.add(offset + operands[j]);
}
break;
}
}
return ret;
}
public String getParams(ConstantPool constants) {
String s = "";
for (int i = 0; i < definition.operands.length; i++) {
switch (definition.operands[i]) {
case AVM2Code.DAT_MULTINAME_INDEX:
s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants)) + "\"";
break;
case AVM2Code.DAT_STRING_INDEX:
s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\"";
break;
case AVM2Code.DAT_INT_INDEX:
s += " " + constants.constant_int[operands[i]] + "";
break;
case AVM2Code.DAT_UINT_INDEX:
s += " " + constants.constant_uint[operands[i]] + "";
break;
case AVM2Code.DAT_DOUBLE_INDEX:
s += " " + constants.constant_double[operands[i]] + "";
break;
case AVM2Code.DAT_OFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + "";
break;
case AVM2Code.DAT_CASE_BASEOFFSET:
s += " ";
if (operands[i] > 0) {
//s += "+";
}//operands[i]
s += "ofs" + Helper.formatAddress(offset + operands[i]) + "";
break;
case AVM2Code.OPT_CASE_OFFSETS:
s += " " + operands[i];
for (int j = i + 1; j < operands.length; j++) {
s += " ";
if (operands[j] > 0) {
//s += "+";
}//operands[j]
s += "ofs" + Helper.formatAddress(offset + operands[j]) + "";
}
break;
default:
s += " " + operands[i];
}
}
return s;
}
public String getComment() {
if (ignored) {
return " ;ignored";
}
if ((comment == null) || comment.equals("")) {
return "";
}
return " ;" + comment;
}
public String toString(ConstantPool constants) {
String s = Helper.formatAddress(offset) + " " + Helper.padSpaceRight(Helper.byteArrToString(getBytes()), 30) + definition.instructionName;
s += getParams(constants) + getComment();
return s;
}
public String toStringNoAddress(ConstantPool constants) {
String s = definition.instructionName;
s += getParams(constants) + getComment();
return s;
}
}
@@ -1,14 +1,28 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import java.util.Stack;
public interface IfTypeIns {
public abstract void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins);
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import java.util.Stack;
public interface IfTypeIns {
public abstract void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins);
}
@@ -1,109 +1,123 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import com.jpexs.asdec.helpers.Highlighting;
import java.util.List;
import java.util.Stack;
public class InstructionDefinition {
protected String hilighOffset(String text, long offset) {
return Highlighting.hilighOffset(text, offset);
}
public int operands[];
public String instructionName = "";
public int instructionCode = 0;
public static String localRegName(int reg) {
if (reg == 0) return "this";
return "_loc" + reg + "_";
}
public InstructionDefinition(int instructionCode, String instructionName, int operands[]) {
this.instructionCode = instructionCode;
this.instructionName = instructionName;
this.operands = operands;
}
@Override
public String toString() {
String s = instructionName;
for (int i = 0; i < operands.length; i++) {
if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) {
s += " U30";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) {
s += " U8";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) {
s += " BYTE";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) {
s += " S24";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) {
s += " U30 S24,[S24]...";
}
}
return s;
}
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
}
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
}
protected FullMultinameTreeItem resolveMultiname(Stack<TreeItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
TreeItem ns = null;
TreeItem name = null;
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = (TreeItem) stack.pop();
}
if (constants.constant_multiname[multinameIndex].needsName()) {
name = (TreeItem) stack.pop();
}
return new FullMultinameTreeItem(ins, multinameIndex, name, ns);
}
protected int resolvedCount(ConstantPool constants, int multinameIndex) {
int pos = 0;
if (constants.constant_multiname[multinameIndex].needsNs()) {
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
pos++;
}
return pos;
}
protected String resolveMultinameNoPop(int pos, Stack<TreeItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
String ns = "";
String name = "";
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = "[" + stack.get(pos) + "]";
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
name = stack.get(pos).toString();
} else {
name = hilighOffset(constants.constant_multiname[multinameIndex].getName(constants), ins.offset);
}
return name + ns;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import com.jpexs.asdec.helpers.Highlighting;
import java.util.List;
import java.util.Stack;
public class InstructionDefinition {
protected String hilighOffset(String text, long offset) {
return Highlighting.hilighOffset(text, offset);
}
public int operands[];
public String instructionName = "";
public int instructionCode = 0;
public static String localRegName(int reg) {
if (reg == 0) return "this";
return "_loc" + reg + "_";
}
public InstructionDefinition(int instructionCode, String instructionName, int operands[]) {
this.instructionCode = instructionCode;
this.instructionName = instructionName;
this.operands = operands;
}
@Override
public String toString() {
String s = instructionName;
for (int i = 0; i < operands.length; i++) {
if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) {
s += " U30";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) {
s += " U8";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) {
s += " BYTE";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) {
s += " S24";
}
if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) {
s += " U30 S24,[S24]...";
}
}
return s;
}
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
}
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
}
protected FullMultinameTreeItem resolveMultiname(Stack<TreeItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
TreeItem ns = null;
TreeItem name = null;
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = (TreeItem) stack.pop();
}
if (constants.constant_multiname[multinameIndex].needsName()) {
name = (TreeItem) stack.pop();
}
return new FullMultinameTreeItem(ins, multinameIndex, name, ns);
}
protected int resolvedCount(ConstantPool constants, int multinameIndex) {
int pos = 0;
if (constants.constant_multiname[multinameIndex].needsNs()) {
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
pos++;
}
return pos;
}
protected String resolveMultinameNoPop(int pos, Stack<TreeItem> stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) {
String ns = "";
String name = "";
if (constants.constant_multiname[multinameIndex].needsNs()) {
ns = "[" + stack.get(pos) + "]";
pos++;
}
if (constants.constant_multiname[multinameIndex].needsName()) {
name = stack.get(pos).toString();
} else {
name = hilighOffset(constants.constant_multiname[multinameIndex].getName(constants), ins.offset);
}
return name + ns;
}
}
@@ -1,17 +1,31 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public interface SetTypeIns {
public abstract String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body);
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public interface SetTypeIns {
public abstract String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body);
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class AddIIns extends AddIns {
public AddIIns() {
instructionName = "add_i";
instructionCode = 0xc5;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class AddIIns extends AddIns {
public AddIIns() {
instructionName = "add_i";
instructionCode = 0xc5;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
}
@@ -1,53 +1,67 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class AddIns extends InstructionDefinition {
public AddIns() {
super(0xa0, "add", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
String s = o1.toString() + o2.toString();
lda.operandStack.push(s);
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class AddIns extends InstructionDefinition {
public AddIns() {
super(0xa0, "add", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
String s = o1.toString() + o2.toString();
lda.operandStack.push(s);
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new AddTreeItem(ins, v1, v2));
}
}
@@ -1,47 +1,61 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecrementIIns extends InstructionDefinition {
public DecrementIIns() {
super(0xc1, "decrement_i", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecrementIIns extends InstructionDefinition {
public DecrementIIns() {
super(0xc1, "decrement_i", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
@@ -1,47 +1,61 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecrementIns extends InstructionDefinition {
public DecrementIns() {
super(0x93, "decrement", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecrementIns extends InstructionDefinition {
public DecrementIns() {
super(0x93, "decrement", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj = lda.operandStack.pop();
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.operandStack.push(obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.operandStack.push(obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.operandStack.push(obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
@@ -1,52 +1,66 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.DivideTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DivideIns extends InstructionDefinition {
public DivideIns() {
super(0xa3, "divide", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot divide");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new DivideTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.DivideTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DivideIns extends InstructionDefinition {
public DivideIns() {
super(0xa3, "divide", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object o1 = lda.operandStack.pop();
Object o2 = lda.operandStack.pop();
if ((o1 instanceof Long) && ((o2 instanceof Long))) {
Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Double))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Long) && ((o2 instanceof Double))) {
Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue());
lda.operandStack.push(ret);
} else if ((o1 instanceof Double) && ((o2 instanceof Long))) {
Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue());
lda.operandStack.push(ret);
} else {
throw new RuntimeException("Cannot divide");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new DivideTreeItem(ins, v1, v2));
}
}
@@ -1,28 +1,42 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncrementIIns extends InstructionDefinition {
public IncrementIIns() {
super(0xc0, "increment_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncrementIIns extends InstructionDefinition {
public IncrementIIns() {
super(0xc0, "increment_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
@@ -1,28 +1,42 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncrementIns extends InstructionDefinition {
public IncrementIns() {
super(0x91, "increment", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncrementIns extends InstructionDefinition {
public IncrementIns() {
super(0x91, "increment", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop()));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.ModuloTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class ModuloIns extends InstructionDefinition {
public ModuloIns() {
super(0xa4, "modulo", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new ModuloTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.ModuloTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class ModuloIns extends InstructionDefinition {
public ModuloIns() {
super(0xa4, "modulo", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new ModuloTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class MultiplyIIns extends InstructionDefinition {
public MultiplyIIns() {
super(0xc7, "multiply_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class MultiplyIIns extends InstructionDefinition {
public MultiplyIIns() {
super(0xc7, "multiply_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class MultiplyIns extends InstructionDefinition {
public MultiplyIns() {
super(0xa2, "multiply", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class MultiplyIns extends InstructionDefinition {
public MultiplyIns() {
super(0xa2, "multiply", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new MultiplyTreeItem(ins, v1, v2));
}
}
@@ -1,29 +1,43 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NegateIIns extends InstructionDefinition {
public NegateIIns() {
super(0xc4, "negate_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NegateIIns extends InstructionDefinition {
public NegateIIns() {
super(0xc4, "negate_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
}
@@ -1,29 +1,43 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NegateIns extends InstructionDefinition {
public NegateIns() {
super(0x90, "negate", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NegateIns extends InstructionDefinition {
public NegateIns() {
super(0x90, "negate", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new NegTreeItem(ins, v));
}
}
@@ -1,29 +1,43 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NotIns extends InstructionDefinition {
public NotIns() {
super(0x96, "not", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new NotTreeItem(ins, v));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NotIns extends InstructionDefinition {
public NotIns() {
super(0x96, "not", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new NotTreeItem(ins, v));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SubtractIIns extends InstructionDefinition {
public SubtractIIns() {
super(0xc6, "subtract_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SubtractIIns extends InstructionDefinition {
public SubtractIIns() {
super(0xc6, "subtract_i", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SubtractIns extends InstructionDefinition {
public SubtractIns() {
super(0xa1, "subtract", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.arithmetic;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SubtractIns extends InstructionDefinition {
public SubtractIns() {
super(0xa1, "subtract", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new SubtractTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitAndTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitAndIns extends InstructionDefinition {
public BitAndIns() {
super(0xa8, "bitand", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 & value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new BitAndTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitAndTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitAndIns extends InstructionDefinition {
public BitAndIns() {
super(0xa8, "bitand", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 & value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new BitAndTreeItem(ins, v1, v2));
}
}
@@ -1,37 +1,51 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitNotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitNotIns extends InstructionDefinition {
public BitNotIns() {
super(0x97, "bitnot", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value = (Long) lda.operandStack.pop();
Long ret = new Long(-value.longValue());
lda.operandStack.push(ret);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new BitNotTreeItem(ins, v));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitNotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitNotIns extends InstructionDefinition {
public BitNotIns() {
super(0x97, "bitnot", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value = (Long) lda.operandStack.pop();
Long ret = new Long(-value.longValue());
lda.operandStack.push(ret);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v = (TreeItem) stack.pop();
stack.push(new BitNotTreeItem(ins, v));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitOrTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitOrIns extends InstructionDefinition {
public BitOrIns() {
super(0xa9, "bitor", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 | value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new BitOrTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitOrTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitOrIns extends InstructionDefinition {
public BitOrIns() {
super(0xa9, "bitor", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 | value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new BitOrTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitXorTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitXorIns extends InstructionDefinition {
public BitXorIns() {
super(0xaa, "bitxor", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 ^ value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new BitXorTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.BitXorTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class BitXorIns extends InstructionDefinition {
public BitXorIns() {
super(0xaa, "bitxor", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Long value2 = (Long) lda.operandStack.pop();
Long value1 = (Long) lda.operandStack.pop();
Long value3 = value1 ^ value2;
lda.operandStack.push(value3);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new BitXorTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LShiftTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LShiftIns extends InstructionDefinition {
public LShiftIns() {
super(0xa5, "lshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LShiftTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LShiftTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LShiftIns extends InstructionDefinition {
public LShiftIns() {
super(0xa5, "lshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LShiftTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.RShiftTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class RShiftIns extends InstructionDefinition {
public RShiftIns() {
super(0xa6, "rshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new RShiftTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.RShiftTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class RShiftIns extends InstructionDefinition {
public RShiftIns() {
super(0xa6, "rshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new RShiftTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.URShiftTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class URShiftIns extends InstructionDefinition {
public URShiftIns() {
super(0xa7, "urshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new URShiftTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.bitwise;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.URShiftTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class URShiftIns extends InstructionDefinition {
public URShiftIns() {
super(0xa7, "urshift", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new URShiftTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class EqualsIns extends InstructionDefinition {
public EqualsIns() {
super(0xab, "equals", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj1 = lda.operandStack.pop();
Object obj2 = lda.operandStack.pop();
Boolean res = obj1.equals(obj2);
lda.operandStack.push(res);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class EqualsIns extends InstructionDefinition {
public EqualsIns() {
super(0xab, "equals", new int[]{});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
Object obj1 = lda.operandStack.pop();
Object obj2 = lda.operandStack.pop();
Boolean res = obj1.equals(obj2);
lda.operandStack.push(res);
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GreaterEqualsIns extends InstructionDefinition {
public GreaterEqualsIns() {
super(0xb0, "greaterequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GreaterEqualsIns extends InstructionDefinition {
public GreaterEqualsIns() {
super(0xb0, "greaterequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GreaterThanIns extends InstructionDefinition {
public GreaterThanIns() {
super(0xaf, "greaterthan", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GreaterThanIns extends InstructionDefinition {
public GreaterThanIns() {
super(0xaf, "greaterthan", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LessEqualsIns extends InstructionDefinition {
public LessEqualsIns() {
super(0xae, "lessequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LessEqualsIns extends InstructionDefinition {
public LessEqualsIns() {
super(0xae, "lessequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LessThanIns extends InstructionDefinition {
public LessThanIns() {
super(0xad, "lessthan", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LessThanIns extends InstructionDefinition {
public LessThanIns() {
super(0xad, "lessthan", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class StrictEqualsIns extends InstructionDefinition {
public StrictEqualsIns() {
super(0xac, "strictequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.comparsion;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class StrictEqualsIns extends InstructionDefinition {
public StrictEqualsIns() {
super(0xac, "strictequals", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
}
@@ -1,50 +1,64 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ConstructTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class ConstructIns extends InstructionDefinition {
public ConstructIns() {
super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();
throw new RuntimeException("Cannot call constructor");
//call construct property of obj
//push new instance
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem obj = (TreeItem) stack.pop();
stack.push(new ConstructTreeItem(ins, obj, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ConstructTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class ConstructIns extends InstructionDefinition {
public ConstructIns() {
super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();
throw new RuntimeException("Cannot call constructor");
//call construct property of obj
//push new instance
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem obj = (TreeItem) stack.pop();
stack.push(new ConstructTreeItem(ins, obj, args));
}
}
@@ -1,57 +1,71 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ConstructPropTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class ConstructPropIns extends InstructionDefinition {
public ConstructPropIns() {
super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
throw new RuntimeException("Cannot construct property");
//create property
//push new instance
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem obj = (TreeItem) stack.pop();
stack.push(new ConstructPropTreeItem(ins, obj, multiname, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ConstructPropTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class ConstructPropIns extends InstructionDefinition {
public ConstructPropIns() {
super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
throw new RuntimeException("Cannot construct property");
//create property
//push new instance
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem obj = (TreeItem) stack.pop();
stack.push(new ConstructPropTreeItem(ins, obj, multiname, args));
}
}
@@ -1,50 +1,64 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ConstructSuperTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class ConstructSuperIns extends InstructionDefinition {
public ConstructSuperIns() {
super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();
throw new RuntimeException("Cannot call super constructor");
//call construct property of obj
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem obj = (TreeItem) stack.pop();
output.add(new ConstructSuperTreeItem(ins, obj, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ConstructSuperTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class ConstructSuperIns extends InstructionDefinition {
public ConstructSuperIns() {
super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object obj = lda.operandStack.pop();
throw new RuntimeException("Cannot call super constructor");
//call construct property of obj
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem obj = (TreeItem) stack.pop();
output.add(new ConstructSuperTreeItem(ins, obj, args));
}
}
@@ -1,28 +1,42 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewActivationIns extends InstructionDefinition {
public NewActivationIns() {
super(0x57, "newactivation", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new NewActivationTreeItem(ins));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewActivationIns extends InstructionDefinition {
public NewActivationIns() {
super(0x57, "newactivation", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new NewActivationTreeItem(ins));
}
}
@@ -1,35 +1,49 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NewArrayTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class NewArrayIns extends InstructionDefinition {
public NewArrayIns() {
super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
stack.push(new NewArrayTreeItem(ins, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NewArrayTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class NewArrayIns extends InstructionDefinition {
public NewArrayIns() {
super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
stack.push(new NewArrayTreeItem(ins, args));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewCatchIns extends InstructionDefinition {
public NewCatchIns() {
super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int exInfo = ins.operands[0];
stack.push(new ExceptionTreeItem(body.exceptions[exInfo]));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewCatchIns extends InstructionDefinition {
public NewCatchIns() {
super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int exInfo = ins.operands[0];
stack.push(new ExceptionTreeItem(body.exceptions[exInfo]));
}
}
@@ -1,31 +1,45 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewClassIns extends InstructionDefinition {
public NewClassIns() {
super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int clsIndex = ins.operands[0];
String baseType = stack.pop().toString();
stack.push(new UnparsedTreeItem(ins, "new class(" + clsIndex + ") extends " + baseType));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewClassIns extends InstructionDefinition {
public NewClassIns() {
super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int clsIndex = ins.operands[0];
String baseType = stack.pop().toString();
stack.push(new UnparsedTreeItem(ins, "new class(" + clsIndex + ") extends " + baseType));
}
}
@@ -1,36 +1,50 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NewFunctionTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodBody;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewFunctionIns extends InstructionDefinition {
public NewFunctionIns() {
super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int methodIndex = ins.operands[0];
MethodBody mybody = abc.findBody(methodIndex);
String bodyStr = "";
if (mybody != null) {
bodyStr = mybody.toString(isStatic, classIndex, abc, constants, method_info, false);
}
stack.push(new NewFunctionTreeItem(ins, method_info[methodIndex].getParamStr(constants), method_info[methodIndex].getReturnTypeStr(constants), bodyStr));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NewFunctionTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodBody;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class NewFunctionIns extends InstructionDefinition {
public NewFunctionIns() {
super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int methodIndex = ins.operands[0];
MethodBody mybody = abc.findBody(methodIndex);
String bodyStr = "";
if (mybody != null) {
bodyStr = mybody.toString(isStatic, classIndex, abc, constants, method_info, false);
}
stack.push(new NewFunctionTreeItem(ins, method_info[methodIndex].getParamStr(constants), method_info[methodIndex].getReturnTypeStr(constants), bodyStr));
}
}
@@ -1,38 +1,52 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NameValuePair;
import com.jpexs.asdec.abc.avm2.treemodel.NewObjectTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class NewObjectIns extends InstructionDefinition {
public NewObjectIns() {
super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<NameValuePair> args = new ArrayList<NameValuePair>();
for (int a = 0; a < argCount; a++) {
TreeItem value = (TreeItem) stack.pop();
TreeItem name = (TreeItem) stack.pop();
args.add(0, new NameValuePair(name, value));
}
stack.push(new NewObjectTreeItem(ins, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.construction;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.NameValuePair;
import com.jpexs.asdec.abc.avm2.treemodel.NewObjectTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class NewObjectIns extends InstructionDefinition {
public NewObjectIns() {
super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<NameValuePair> args = new ArrayList<NameValuePair>();
for (int a = 0; a < argCount; a++) {
TreeItem value = (TreeItem) stack.pop();
TreeItem name = (TreeItem) stack.pop();
args.add(0, new NameValuePair(name, value));
}
stack.push(new NewObjectTreeItem(ins, args));
}
}
@@ -1,17 +1,31 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.debug;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
public class DebugFileIns extends InstructionDefinition {
public DebugFileIns() {
super(0xf1, "debugfile", new int[]{AVM2Code.DAT_STRING_INDEX});
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.debug;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
public class DebugFileIns extends InstructionDefinition {
public DebugFileIns() {
super(0xf1, "debugfile", new int[]{AVM2Code.DAT_STRING_INDEX});
}
}
@@ -1,17 +1,31 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.debug;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
public class DebugIns extends InstructionDefinition {
public DebugIns() {
super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_REGISTER_INDEX, AVM2Code.OPT_U30});
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.debug;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
public class DebugIns extends InstructionDefinition {
public DebugIns() {
super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_REGISTER_INDEX, AVM2Code.OPT_U30});
}
}
@@ -1,17 +1,31 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.debug;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
public class DebugLineIns extends InstructionDefinition {
public DebugLineIns() {
super(0xf0, "debugline", new int[]{AVM2Code.DAT_LINENUM});
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.debug;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
public class DebugLineIns extends InstructionDefinition {
public DebugLineIns() {
super(0xf0, "debugline", new int[]{AVM2Code.DAT_LINENUM});
}
}
@@ -1,51 +1,65 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallIns extends InstructionDefinition {
public CallIns() {
super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
Object function = lda.operandStack.pop();
throw new RuntimeException("Call to unknown function");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem receiver = (TreeItem) stack.pop();
TreeItem function = (TreeItem) stack.pop();
stack.push(new CallTreeItem(ins, receiver, function, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallIns extends InstructionDefinition {
public CallIns() {
super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int argCount = (int) ((Long) arguments.get(0)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
Object function = lda.operandStack.pop();
throw new RuntimeException("Call to unknown function");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int argCount = ins.operands[0];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem receiver = (TreeItem) stack.pop();
TreeItem function = (TreeItem) stack.pop();
stack.push(new CallTreeItem(ins, receiver, function, args));
}
}
@@ -1,52 +1,66 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallMethodTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallMethodIns extends InstructionDefinition {
public CallMethodIns() {
super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem receiver = (TreeItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallMethodTreeItem(ins, receiver, methodName, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallMethodTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallMethodIns extends InstructionDefinition {
public CallMethodIns() {
super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem receiver = (TreeItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallMethodTreeItem(ins, receiver, methodName, args));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallPropLexIns extends CallPropertyIns {
public CallPropLexIns() {
instructionName = "callproplex";
instructionCode = 0x4c;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallPropLexIns extends CallPropertyIns {
public CallPropLexIns() {
instructionName = "callproplex";
instructionCode = 0x4c;
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
}
@@ -1,59 +1,73 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallPropVoidIns extends InstructionDefinition {
public CallPropVoidIns() {
super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
//same as callproperty
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();
throw new RuntimeException("Call to unknown property");
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
output.add(new CallPropertyTreeItem(ins, true, receiver, multiname, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallPropVoidIns extends InstructionDefinition {
public CallPropVoidIns() {
super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
//same as callproperty
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();
throw new RuntimeException("Call to unknown property");
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
output.add(new CallPropertyTreeItem(ins, true, receiver, multiname, args));
}
}
@@ -1,57 +1,71 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallPropertyIns extends InstructionDefinition {
public CallPropertyIns() {
super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();
throw new RuntimeException("Call to unknown property");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallPropertyIns extends InstructionDefinition {
public CallPropertyIns() {
super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object obj = lda.operandStack.pop();
throw new RuntimeException("Call to unknown property");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args));
}
}
@@ -1,52 +1,66 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallStaticTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallStaticIns extends InstructionDefinition {
public CallStaticIns() {
super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown static method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem receiver = (TreeItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallStaticTreeItem(ins, receiver, methodName, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallStaticTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallStaticIns extends InstructionDefinition {
public CallStaticIns() {
super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown static method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int methodIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
TreeItem receiver = (TreeItem) stack.pop();
String methodName = method_info[methodIndex].getName(constants);
stack.push(new CallStaticTreeItem(ins, receiver, methodName, args));
}
}
@@ -1,56 +1,70 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallSuperIns extends InstructionDefinition {
public CallSuperIns() {
super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown super method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
stack.push(new CallSuperTreeItem(ins, false, receiver, multiname, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallSuperIns extends InstructionDefinition {
public CallSuperIns() {
super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown super method");
//push(result)
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add(0, (TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
stack.push(new CallSuperTreeItem(ins, false, receiver, multiname, args));
}
}
@@ -1,57 +1,71 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallSuperVoidIns extends InstructionDefinition {
public CallSuperVoidIns() {
super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown super method");
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add((TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
output.add(new CallSuperTreeItem(ins, true, receiver, multiname, args));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.executing;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class CallSuperVoidIns extends InstructionDefinition {
public CallSuperVoidIns() {
super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int multinameIndex = (int) ((Long) arguments.get(0)).longValue();
int argCount = (int) ((Long) arguments.get(1)).longValue();
List passArguments = new ArrayList();
for (int i = argCount - 1; i >= 0; i--) {
passArguments.set(i, lda.operandStack.pop());
}
//if multiname[multinameIndex] is runtime
//pop(name) pop(ns)
Object receiver = lda.operandStack.pop();
throw new RuntimeException("Call to unknown super method");
//do not push anything
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int multinameIndex = ins.operands[0];
int argCount = ins.operands[1];
List<TreeItem> args = new ArrayList<TreeItem>();
for (int a = 0; a < argCount; a++) {
args.add((TreeItem) stack.pop());
}
FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins);
TreeItem receiver = (TreeItem) stack.pop();
output.add(new CallSuperTreeItem(ins, true, receiver, multiname, args));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfEqIns extends InstructionDefinition implements IfTypeIns {
public IfEqIns() {
super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfEqIns extends InstructionDefinition implements IfTypeIns {
public IfEqIns() {
super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
}
@@ -1,36 +1,50 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
public IfFalseIns() {
super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NotTreeItem(ins, v1));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfFalseIns extends InstructionDefinition implements IfTypeIns {
public IfFalseIns() {
super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NotTreeItem(ins, v1));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfGeIns extends InstructionDefinition implements IfTypeIns {
public IfGeIns() {
super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfGeIns extends InstructionDefinition implements IfTypeIns {
public IfGeIns() {
super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfGtIns extends InstructionDefinition implements IfTypeIns {
public IfGtIns() {
super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfGtIns extends InstructionDefinition implements IfTypeIns {
public IfGtIns() {
super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfLeIns extends InstructionDefinition implements IfTypeIns {
public IfLeIns() {
super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfLeIns extends InstructionDefinition implements IfTypeIns {
public IfLeIns() {
super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfLtIns extends InstructionDefinition implements IfTypeIns {
public IfLtIns() {
super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfLtIns extends InstructionDefinition implements IfTypeIns {
public IfLtIns() {
super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNGeIns extends InstructionDefinition implements IfTypeIns {
public IfNGeIns() {
super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNGeIns extends InstructionDefinition implements IfTypeIns {
public IfNGeIns() {
super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNGtIns extends InstructionDefinition implements IfTypeIns {
public IfNGtIns() {
super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNGtIns extends InstructionDefinition implements IfTypeIns {
public IfNGtIns() {
super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNLeIns extends InstructionDefinition implements IfTypeIns {
public IfNLeIns() {
super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNLeIns extends InstructionDefinition implements IfTypeIns {
public IfNLeIns() {
super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GtTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LeTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNLtIns extends InstructionDefinition implements IfTypeIns {
public IfNLtIns() {
super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNLtIns extends InstructionDefinition implements IfTypeIns {
public IfNLtIns() {
super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new GeTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new LtTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNeIns extends InstructionDefinition implements IfTypeIns {
public IfNeIns() {
super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfNeIns extends InstructionDefinition implements IfTypeIns {
public IfNeIns() {
super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NeqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new EqTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns {
public IfStrictEqIns() {
super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns {
public IfStrictEqIns() {
super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
}
@@ -1,39 +1,53 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns {
public IfStrictNeIns() {
super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns {
public IfStrictNeIns() {
super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictNeqTreeItem(ins, v1, v2));
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v2 = (TreeItem) stack.pop();
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new StrictEqTreeItem(ins, v1, v2));
}
}
@@ -1,36 +1,50 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
public IfTrueIns() {
super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NotTreeItem(ins, v1));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IfTrueIns extends InstructionDefinition implements IfTypeIns {
public IfTrueIns() {
super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
//String v1 = stack.pop().toString();
//stack.push("(" + v1 + ")");
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
TreeItem v1 = (TreeItem) stack.pop();
stack.push(new NotTreeItem(ins, v1));
}
}
@@ -1,34 +1,48 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class JumpIns extends InstructionDefinition implements IfTypeIns {
public JumpIns() {
super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new BooleanTreeItem(ins, Boolean.TRUE));// + ins.operands[0]);
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class JumpIns extends InstructionDefinition implements IfTypeIns {
public JumpIns() {
super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new BooleanTreeItem(ins, Boolean.TRUE));// + ins.operands[0]);
}
public void translateInverted(java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, AVM2Instruction ins) {
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LookupSwitchIns extends InstructionDefinition {
public LookupSwitchIns() {
super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int defaultOffset = ins.operands[0];
int caseCount = ins.operands[1];
//stack.push("switch(...)");
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.jumps;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class LookupSwitchIns extends InstructionDefinition {
public LookupSwitchIns() {
super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int defaultOffset = ins.operands[0];
int caseCount = ins.operands[1];
//stack.push("switch(...)");
}
}
@@ -1,50 +1,64 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecLocalIIns extends InstructionDefinition {
public DecLocalIIns() {
super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecLocalIIns extends InstructionDefinition {
public DecLocalIIns() {
super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
}
@@ -1,51 +1,65 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecLocalIns extends InstructionDefinition {
public DecLocalIns() {
super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.LocalDataArea;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class DecLocalIns extends InstructionDefinition {
public DecLocalIns() {
super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void execute(LocalDataArea lda, ConstantPool constants, List arguments) {
int locRegIndex = (int) ((Long) arguments.get(0)).longValue();
Object obj = lda.localRegisters.get(locRegIndex);
if (obj instanceof Long) {
Long obj2 = ((Long) obj).longValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else if (obj instanceof Double) {
Double obj2 = ((Double) obj).doubleValue() - 1;
lda.localRegisters.set(locRegIndex, obj2);
}
if (obj instanceof String) {
Double obj2 = Double.parseDouble((String) obj) - 1;
lda.localRegisters.set(locRegIndex, obj2);
} else {
throw new RuntimeException("Cannot decrement local register");
}
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new DecLocalTreeItem(ins, regIndex));
}
}
@@ -1,37 +1,51 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ClassTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.ThisTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal0Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal0Ins() {
super(0xd0, "getlocal_0", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
if (isStatic) {
stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants).getName(constants)));
} else {
stack.push(new ThisTreeItem());
}
}
public int getRegisterId(AVM2Instruction par0) {
return 0;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.ClassTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.ThisTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal0Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal0Ins() {
super(0xd0, "getlocal_0", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
if (isStatic) {
stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants).getName(constants)));
} else {
stack.push(new ThisTreeItem());
}
}
public int getRegisterId(AVM2Instruction par0) {
return 0;
}
}
@@ -1,32 +1,46 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal1Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal1Ins() {
super(0xd1, "getlocal_1", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new LocalRegTreeItem(ins, 1, localRegs.get(1)));
}
public int getRegisterId(AVM2Instruction par0) {
return 1;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal1Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal1Ins() {
super(0xd1, "getlocal_1", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new LocalRegTreeItem(ins, 1, localRegs.get(1)));
}
public int getRegisterId(AVM2Instruction par0) {
return 1;
}
}
@@ -1,32 +1,46 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal2Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal2Ins() {
super(0xd2, "getlocal_2", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new LocalRegTreeItem(ins, 2, localRegs.get(2)));
}
public int getRegisterId(AVM2Instruction par0) {
return 2;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal2Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal2Ins() {
super(0xd2, "getlocal_2", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new LocalRegTreeItem(ins, 2, localRegs.get(2)));
}
public int getRegisterId(AVM2Instruction par0) {
return 2;
}
}
@@ -1,32 +1,46 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal3Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal3Ins() {
super(0xd3, "getlocal_3", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new LocalRegTreeItem(ins, 3, localRegs.get(3)));
}
public int getRegisterId(AVM2Instruction par0) {
return 3;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocal3Ins extends InstructionDefinition implements GetLocalTypeIns {
public GetLocal3Ins() {
super(0xd3, "getlocal_3", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
stack.push(new LocalRegTreeItem(ins, 3, localRegs.get(3)));
}
public int getRegisterId(AVM2Instruction par0) {
return 3;
}
}
@@ -1,34 +1,48 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocalIns extends InstructionDefinition implements GetLocalTypeIns {
public GetLocalIns() {
super(0x62, "getlocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
stack.push(new LocalRegTreeItem(ins, regIndex, localRegs.get(regIndex)));
}
public int getRegisterId(AVM2Instruction ins) {
return ins.operands[0];
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class GetLocalIns extends InstructionDefinition implements GetLocalTypeIns {
public GetLocalIns() {
super(0x62, "getlocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
stack.push(new LocalRegTreeItem(ins, regIndex, localRegs.get(regIndex)));
}
public int getRegisterId(AVM2Instruction ins) {
return ins.operands[0];
}
}
@@ -1,12 +1,26 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
public interface GetLocalTypeIns {
public abstract int getRegisterId(AVM2Instruction ins);
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
public interface GetLocalTypeIns {
public abstract int getRegisterId(AVM2Instruction ins);
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncLocalIIns extends InstructionDefinition {
public IncLocalIIns() {
super(0xc2, "inclocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new IncLocalTreeItem(ins, regIndex));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncLocalIIns extends InstructionDefinition {
public IncLocalIIns() {
super(0xc2, "inclocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new IncLocalTreeItem(ins, regIndex));
}
}
@@ -1,30 +1,44 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncLocalIns extends InstructionDefinition {
public IncLocalIns() {
super(0x92, "inclocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new IncLocalTreeItem(ins, regIndex));
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class IncLocalIns extends InstructionDefinition {
public IncLocalIns() {
super(0x92, "inclocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
int regIndex = ins.operands[0];
output.add(new IncLocalTreeItem(ins, regIndex));
}
}
@@ -1,28 +1,42 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class KillIns extends InstructionDefinition {
public KillIns() {
super(0x08, "kill", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
//kill local register
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.AVM2Code;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class KillIns extends InstructionDefinition {
public KillIns() {
super(0x08, "kill", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
//kill local register
}
}
@@ -1,45 +1,59 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal0Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal0Ins() {
super(0xd4, "setlocal_0", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(0, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 0, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(0);
}
public int getRegisterId(AVM2Instruction ins) {
return 0;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal0Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal0Ins() {
super(0xd4, "setlocal_0", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(0, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 0, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(0);
}
public int getRegisterId(AVM2Instruction ins) {
return 0;
}
}
@@ -1,45 +1,59 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal1Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal1Ins() {
super(0xd5, "setlocal_1", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(1, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 1, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(1);
}
public int getRegisterId(AVM2Instruction ins) {
return 1;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal1Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal1Ins() {
super(0xd5, "setlocal_1", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(1, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 1, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(1);
}
public int getRegisterId(AVM2Instruction ins) {
return 1;
}
}
@@ -1,45 +1,59 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal2Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal2Ins() {
super(0xd6, "setlocal_2", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(2, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 2, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(2);
}
public int getRegisterId(AVM2Instruction ins) {
return 2;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal2Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal2Ins() {
super(0xd6, "setlocal_2", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(2, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 2, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(2);
}
public int getRegisterId(AVM2Instruction ins) {
return 2;
}
}
@@ -1,45 +1,59 @@
/*
* Copyright (c) 2010. JPEXS
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal3Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal3Ins() {
super(0xd7, "setlocal_3", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(3, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 3, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(3);
}
public int getRegisterId(AVM2Instruction ins) {
return 3;
}
}
/*
* Copyright (C) 2010 JPEXS
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package com.jpexs.asdec.abc.avm2.instructions.localregs;
import com.jpexs.asdec.abc.avm2.ConstantPool;
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem;
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
import com.jpexs.asdec.abc.types.MethodInfo;
import java.util.List;
import java.util.Stack;
public class SetLocal3Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns {
public SetLocal3Ins() {
super(0xd7, "setlocal_3", new int[]{});
}
@Override
public void translate(boolean isStatic, int classIndex, java.util.HashMap<Integer, TreeItem> localRegs, Stack<TreeItem> stack, java.util.Stack<TreeItem> scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) {
TreeItem val = (TreeItem) stack.pop();
localRegs.put(3, val);
if (val instanceof NewActivationTreeItem) return;
if (val instanceof FindPropertyTreeItem) return;
//if(val.startsWith("catchscope ")) return;
//if(val.startsWith("newactivation()")) return;
output.add(new SetLocalTreeItem(ins, 3, val));
}
public String getObject(Stack<TreeItem> stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List<TreeItem> output, com.jpexs.asdec.abc.types.MethodBody body) {
return localRegName(3);
}
public int getRegisterId(AVM2Instruction ins) {
return 3;
}
}

Some files were not shown because too many files have changed in this diff Show More