1 | !1001362 // named threads |
2 | |
3 | static new L<PaA> injectable_programsInjected; |
4 | static boolean injectable_on; |
5 | |
6 | static class PaA { |
7 | S progID; |
8 | S[] arguments; |
9 | |
10 | *(S *progID, S[] *arguments) {} |
11 | *() {} |
12 | } |
13 | |
14 | static synchronized void injectable() { |
15 | if (injectable_on) return; |
16 | injectable_on = true; |
17 | Android3 android = new Android3("Injectable. PID: " + getPID() + "."); |
18 | android.responder = new Responder() { |
19 | S answer(S s, L<S> history) { |
20 | new Matches m; |
21 | |
22 | if (match3("please inject program *", s, m) || match3("please inject program * with arguments *", s, m)) { |
23 | final S progID = formatSnippetID(unquote(m.m[0])); |
24 | final S[] arguments = m.m.length > 1 ? toStringArray((List) unstructure(unquote(m.m[1]))) : new S[0]; |
25 | injectable_programsInjected.add(new PaA(progID, arguments)); |
26 | |
27 | // better call JavaX for translation in a single thread. |
28 | final Class theClass = hotwire(progID); |
29 | |
30 | // program may run in its own thread. |
31 | thread progID { |
32 | callMain(theClass, arguments); |
33 | } |
34 | |
35 | ret "OK."; |
36 | } |
37 | |
38 | ret null; |
39 | } |
40 | }; |
41 | |
42 | makeAndroid3(android); |
43 | print("VM " + getPID() + " made injectable."); |
44 | } |
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: | 633 / 852 |
Referenced in: | [show references] |