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).

svoid dm_javaEvalModule_doIt(S s) {
  dm_javaEvalModule_doIt(s, true);
}

svoid dm_javaEvalModule_doIt(S s, bool realEval) {
  vm_cleanPrints();
  DynModule dm = dm_current_mandatory();
  //set transpileRaw_verySilent;
  //printWithIndent("[CODE] ", s);
  print("==== EVALUATING...");
  logQuotedWithDate("expressions.txt", s);
  dm.setField(expression := s);
  try {
    S toEvaluate = s; // "time(func { " + s + "})";
    //O value = javaEval_dependent(toEvaluate);
    long time = sysNow();
    evalJava_myProgramID_main_time.set(null);
    vmBus_send('javaEval_starting, toEvaluate, realEval);
    
    temp tempSetTL(veryQuickJava_onJavaSource, src
      -> saveProgramTextFile("main.java", src));

    O value = realEval ? dm_javaEval(toEvaluate) : dm_javaEvalOrInterpret(toEvaluate);
    
    vmBus_send('javaEval_OK, toEvaluate, value);
    //dm.setField(value := null); // to prevent eq() call on data in next line
    dm.setFields(+value, error := null);
    print();
    new LS info;
    info.add(or(evalJava_myProgramID_main_time!, elapsedMS(time)) + " ms");
    addAll(info, quickValueInformation_list(value));
    print("[" + joinWithComma(info) + "]");
    S string = str(value);
    pcall { logStructureWithDate("with-results.txt", ll(s, string)); }
    S shortened = shorten(1000, string);
    print(shortened);
    
    dm_handleEvalResult(value, shortened);
  } catch e {
    dm.setFields(value := null, error := e);
    printStackTrace2(e);
    vmBus_send('javaEval_error, s, e);
  }
}

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: 398 / 580
Version history: 26 change(s)
Referenced in: [show references]