!7 static boolean free = true; static Android3 android; p { android = makeAndroid3("A pre-spun VM."); sleep(); } 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 free ? "Yes." : "No."; ret null; } static synchronized S startIt(final S progID, S args) { if (!free) ret "Sorry, not free anymore."; free = false; 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."; }