Uses 911K of libraries. Click here for Pure Java version (19426L/110K).
1 | !7 |
2 | |
3 | concept Entry { |
4 | S condition, code; |
5 | bool enabled = true; |
6 | transient O runnable; |
7 | } |
8 | |
9 | set flag DynModule. |
10 | |
11 | compact module JavaInputConditionToCode > DynCRUD<Entry> { |
12 | *() { super(Entry); } |
13 | |
14 | start { |
15 | db(); |
16 | dm_onTopInput(voidfunc(fS s) { |
17 | thread { |
18 | for (Entry e : conceptsWhere(Entry, enabled := true)) pcall { |
19 | if (e.runnable == null) |
20 | e.runnable = codeToFunctionOnString(e.condition); |
21 | if (isTrue(callF(e.runnable, s))) { |
22 | print("JCTC running " + e.id); |
23 | S code = trim(e.code); |
24 | bool say = startsWith(code, "="); |
25 | if (say) code = substring(code, 1); |
26 | try { |
27 | temp tempSetTL(evalJava_prep_args, "fS s"); |
28 | O result = dm_evalJava_withModule(code, s); |
29 | if (say) dm_say(strOrNull(result)); |
30 | } catch print _e { |
31 | if (say) dm_say("Internal error, Sir"); |
32 | } |
33 | } |
34 | } |
35 | } |
36 | }); |
37 | } |
38 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1020991 |
Snippet name: | Java Condition To Code [Input to Code] |
Eternal ID of this version: | #1020991/5 |
Text MD5: | 763f2bc0735c747317a7f17d6224e90c |
Transpilation MD5: | 20ad41f921caf1834a11f85dab99a979 |
Author: | stefan |
Category: | |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-01-16 01:13:08 |
Source code size: | 1008 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 317 / 1335 |
Version history: | 4 change(s) |
Referenced in: | [show references] |