|
1 | 1 | package org.perl6.nqp.tools;
|
2 | 2 |
|
3 | 3 | import java.io.ByteArrayInputStream;
|
4 |
| -import java.io.ByteArrayOutputStream; |
5 | 4 | import java.io.IOException;
|
6 | 5 | import java.io.PrintStream;
|
7 | 6 | import java.net.InetSocketAddress;
|
@@ -38,40 +37,6 @@ public class EvalServer {
|
38 | 37 | private WritableByteChannel tokenCh;
|
39 | 38 | private Path tokenPath;
|
40 | 39 |
|
41 |
| - public String run(String appPath, String code) throws Exception { |
42 |
| - String[] argv = new String[2]; |
43 |
| - argv[0] = "-e"; |
44 |
| - argv[1] = code; |
45 |
| - return run(appPath, argv); |
46 |
| - } |
47 |
| - |
48 |
| - public String run(String appPath, String[] argv) throws Exception { |
49 |
| - try { |
50 |
| - cuType = LibraryLoader.loadFile( appPath, true ); |
51 |
| - } catch (ThreadDeath td) { |
52 |
| - throw new RuntimeException("Couldn't loadFile. Your CLASSPATH might not be set up correctly."); |
53 |
| - } |
54 |
| - |
55 |
| - GlobalContext gc = new GlobalContext(); |
56 |
| - gc.in = new ByteArrayInputStream(new byte[0]); |
57 |
| - ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
58 |
| - gc.out = gc.err = new PrintStream( baos, true, "UTF-8" ); |
59 |
| - gc.interceptExit = true; |
60 |
| - gc.sharingHint = true; |
61 |
| - |
62 |
| - CompilationUnit cu = CompilationUnit.setupCompilationUnit(gc.mainThread, cuType, true); |
63 |
| - CodeRef entryRef = null; |
64 |
| - if (cu.entryQbid() >= 0) entryRef = cu.lookupCodeRef(cu.entryQbid()); |
65 |
| - if (entryRef == null) |
66 |
| - throw new RuntimeException("This class is not an entry point"); |
67 |
| - try { |
68 |
| - Ops.invokeMain(gc.mainThread, entryRef, cuType.getName(), argv); |
69 |
| - } catch (ThreadDeath td) { |
70 |
| - baos.flush(); |
71 |
| - } |
72 |
| - return baos.toString("UTF-8"); |
73 |
| - } |
74 |
| - |
75 | 40 | public static void main(String[] args) throws Exception {
|
76 | 41 | String executableName = System.getProperty("perl6.execname");
|
77 | 42 | if (executableName != null) {
|
|
0 commit comments