!7 static new Flag taken; static Android3 android; p { android = makeAndroid3("A pre-spun VM."); taken.waitUntilUp(); } static synchronized S answer(S s, L history) { new Matches m; if (match3("please start program *", s, m)) { final S progID = formatSnippetID(unquote(m.m[0])); return startIt(progID, ""); } if (match3("please start program * with arguments *", s, m)) { final S progID = formatSnippetID(unquote(m.m[0])); final S args = unquote(m.m[1]); return startIt(progID, args); } if (match3("are you free to start a program?", s)) ret !taken.isUp() ? "Yes." : "No."; ret null; } static synchronized S startIt(final S progID, S args) { if (taken.isUp()) ret "Sorry, not free anymore."; free.raise(); final S[] splitArgs = toStringArray(codeTokensOnly(javaTok(args))); // yeah this is bad... thread { callMain(hotwire(progID), splitArgs); } if (android != null) { android.dispose(); android = null; } ret "OK."; }