| 146 | } |
| 147 | |
| 148 | public static void decompile(String in, String out, Configuration config) throws IOException { |
| 149 | LFunction lmain = file_to_function(in, config); |
| 150 | Decompiler d = new Decompiler(lmain); |
| 151 | Decompiler.State result = d.decompile(); |
| 152 | final PrintStream pout = new PrintStream(out); |
| 153 | d.print(result, new Output(new OutputProvider() { |
| 154 | |
| 155 | @Override |
| 156 | public void print(String s) { |
| 157 | pout.print(s); |
| 158 | } |
| 159 | |
| 160 | @Override |
| 161 | public void print(byte b) { |
| 162 | pout.write(b); |
| 163 | } |
| 164 | |
| 165 | @Override |
| 166 | public void println() { |
| 167 | pout.println(); |
| 168 | } |
| 169 | |
| 170 | })); |
| 171 | pout.flush(); |
| 172 | pout.close(); |
| 173 | } |
| 174 | |
| 175 | public static void assemble(String in, String out) throws IOException, AssemblerException { |
| 176 | OutputStream outstream = new BufferedOutputStream(new FileOutputStream(new File(out))); |