Libraryless. Click here for Pure Java version (1043L/8K/26K).
!747 m { static S[] args; p { main.args = args; makeAndroid("This is a JavaX VM talking to you.", stringfunc { answer(s) }); } static synchronized S answer(S s) { new Matches m; if (match3("kill!", s)) { killMyself(); return "ok"; } if (match3("What is your process ID?", s) || match3("what is your pid?", s)) return getPID(); if (match3("what is your program id?", s)) return getProgramID(); if (match3("what are your program arguments?", s)) return structure(args); if (match3("get fields of main class", s)) return structure(listFields(main.class)); if (match3("get field * of main class", s, m)) return structure(get(main.class, m.m[0])); if (match3("invoke function * of main class", s, m)) return structure(call(main.class, m.m[0])); if (match3("set field * of main class to *", s, m)) { set(main.class, m.m[0], unstructure(m.m[1])); return "ok"; } if (match3("how much memory are you consuming", s)) return "Java heap size: " + (Runtime.getRuntime().totalMemory()+1024*1024-1)/1024/1024 + " MB"; if (match3("how much memory is used after GC?", s)) { System.gc(); return "Java heap used: " + (Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()+1024*1024-1)/1024/1024 + " MB"; } if (match3("how much memory is used?", s)) return "Java heap used: " + (Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()+1024*1024-1)/1024/1024 + " MB"; return null; } }
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001120 |
Snippet name: | Speaking VM (developing) |
Eternal ID of this version: | #1001120/1 |
Text MD5: | 9cb5fccd7eb249f6c9325939bdb7548b |
Transpilation MD5: | 00b44a3fa87d97a2132b580f472d0569 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-09-22 20:52:34 |
Source code size: | 1624 bytes / 46 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 620 / 632 |
Referenced in: | [show references] |