public static void main(final String[] args) { long start = System.currentTimeMillis(); final VFrame frame = new VFrame(); // our frame chain. for (String s : args) frame.stack().push(new Term<String>(Type.TString, s)); final boolean interactive = args.length == 0 ? true : false; // Setup the world quote. Prologue.init(frame); try { // do we have any args? CharStream cs = null; if (args.length > 0) { debug("Opening:" + args[0]); cs = new FileCharStream(args[0]); } else { banner(); cs = ConsoleCharStream.getInstance(); } CmdQuote program = new CmdQuote(new LexStream(cs)) { public void dofunction(VFrame scope) { if (interactive) { try { super.dofunction(scope); } catch (VException e) { outln(">" + e.message()); outln(" " + e.stack()); frame.dump(); // frame.reinit(); V.debug(e); } catch (Exception e) { outln(">" + e.getMessage()); frame.dump(); // frame.reinit(); e.printStackTrace(); } } else super.dofunction(scope); } }; program.eval(frame.child()); // we save the original defs. } catch (VException e) { outln(e.message()); outln(e.stack()); debug(e); } catch (Exception e) { outln(e.getMessage()); debug(e); } if (_showtime) outln("time: " + (System.currentTimeMillis() - start)); }
public static String gets() { return ConsoleCharStream.getInstance().gets(); }