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

42
LINES

< > BotCompany Repo | #1034498 // RunTranspiler

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

Libraryless. Click here for Pure Java version (10027L/56K).

1  
sclass RunTranspiler {
2  
  settable S transpilerID = #759;
3  
  O transpiler;
4  
  settable S sourceInput;
5  
  S sourceOutput;
6  
  settable S mainSnippetID;
7  
  settable int coresToUse = numberOfCores();
8  
  
9  
  // transpilation options
10  
  bool asFragment, asInclude;
11  
  
12  
  event preparingTranspiler(O transpiler);
13  
  
14  
  void loadTranspiler() {
15  
    transpiler = hotwire(transpilerID);
16  
  }
17  
  
18  
  void prepareTranspiler {
19  
    setOpt(transpiler, localStuffOnly := asFragment);
20  
    setOpt(transpiler, +asInclude);
21  
    sourceInput = dropTranslators(sourceInput);
22  
    set(transpiler, mainJava := sourceInput);
23  
    set(transpiler, +print_byThread());
24  
    setOpt(transpiler, +mainSnippetID);
25  
    setOpt(transpiler, numberOfCores_value := coresToUse);
26  
    
27  
    preparingTranspiler(transpiler);
28  
  }
29  
  
30  
  void runTranspiler {
31  
    callMain(transpiler);
32  
    sourceOutput = (S) _get(transpiler, "mainJava");
33  
  }
34  
  
35  
  S get(S sourceInput) {
36  
    if (transpiler == null) loadTranspiler();
37  
    sourceInput(sourceInput);
38  
    prepareTranspiler();
39  
    runTranspiler();
40  
    ret sourceOutput;
41  
  }
42  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034498
Snippet name: RunTranspiler
Eternal ID of this version: #1034498/10
Text MD5: 571eb24c50218f0c2525d45e4b6aabd6
Transpilation MD5: 9419db9b16b578c9002e82a539c359c4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-11 00:48:55
Source code size: 1095 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 197 / 366
Version history: 9 change(s)
Referenced in: [show references]