!1001362 // named threads static new L<PaA> injectable_programsInjected; static boolean injectable_on; static class PaA { S progID; S[] arguments; *(S *progID, S[] *arguments) {} *() {} } static synchronized void injectable() { if (injectable_on) return; injectable_on = true; Android3 android = new Android3("Injectable. PID: " + getPID() + "."); android.responder = new Responder() { S answer(S s, L<S> history) { new Matches m; if (match3("please inject program *", s, m) || match3("please inject program * with arguments *", s, m)) { final S progID = formatSnippetID(unquote(m.m[0])); final S[] arguments = m.m.length > 1 ? toStringArray((List) unstructure(unquote(m.m[1]))) : new S[0]; injectable_programsInjected.add(new PaA(progID, arguments)); // better call JavaX for translation in a single thread. final Class theClass = hotwire(progID); // program may run in its own thread. thread progID { callMain(theClass, arguments); } ret "OK."; } ret null; } }; makeAndroid3(android); print("VM " + getPID() + " made injectable."); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001375 |
Snippet name: | injectable - allow code to be injected into this VM |
Eternal ID of this version: | #1001375/1 |
Text MD5: | 7fefeedad5cccf505958ea23061912ce |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-10-12 17:47:08 |
Source code size: | 1337 bytes / 44 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 634 / 852 |
Referenced in: | #1002427 - Accellerating 629 (SPIKE) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |