Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

44
LINES

< > BotCompany Repo | #1017550 // dm_javaEvalModule_doIt

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (22482L/147K).

1  
svoid dm_javaEvalModule_doIt(S s) {
2  
  dm_javaEvalModule_doIt(s, true);
3  
}
4  
5  
svoid dm_javaEvalModule_doIt(S s, bool realEval) {
6  
  vm_cleanPrints();
7  
  DynModule dm = dm_current_mandatory();
8  
  //set transpileRaw_verySilent;
9  
  //printWithIndent("[CODE] ", s);
10  
  print("==== EVALUATING...");
11  
  logQuotedWithDate("expressions.txt", s);
12  
  dm.setField(expression := s);
13  
  try {
14  
    S toEvaluate = s; // "time(func { " + s + "})";
15  
    //O value = javaEval_dependent(toEvaluate);
16  
    long time = sysNow();
17  
    evalJava_myProgramID_main_time.set(null);
18  
    vmBus_send('javaEval_starting, toEvaluate, realEval);
19  
    
20  
    temp tempSetTL(veryQuickJava_onJavaSource, src
21  
      -> saveProgramTextFile("main.java", src));
22  
23  
    O value = realEval ? dm_javaEval(toEvaluate) : dm_javaEvalOrInterpret(toEvaluate);
24  
    
25  
    vmBus_send('javaEval_OK, toEvaluate, value);
26  
    //dm.setField(value := null); // to prevent eq() call on data in next line
27  
    dm.setFields(+value, error := null);
28  
    print();
29  
    new LS info;
30  
    info.add(or(evalJava_myProgramID_main_time!, elapsedMS(time)) + " ms");
31  
    addAll(info, quickValueInformation_list(value));
32  
    print("[" + joinWithComma(info) + "]");
33  
    S string = str(value);
34  
    pcall { logStructureWithDate("with-results.txt", ll(s, string)); }
35  
    S shortened = shorten(1000, string);
36  
    print(shortened);
37  
    
38  
    dm_handleEvalResult(value, shortened);
39  
  } catch e {
40  
    dm.setFields(value := null, error := e);
41  
    printStackTrace2(e);
42  
    vmBus_send('javaEval_error, s, e);
43  
  }
44  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1017550
Snippet name: dm_javaEvalModule_doIt
Eternal ID of this version: #1017550/27
Text MD5: f59718188d30d198e849cfb8e09aa542
Transpilation MD5: 5d71480a841767a9f6d5602b7d4b3080
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-14 16:45:01
Source code size: 1548 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 402 / 586
Version history: 26 change(s)
Referenced in: [show references]