*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@161 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 48875572ac
commit ce88f5d583
  1. 17
      jode/jode/Decompiler.java
  2. 57
      jode/jode/JodeApplet.java
  3. 4
      jode/jode/decompiler/CodeAnalyzer.java
  4. 6
      jode/jode/decompiler/ImportHandler.java

@ -24,7 +24,8 @@ public class Decompiler {
public final static String version = "0.99"; public final static String version = "0.99";
public final static String email = "jochen@gnu.org"; public final static String email = "jochen@gnu.org";
public final static String copyright = public final static String copyright =
"Jode Copyright 1998,1999 Jochen Hoenicke <"+email+">"; "Jode (c) 1998,1999 Jochen Hoenicke <"+email+">";
public static PrintStream err = System.err;
public static boolean isVerbose = false; public static boolean isVerbose = false;
public static boolean isDebugging = false; public static boolean isDebugging = false;
public static boolean isTypeDebugging = false; public static boolean isTypeDebugging = false;
@ -39,8 +40,8 @@ public class Decompiler {
public static int importClassLimit = 3; public static int importClassLimit = 3;
public static void usage() { public static void usage() {
System.err.println("Version: " + version); err.println("Version: " + version);
System.err.println("use: jode [-v][--dest <destdir>]" err.println("use: jode [-v][--dest <destdir>]"
+"[--imm][--debug][--analyze][--flow]" +"[--imm][--debug][--analyze][--flow]"
+"[--type][--inout][--lvt][--check]" +"[--type][--inout][--lvt][--check]"
+"[--import <pkglimit> <clslimit>]" +"[--import <pkglimit> <clslimit>]"
@ -52,7 +53,7 @@ public class Decompiler {
int i; int i;
String classPath = System.getProperty("java.class.path"); String classPath = System.getProperty("java.class.path");
File destDir = null; File destDir = null;
System.err.println(copyright); err.println(copyright);
for (i=0; i<params.length && params[i].startsWith("-"); i++) { for (i=0; i<params.length && params[i].startsWith("-"); i++) {
if (params[i].equals("-v")) if (params[i].equals("-v"))
isVerbose = true; isVerbose = true;
@ -86,7 +87,7 @@ public class Decompiler {
break; break;
} else { } else {
if (!params[i].startsWith("-h")) if (!params[i].startsWith("-h"))
System.err.println("Unknown option: "+params[i]); err.println("Unknown option: "+params[i]);
usage(); usage();
return; return;
} }
@ -110,9 +111,9 @@ public class Decompiler {
} }
env.doClass(params[i], writer); env.doClass(params[i], writer);
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Can't write source of "+params[i]+"."); err.println("Can't write source of "+params[i]+".");
System.out.println("Make sure that all directories exist."); err.println("Make sure that all directories exist.");
ex.printStackTrace(); ex.printStackTrace(err);
} }
} }
} }

@ -4,64 +4,19 @@ import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.io.*; import java.io.*;
public class JodeApplet extends Applet implements ActionListener, Runnable { public class JodeApplet extends Applet {
TextField classpathField; JodeWindow jodeWin;
TextField classField;
TextArea sourcecodeField;
Thread decompileThread;
public JodeApplet() { public JodeApplet() {
setLayout(new BorderLayout()); jodeWin = new JodeWindow(this);
Panel optionPanel = new Panel();
optionPanel.setLayout(new GridLayout(2,2));
optionPanel.add(new Label("class path: "));
classpathField = new TextField();
optionPanel.add(classpathField);
optionPanel.add(new Label("class name: "));
classField = new TextField();
optionPanel.add(classField);
add(optionPanel, BorderLayout.NORTH);
sourcecodeField = new TextArea();
add(sourcecodeField, BorderLayout.CENTER);
classField.addActionListener(this);
}
public synchronized void actionPerformed(ActionEvent e) {
if (decompileThread == null) {
decompileThread = new Thread(this);
sourcecodeField.setText("Please wait, while decompiling...\n");
decompileThread.start();
} else
sourcecodeField.append("Be a little bit more patient, please.\n");
} }
public void init() { public void init() {
String cp = getParameter("classpath"); String cp = getParameter("classpath");
if (cp != null) if (cp != null)
classpathField.setText(cp); jodeWin.setClasspath(cp);
String cls = getParameter("class"); String cls = getParameter("class");
if (cls != null) if (cls != null)
classField.setText(cls); jodeWin.setClass(cls);
}
public void run() {
JodeEnvironment env = new JodeEnvironment(classpathField.getText());
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
TabbedPrintWriter writer = new TabbedPrintWriter(out, " ");
env.doClass(classField.getText(), writer);
sourcecodeField.setText(out.toString());
} catch (Throwable t) {
sourcecodeField.setText("Didn't succeed.\n"
+"Check the java console for more info.");
t.printStackTrace();
} finally {
synchronized(this) {
decompileThread = null;
}
}
} }
} }

@ -130,7 +130,7 @@ public class CodeAnalyzer implements Analyzer {
= Opcodes.readOpcode(cpool, addr, stream, this); = Opcodes.readOpcode(cpool, addr, stream, this);
if (jode.Decompiler.isVerbose && addr > mark) { if (jode.Decompiler.isVerbose && addr > mark) {
System.err.print('.'); Decompiler.err.print('.');
mark += 1000; mark += 1000;
} }
@ -174,7 +174,7 @@ public class CodeAnalyzer implements Analyzer {
} }
if (Decompiler.isVerbose) if (Decompiler.isVerbose)
System.err.print('-'); Decompiler.err.print('-');
excHandlers.analyze(); excHandlers.analyze();
methodHeader = instr[0]; methodHeader = instr[0];

@ -155,7 +155,7 @@ public class JodeEnvironment {
} }
public void error(String message) { public void error(String message) {
System.err.println(message); Decompiler.err.println(message);
} }
public void doClass(String className, TabbedPrintWriter writer) public void doClass(String className, TabbedPrintWriter writer)
@ -165,11 +165,11 @@ public class JodeEnvironment {
try { try {
clazz = ClassInfo.forName(className); clazz = ClassInfo.forName(className);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
System.err.println("`"+className+"' is not a class name"); Decompiler.err.println("`"+className+"' is not a class name");
return; return;
} }
System.err.println(className); Decompiler.err.println(className);
int pkgdelim = className.lastIndexOf('.'); int pkgdelim = className.lastIndexOf('.');
pkg = (pkgdelim == -1)? "" : className.substring(0, pkgdelim); pkg = (pkgdelim == -1)? "" : className.substring(0, pkgdelim);

Loading…
Cancel
Save