Profiler.display();
}
public static void execute(String path) throws IOException {
String script = MagpieAppHost.readFile(path);
Magpie magpie = new Magpie(new MagpieAppHost());
magpie.defineMethod("printString(s is String)",
"Prints the given string to stdout.", new Method() {
public Object call(Object left, Object right) {
System.out.print(right);
return null;
}
});
String result = magpie.run(new SourceFile(path, script));
if (result != null) {
System.out.println(result);
}
}