Transpiled version (5925L) is out of date.
scope readLocally. static void readLocally(S progID, S varNames) { readLocally2(mc(), progID, varNames); } static void readLocally(S varNames) { readLocally2(mc(), programID(), varNames); } static void readLocally2(O obj, S varNames) { readLocally2(obj, programID(), varNames); } static int readLocally_stringLength; static new ThreadLocal<Bool> readLocally2_allDynamic; static new ThreadLocal readLocally2_classFinder; sbool #useTwoThreads = true; // read a string variable from standard storage // does not overwrite variable contents if there is no file static void readLocally2(O obj, S progID, S varNames) ctex { bool allDynamic = isTrue(getAndClearThreadLocal(readLocally2_allDynamic)); for (S variableName : javaTokC(varNames)) { File textFile = new File(programDir(progID), variableName + ".text"); S value = loadTextFile(textFile); if (value != null) set(main.class, variableName, value); else { File structureFile = new File(programDir(progID), variableName + ".structure"); value = loadTextFile(structureFile); if (value == null) { File structureGZFile = new File(programDir(progID), variableName + ".structure.gz"); if (!structureGZFile.isFile()) ret; temp new CloseablesHolder ch; Producer<S> tokenizer = gzFileTokenReaderForUnstruct(structureGZFile, ch); if (useTwoThreads) { tokenizer = moveProducerToNewThread(tokenizer, ch); ifdef readLocally_debug tokenizer = debugProducer(tokenizer); endifdef } O o = unstructure_tok(tokenizer, allDynamic, readLocally2_classFinder!); readLocally_set(obj, variableName, o); ret; } readLocally_stringLength = l(value); if (nempty(value)) readLocally_set(obj, variableName, unstructure(value, allDynamic, readLocally2_classFinder!)); } } } static void readLocally_set(O c, S varName, O value) { O oldValue = get(c, varName); if (oldValue instanceof List && !(oldValue instanceof ArrayList) && value != null) { // Assume it's a synchroList. value = synchroList((L) value); } set(c, varName, value); } end scope
Began life as a copy of #1001043
download show line numbers debug dex old transpilations
Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031008 |
Snippet name: | readLocally / readLocally2 with 2-threaded loading |
Eternal ID of this version: | #1031008/2 |
Text MD5: | c59f49cf64d2b2a3d999e1d4f8c2d90a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-19 17:58:47 |
Source code size: | 2267 bytes / 68 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 151 / 1002 |
Version history: | 1 change(s) |
Referenced in: | [show references] |