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

75
LINES

< > BotCompany Repo | #1031745 // transpileRaw7 - transpile with #7 instead of #759

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

Libraryless. Compilation Failed (9850L/65K).

sbool #silent = true;
sbool #useDiskCache;

/*ifdef DynModule
sS transpileRaw7(S mainJava) {
  ret (S) call(dm_transpiler(), 'transpileRaw7, mainJava, false, #useDiskCache);
}
endifdef*/

ifndef DynModule
static Class #trans;
sbool #mine = true;
static bool #verySilent;
static Lock #lock = lock();

static new ThreadLocal<Bool> #asInclude;

static S transpileRaw7(S mainJava) {
  ret transpileRaw7(mainJava, false, #useDiskCache);
}

static S transpileRaw7(S mainJava, bool fragment) {
  ret transpileRaw7(mainJava, fragment, #useDiskCache);
}

static S transpileRaw7(S mainJava, bool fragment, bool useDiskCache) {
  mainJava = dropTranslators(mainJava);
  lock #lock;
  
  File cacheFile = null;
  if (useDiskCache) {
    cacheFile = new File(javaxCodeDir(), "Transpilations/" + uniqueFileNameUsingMD5_80_v2(mainJava) + ".java");
    try answer loadTextFile(cacheFile);
  }
  
  temp #verySilent ? null : tempLoadingAnim("Transpiling...");
  
  #translator();
 
  //setOpt(#trans, dontPrintSource := true);
  setOpt(#trans, localStuffOnly := fragment);
  setOpt(#trans, asInclude := isTrue(#asInclude!));
  set(#trans, +mainJava);
  // TODO: setOpt(#trans, transpilingSnippetID := );
  set(#trans, +print_byThread);
  if (!#verySilent)
    print("Running translator " + getOpt(#trans, 'programID));
  callMain(#trans);
  //print("Ran translator " + identityHashCode(#trans));
  S main = cast get(#trans, "mainJava");
  if (useDiskCache) {
    saveTextFile(new File(cacheFile.getPath() + "x"), mainJava);
    saveTextFile(cacheFile, main);
  }
  ret main;
}

static Class #translator() {
  if (#trans == null) {
    //print("Loading translator.");
    #trans = hotwireSharingLibraries_silently(#7);
    #mine = true;
    makeDependent(#trans);
    //print("Loaded translator: " + identityHashCode(#trans));
  }
  setOpt(#trans, "print_silent", #silent);
  ret #trans;
}

svoid cleanMeUp_transpileRaw7 {
  if (#mine)
    cleanUp(#trans);
  #trans = null; // release proactively (it's big)
}
endifndef

Author comment

Began life as a copy of #1003847

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031745
Snippet name: transpileRaw7 - transpile with #7 instead of #759
Eternal ID of this version: #1031745/1
Text MD5: b7487ec3dc9d0ffd766047dbd04eb086
Transpilation MD5: b7054858e4f730ff97e38dcbbc2995c8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-29 03:53:38
Source code size: 2075 bytes / 75 lines
Pitched / IR pitched: No / No
Views / Downloads: 85 / 139
Referenced in: [show references]