Changeset 967
- Timestamp:
- Mar 2, 2014, 4:41:56 PM (11 years ago)
- Location:
- XmlTools2/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
XmlTools2/trunk/optionsparser.cpp
r955 r967 97 97 98 98 if(line.startsWith('"')){ // Only read when starting with quotes 99 temp=line.split( " \""); // We need to use more than space, because if paths contains spaces...100 patchFiles << temp[0] .remove('"'); // remove the quotes, they are now not needed101 targetXmlFiles << temp[ 1].remove('"');99 temp=line.split('"',QString::SkipEmptyParts); // We need to use more than space, because if paths contains spaces... 100 patchFiles << temp[0]; 101 targetXmlFiles << temp[2]; // space is in idx 1 102 102 } 103 103 } … … 106 106 107 107 // Now let's process each patch file and target file 108 //#pragma omp parallel for109 108 for(int i=0; i<patchFiles.size(); i++){ 110 109 XmlPatch myXmlPatch(patchFiles[i],targetXmlFiles[i],true,true); // use --no-backups and --no-verbose for AEI -
XmlTools2/trunk/readme.txt
r961 r967 62 62 Change Log: 63 63 ---------------------------------- 64 2.0a, 20-02-201464 2.0a, 02-03-2014 65 65 -Added multithreading support for @CUSTOM_COMMAND, use wildcards in multiple files for the same js code to 66 take advantage of this (performance may increase over 2.5 times)66 take advantage of this (performance may increase over 3 times for a quadcore) 67 67 -Now a warning is given if a user javascript code (@CUSTOM_COMMAND) takes too much time to finish 68 68 -Fixed small bug when applying patches with @COMMAND + --no-verbose where some std output should not be displayed -
XmlTools2/trunk/util.h
r964 r967 52 52 } 53 53 54 // Needs optimization54 //TODO Needs optimization 55 55 inline QStringList QStringToArgsArray(const QString &args){ 56 56 QStringList result; -
XmlTools2/trunk/xmlcustomcode.cpp
r964 r967 37 37 // alternatively you can do: myFunc=engine.evaluate('(function main(){})'); myFunc.call(); 38 38 // Note the () around the function 39 this->getXmlDataFunctions.append(new QScriptValue(this->scriptEngines [i]->evaluate("(function getXmlData() { return $xmlData; })")));40 this->setXmlDataFunctions.append(new QScriptValue(this->scriptEngines [i]->evaluate("(function setXmlData(newXmlData) { $xmlData=newXmlData; })")));39 this->getXmlDataFunctions.append(new QScriptValue(this->scriptEngines.at(i)->evaluate("(function getXmlData() { return $xmlData; })"))); 40 this->setXmlDataFunctions.append(new QScriptValue(this->scriptEngines.at(i)->evaluate("(function setXmlData(newXmlData) { $xmlData=newXmlData; })"))); 41 41 42 42 // Add echo function so user can debug the code 43 QScriptValue echoFunction = this->scriptEngines [i]->newFunction(echo);44 this->scriptEngines [i]->globalObject().setProperty("echo", echoFunction);43 QScriptValue echoFunction = this->scriptEngines.at(i)->newFunction(echo); 44 this->scriptEngines.at(i)->globalObject().setProperty("echo", echoFunction); 45 45 46 46 // Add the js library for XmlEditing 47 this->scriptEngines [i]->evaluate(jsxmlString);47 this->scriptEngines.at(i)->evaluate(jsxmlString); 48 48 } 49 49 } … … 54 54 // Reconstruct script functions 55 55 for(int i=0; i<this->numThreads; i++){ 56 *this->jsFunctions[i]=this->scriptEngines [i]->evaluate("(function main() {"+jsString+"})");56 *this->jsFunctions[i]=this->scriptEngines.at(i)->evaluate("(function main() {"+jsString+"})"); 57 57 } 58 58 … … 63 63 clock_t begin; // seconds that a script started 64 64 65 // Single tread if small files65 // Single tread if small number of files 66 66 if(filesToProcess.size()<CUSTOM_FILES_PER_THREAD){ 67 67 // Process all XmlFiles 68 68 for(int i=0; i<filesToProcess.size(); i++){ 69 69 70 customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines [0],begin,elapsed_secs,engineResult,71 *this->jsFunctions [0],*this->getXmlDataFunctions[0],*this->setXmlDataFunctions[0],backupsEnabled,verboseEnabled);70 customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines.at(0),begin,elapsed_secs,engineResult, 71 *this->jsFunctions.at(0),*this->getXmlDataFunctions.at(0),*this->setXmlDataFunctions.at(0),backupsEnabled,verboseEnabled); 72 72 } 73 73 } … … 85 85 clock_t beginThread; // seconds that a script started 86 86 87 customCodeUnwinding(filesToProcess.at(i),currXmlFileStringThread,*this->scriptEngines [tid],beginThread,elapsedSecsThread,engineResultThread,88 *this->jsFunctions [tid],*this->getXmlDataFunctions[tid],*this->setXmlDataFunctions[tid],backupsEnabled,verboseEnabled);87 customCodeUnwinding(filesToProcess.at(i),currXmlFileStringThread,*this->scriptEngines.at(tid),beginThread,elapsedSecsThread,engineResultThread, 88 *this->jsFunctions.at(tid),*this->getXmlDataFunctions.at(tid),*this->setXmlDataFunctions.at(tid),backupsEnabled,verboseEnabled); 89 89 90 customCodeUnwinding(filesToProcess.at(i+1),currXmlFileStringThread,*this->scriptEngines [tid],beginThread,elapsedSecsThread,engineResultThread,91 *this->jsFunctions [tid],*this->getXmlDataFunctions[tid],*this->setXmlDataFunctions[tid],backupsEnabled,verboseEnabled);90 customCodeUnwinding(filesToProcess.at(i+1),currXmlFileStringThread,*this->scriptEngines.at(tid),beginThread,elapsedSecsThread,engineResultThread, 91 *this->jsFunctions.at(tid),*this->getXmlDataFunctions.at(tid),*this->setXmlDataFunctions.at(tid),backupsEnabled,verboseEnabled); 92 92 } 93 93 … … 98 98 for(int i=alreadyProcessedFiles; i<filesToProcess.size(); i++){ 99 99 100 customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines [0],begin,elapsed_secs,engineResult,101 *this->jsFunctions [0],*this->getXmlDataFunctions[0],*this->setXmlDataFunctions[0],backupsEnabled,verboseEnabled);100 customCodeUnwinding(filesToProcess.at(i),currXmlFileString,*this->scriptEngines.at(0),begin,elapsed_secs,engineResult, 101 *this->jsFunctions.at(0),*this->getXmlDataFunctions.at(0),*this->setXmlDataFunctions.at(0),backupsEnabled,verboseEnabled); 102 102 } 103 103 } -
XmlTools2/trunk/xmlpatch.cpp
r964 r967 230 230 QString line, patchVersion=""; 231 231 232 // First get the patch version and check it validity232 // First get the patch version and check its validity 233 233 while ( !fileStream.atEnd() ){ 234 234 line = fileStream.readLine();
Note:
See TracChangeset
for help on using the changeset viewer.