Uses 1113K of libraries. Click here for Pure Java version (21791L/116K).
1 | !7 |
2 | |
3 | set flag DynModule. // for transpilation |
4 | |
5 | cm JavaEval > DynPrintLog {
|
6 | S expression; |
7 | bool realEval = true; |
8 | transient bool calculating; |
9 | transient O value; |
10 | transient JTextArea taInput; |
11 | transient Throwable error; |
12 | |
13 | visual withMargin(jvsplit( |
14 | centerAndEastWithMarginInbetween( |
15 | onCtrlEnter(taInput = jEnableUndoRedo(dm_typeWriterTextArea expression()), rThread { mediumRefresh(); evalIt() }),
|
16 | withTopMargin(3, vstackWithSpacing(5, |
17 | withBottomMargin(fontSizePlus(4, makeBold(toolTip("Evaluate the code (always medium-refreshes)", jbutton("EVAL", rThread { mediumRefresh(); evalIt() }))))),
|
18 | toolTip("Evaluate in latest language version", jbutton("Fresh", rThread { refresh(); evalIt() })),
|
19 | centerAndEastWithMargin( |
20 | withToolTip("Use the real Java compiler, don't use shortcuts - just leave checked if in doubt",
|
21 | dm_fieldCheckBox("Real", 'realEval)),
|
22 | jPopDownButton_noText( |
23 | "Show Java Transpilation", rThread showJavaTranspilation, |
24 | ))))), |
25 | super)); |
26 | |
27 | void mediumRefresh enter {
|
28 | dm_mediumRefreshTranspiler(); |
29 | loadFunctions_clearCache(); |
30 | print("Medium-refreshed translator.");
|
31 | } |
32 | |
33 | void refresh enter {
|
34 | dm_refreshTranspiler(); |
35 | loadFunctions_clearCache(); |
36 | print("Refreshed translator.");
|
37 | } |
38 | |
39 | void evalIt enter {
|
40 | if (calculating) ret; |
41 | dm_action_printHere(shorten80(getText(taInput)), r {
|
42 | calculating = true; |
43 | temp afterwards(r { calculating = false });
|
44 | dm_javaEvalModule_doIt(getText(taInput), realEval); |
45 | }, printName := false); |
46 | } |
47 | |
48 | void showJavaTranspilation enter {
|
49 | dm_showText("Java Transpilation", loadProgramTextFile("main.java"));
|
50 | } |
51 | } |
Began life as a copy of #1016755
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, nazvggbglmsf, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1017551 |
| Snippet name: | Multi-Line Java Eval [Evaluate Java Code] |
| Eternal ID of this version: | #1017551/36 |
| Text MD5: | 599bd8cb9fbfc08d5ab62debd531c8ea |
| Transpilation MD5: | 03b91be360fa73fd707e5a2248d7f077 |
| Author: | stefan |
| Category: | javax / stefan's os |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-09-20 23:09:09 |
| Source code size: | 1765 bytes / 51 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1198 / 666121 |
| Version history: | 35 change(s) |
| Referenced in: | [show references] |