From 34f02144042bc788d606e9528b0e97e6d0f74a56 Mon Sep 17 00:00:00 2001 From: ALEXks Date: Wed, 27 Dec 2023 12:57:00 +0300 Subject: [PATCH] fixed and improved SAPFOR and FDVM --- dvm/fdvm/trunk/fdvm/dvm.cpp | 12 +++++- dvm/fdvm/trunk/include/dvm.h | 2 + .../_src/DvmhRegions/DvmhRegionInserter.cpp | 12 +++++- .../_src/LoopAnalyzer/loop_analyzer.cpp | 22 +++++------ .../_src/LoopAnalyzer/loop_analyzer.h | 2 +- sapfor/experts/Sapfor_2017/_src/Sapfor.cpp | 5 ++- sapfor/experts/Sapfor_2017/_src/Sapfor.h | 2 + sapfor/experts/Sapfor_2017/_src/SapforData.h | 2 +- .../_src/Transformations/checkpoints.cpp | 16 ++++---- .../Sapfor_2017/_src/Utils/PassManager.h | 2 +- .../Sapfor_2017/_src/Utils/SgUtils.cpp | 38 +++++++++++++++++++ .../experts/Sapfor_2017/_src/Utils/SgUtils.h | 4 +- .../experts/Sapfor_2017/_src/Utils/utils.cpp | 7 ++-- .../experts/Sapfor_2017/_src/Utils/version.h | 2 +- .../_src/VisualizerCalls/get_information.cpp | 16 ++++++-- 15 files changed, 109 insertions(+), 35 deletions(-) diff --git a/dvm/fdvm/trunk/fdvm/dvm.cpp b/dvm/fdvm/trunk/fdvm/dvm.cpp index c63cd24..debdf1d 100644 --- a/dvm/fdvm/trunk/fdvm/dvm.cpp +++ b/dvm/fdvm/trunk/fdvm/dvm.cpp @@ -12668,6 +12668,7 @@ int DistrArrayAssign(SgStatement *stmt) return(1); left_whole = !le->lhs(); right_whole = !re->lhs(); + CANCEL_RTS2_MODE; // switch to basic RTS interface ChangeDistArrayRef(le->lhs()); //replacing dvm-array references in subscript list ChangeDistArrayRef(re->lhs()); LINE_NUMBER_BEFORE(stmt,stmt); @@ -12709,13 +12710,15 @@ int DistrArrayAssign(SgStatement *stmt) doAssignStmtAfter(ArrayCopy(headr, from_init, from_init+rr, from_init+2*rr, headl, to_init, to_init+rl, to_init+2*rl, 0)); if(dvm_ind) doCallAfter(DeleteObject_H(DVM000(dvm_ind))); - SET_DVM(to_init); + SET_DVM(to_init); + RESUMPTION_RTS2_MODE; // return to RTS2 interface return(1); } // assignment statement of kind: = if(only_debug) return(1); + CANCEL_RTS2_MODE; // switch to basic RTS interface if(INTERFACE_RTS2 && !isWholeArray(stmt->expr(0))) err("Illegal array statement in -Opl2 mode", 642, stmt); @@ -12735,6 +12738,7 @@ int DistrArrayAssign(SgStatement *stmt) else doAssignStmtAfter(ArrayCopy(headr, to_init, to_init, to_init, headl, to_init, to_init+rl, to_init+2*rl, -1)); SET_DVM(to_init); + RESUMPTION_RTS2_MODE; // return to RTS2 interface return(1); } @@ -12753,6 +12757,7 @@ int AssignDistrArray(SgStatement *stmt) // assignment statement of kind: = if(only_debug) return(1); + CANCEL_RTS2_MODE; // switch to basic RTS interface left_whole = !le->lhs(); right_whole = !re->lhs(); @@ -12781,8 +12786,10 @@ int AssignDistrArray(SgStatement *stmt) typer = ar->type()->baseType(); rr = Rank(ar); headr = HeaderRef(ar); - if(!headr) // if there is error of dvm-array specification, header is not created + if(!headr) { // if there is error of dvm-array specification, header is not created + RESUMPTION_RTS2_MODE; // return to RTS2 interface return(0); + } if(!CompareTypes(typel,typer)) err("Different types of left and right side",620,stmt); @@ -12801,6 +12808,7 @@ int AssignDistrArray(SgStatement *stmt) doCallAfter(DeleteObject_H(DVM000(dvm_ind))); SET_DVM(dvm_ind ? dvm_ind : to_init) ; //SET_DVM(to_init); + RESUMPTION_RTS2_MODE; // return to RTS2 interface return(1); } diff --git a/dvm/fdvm/trunk/include/dvm.h b/dvm/fdvm/trunk/include/dvm.h index c25913e..bd4baf8 100644 --- a/dvm/fdvm/trunk/include/dvm.h +++ b/dvm/fdvm/trunk/include/dvm.h @@ -415,6 +415,8 @@ const int Logical_8 = 12; #define FILE_LAST_STATEMENT(ST) ((SgStatement **)(ST)->attributeValue(0,LAST_STATEMENT)) #define CALLED_FUNCTIONS(ST) ((symb_list **)(ST)->attributeValue(0,RTC_CALLS)) #define INTERFACE_RTS2 (parloop_by_handler == 2) +#define CANCEL_RTS2_MODE if(parloop_by_handler == 2) parloop_by_handler = -1 +#define RESUMPTION_RTS2_MODE if(parloop_by_handler == -1) parloop_by_handler = 2 #define HEADER_FOR_HANDLER(A) ( (SgSymbol **)(A)->attributeValue(0,HANDLER_HEADER) ) #define USE_STATEMENTS_ARE_REQUIRED ( (int *) first_do_par->attributeValue(0,MODULE_USE) ) #define DEFERRED_SHAPE_TEMPLATE(A) ( (ORIGINAL_SYMBOL(A))->attributeValue(0,DEFERRED_SHAPE) ) diff --git a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp index 15323b2..23b5aa6 100644 --- a/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp +++ b/sapfor/experts/Sapfor_2017/_src/DvmhRegions/DvmhRegionInserter.cpp @@ -382,7 +382,17 @@ ArraySet DvmhRegionInserter::excludeRemotes(const ArraySet& block, SgStatement* printInternalError(convertFileName(__FILE__).c_str(), __LINE__); SgStatement* next = remoteDir->lexNext(); - const string leftS = next->variant() == ASSIGN_STAT ? OriginalSymbol(next->expr(0)->symbol())->identifier() : ""; + const string leftS = ""; + + //TODO: record ref! + if (next->variant() == ASSIGN_STAT) + { + auto ex = next->expr(0); + if (ex->variant() == ARRAY_REF) + OriginalSymbol(ex->symbol())->identifier(); + else if (ex->variant() == RECORD_REF && ex->rhs()->variant() == ARRAY_REF) + OriginalSymbol(ex->rhs()->symbol())->identifier(); + } set raArrays; diff --git a/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.cpp b/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.cpp index a3df4bf..f618651 100644 --- a/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.cpp +++ b/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.cpp @@ -2666,7 +2666,7 @@ static void findArrayRefs(SgExpression *ex, SgStatement *st, string fName, int p const vector &inRegion, const set &funcParNames, map>& ompThreadPrivate, - const map& keyValueFromGUI, + const map& distrStateFromGUI, const bool saveAllLocals, map>& currMessages, int& errorCount) @@ -2852,8 +2852,8 @@ static void findArrayRefs(SgExpression *ex, SgStatement *st, string fName, int p itNew->second.first->SetDistributeFlag(DIST::SPF_PRIV); else { - auto it = keyValueFromGUI.find(itNew->second.first->GetIndepUniqName()); - if (it != keyValueFromGUI.end()) + auto it = distrStateFromGUI.find(itNew->second.first->GetIndepUniqName()); + if (it != distrStateFromGUI.end()) { if (it->second != oldVal) { @@ -2910,7 +2910,7 @@ static void findArrayRefs(SgExpression *ex, SgStatement *st, string fName, int p //assume all arguments of function as OUT, except for inctrinsics bool isWriteN = intr ? false : true; //need to correct W/R usage with GraphCall map later - findArrayRefs(funcExp->arg(z), st, fName, z, isWriteN, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isExecutable, currFunctionName, inRegion, funcParNames, ompThreadPrivate, keyValueFromGUI, saveAllLocals, currMessages, errorCount); + findArrayRefs(funcExp->arg(z), st, fName, z, isWriteN, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isExecutable, currFunctionName, inRegion, funcParNames, ompThreadPrivate, distrStateFromGUI, saveAllLocals, currMessages, errorCount); } } else @@ -2920,8 +2920,8 @@ static void findArrayRefs(SgExpression *ex, SgStatement *st, string fName, int p queue.push(findInfo("", ex->lhs(), -1, isWriteN)); if (ex->rhs()) queue.push(findInfo("", ex->rhs(), -1, isWriteN)); - //findArrayRefs(ex->lhs(), st, "", -1, isWriteN, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isExecutable, currFunctionName, inRegion, funcParNames, ompThreadPrivate, keyValueFromGUI, saveAllLocals, currMessages, errorCount); - //findArrayRefs(ex->rhs(), st, "", -1, isWriteN, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isExecutable, currFunctionName, inRegion, funcParNames, ompThreadPrivate, keyValueFromGUI, saveAllLocals, currMessages, errorCount); + //findArrayRefs(ex->lhs(), st, "", -1, isWriteN, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isExecutable, currFunctionName, inRegion, funcParNames, ompThreadPrivate, distrStateFromGUI, saveAllLocals, currMessages, errorCount); + //findArrayRefs(ex->rhs(), st, "", -1, isWriteN, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isExecutable, currFunctionName, inRegion, funcParNames, ompThreadPrivate, distrStateFromGUI, saveAllLocals, currMessages, errorCount); } } } @@ -3036,7 +3036,7 @@ static void addPrivates(SgStatement *st, set& privates, map, pair> &declaredArrays, map>> &declaratedArraysSt, map> &currMessages, - const vector ®ions, const map& keyValueFromGUI) + const vector ®ions, const map& distrStateFromGUI) { int countErrors = 0; @@ -3243,7 +3243,7 @@ int getAllDeclaredArrays(SgFile *file, map, pairarg(z), st, fName, z, true, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isSgExecutableStatement(st) ? true : false, currFunctionName, - regNames, funcParNames, ompThreadPrivate, keyValueFromGUI, saveAllLocals, + regNames, funcParNames, ompThreadPrivate, distrStateFromGUI, saveAllLocals, currMessages, countErrors); } } @@ -3253,7 +3253,7 @@ int getAllDeclaredArrays(SgFile *file, map, pairexpr(i), st, "", -1, (st->variant() == ASSIGN_STAT && i == 0) ? true : false, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, isSgExecutableStatement(st) ? true : false, currFunctionName, - regNames, funcParNames, ompThreadPrivate, keyValueFromGUI, saveAllLocals, + regNames, funcParNames, ompThreadPrivate, distrStateFromGUI, saveAllLocals, currMessages, countErrors); } } @@ -3290,7 +3290,7 @@ int getAllDeclaredArrays(SgFile *file, map, pairexpr(i), st, "", -1, false, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, - false, "NULL", regNames, funcParNames, ompThreadPrivate, keyValueFromGUI, false, + false, "NULL", regNames, funcParNames, ompThreadPrivate, distrStateFromGUI, false, currMessages, countErrors); } st = st->lexNext(); @@ -3328,7 +3328,7 @@ int getAllDeclaredArrays(SgFile *file, map, pairexpr(i), curr, "", -1, false, commonBlocks, declaredArrays, declaratedArraysSt, privates, deprecatedByIO, - false, blockName, regNames, funcParNames, ompThreadPrivate, keyValueFromGUI, false, + false, blockName, regNames, funcParNames, ompThreadPrivate, distrStateFromGUI, false, currMessages, countErrors); curr = curr->lexNext(); } diff --git a/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.h b/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.h index 3a17ea7..8fd2db9 100644 --- a/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.h +++ b/sapfor/experts/Sapfor_2017/_src/LoopAnalyzer/loop_analyzer.h @@ -48,7 +48,7 @@ std::string getShortName(const std::tuple &uniqKe int getAllDeclaredArrays(SgFile *file, std::map, std::pair> &declaredArrays, std::map>> &declaratedArraysSt, std::map> &currMessages, - const std::vector ®ions, const std::map& keyValueFromGUI); + const std::vector ®ions, const std::map& distrStateFromGUI); void insertSpfAnalysisBeforeParalleLoops(const std::vector &loops); void recalculateArraySizes(std::set &arraysDone, const std::set &allArrays, const std::map> &arrayLinksByFuncCalls, const std::map>& allFuncInfo); int getSizeOfType(SgType* t); diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp index 125f73b..f64f5e8 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp @@ -943,7 +943,7 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne } else if (curr_regime == GET_ALL_ARRAY_DECL) { - int err = getAllDeclaredArrays(file, declaredArrays, declaratedArraysSt, SPF_messages, subs_parallelRegions, keyValueFromGUI); + int err = getAllDeclaredArrays(file, declaredArrays, declaratedArraysSt, SPF_messages, subs_parallelRegions, distrStateFromGUI); if (err != 0) internalExit = -1; } @@ -1167,6 +1167,8 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne getMaxMinBlockDistribution(file, min_max_block); else if (curr_regime == CONVERT_TO_C) covertToC(file); + else if (curr_regime == INSERT_NO_DISTR_FLAGS_FROM_GUI) + addPrivatesToArraysFromGUI(file, declaredArrays, distrStateFromGUI); else if (curr_regime == TEST_PASS) { //test pass @@ -2485,6 +2487,7 @@ void runPass(const int curr_regime, const char *proj_name, const char *folderNam case PURE_INTENT_INSERT: case REMOVE_OMP_DIRS_TRANSFORM: case REMOVE_COMMENTS: + case INSERT_NO_DISTR_FLAGS_FROM_GUI: runAnalysis(*project, curr_regime, true, "", folderName); break; case PRIVATE_REMOVING: diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.h b/sapfor/experts/Sapfor_2017/_src/Sapfor.h index 0d87ccf..670cd9c 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.h +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.h @@ -172,6 +172,7 @@ enum passes { REMOVE_COMMENTS, GET_MIN_MAX_BLOCK_DIST, CONVERT_TO_C, + INSERT_NO_DISTR_FLAGS_FROM_GUI, TEST_PASS, EMPTY_PASS @@ -349,6 +350,7 @@ static void setPassValues() passNames[REMOVE_COMMENTS] = "REMOVE_COMMENTS"; passNames[GET_MIN_MAX_BLOCK_DIST] = "GET_MIN_MAX_BLOCK_DIST"; passNames[CONVERT_TO_C] = "CONVERT_TO_C"; + passNames[INSERT_NO_DISTR_FLAGS_FROM_GUI] = "INSERT_NO_DISTR_FLAGS_FROM_GUI"; passNames[TEST_PASS] = "TEST_PASS"; } diff --git a/sapfor/experts/Sapfor_2017/_src/SapforData.h b/sapfor/experts/Sapfor_2017/_src/SapforData.h index a94134e..7835946 100644 --- a/sapfor/experts/Sapfor_2017/_src/SapforData.h +++ b/sapfor/experts/Sapfor_2017/_src/SapforData.h @@ -158,7 +158,7 @@ std::pair inOnlyForloopOnPlace; // //cache for declaration arrays state switching -std::map keyValueFromGUI; +std::map distrStateFromGUI; // //for PROCESS_IO diff --git a/sapfor/experts/Sapfor_2017/_src/Transformations/checkpoints.cpp b/sapfor/experts/Sapfor_2017/_src/Transformations/checkpoints.cpp index 9167653..67d96a1 100644 --- a/sapfor/experts/Sapfor_2017/_src/Transformations/checkpoints.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Transformations/checkpoints.cpp @@ -38,7 +38,7 @@ static SgType* createArrayCharType(int len, int dim) } static void findDecls(SgExpression* ex, vector& local, const map& localParams, - set& added, set& IntentInParams) + set& added, set& intentInParams) { if (ex) { @@ -48,7 +48,7 @@ static void findDecls(SgExpression* ex, vector& local, const map< localParams.find(ex->symbol()->identifier()) == localParams.end()) { if (added.find(ex->symbol()->identifier()) == added.end() && - IntentInadded.find(ex->symbol()->identifier()) == IntentInadded.end()) + intentInParams.find(ex->symbol()->identifier()) == intentInParams.end()) { added.insert(ex->symbol()->identifier()); local.push_back(ex); @@ -60,15 +60,15 @@ static void findDecls(SgExpression* ex, vector& local, const map< { if (ex->symbol()->variant() == VARIABLE_NAME && added.find(ex->symbol()->identifier()) == added.end() && - IntentInadded.find(ex->symbol()->identifier()) == IntentInadded.end()) + intentInParams.find(ex->symbol()->identifier()) == intentInParams.end()) { added.insert(ex->symbol()->identifier()); local.push_back(new SgArrayRefExp(*ex->symbol())); } } - findDecls(ex->lhs(), local, localParams, added, IntentInParams); - findDecls(ex->rhs(), local, localParams, added, IntentInParams); + findDecls(ex->lhs(), local, localParams, added, intentInParams); + findDecls(ex->rhs(), local, localParams, added, intentInParams); } } @@ -90,10 +90,10 @@ static void findLocalData(SgStatement* func, SgStatement* end, vectorlexNext(); FuncInfo* funcI = findFileInfoByName(func, allFuncInfo); - set IntentInParams; + set intentInParams; for (int i = 0; i < funcI->funcParams.countOfPars; ++i) if (funcI->funcParams.isArgIn(i) && !funcI->funcParams.isArgOut(i)) - IntentInParams.insert(funcI->funcParams.identificators[i]); + intentInParams.insert(funcI->funcParams.identificators[i]); for (SgStatement* st = start; st != end; st = st->lexNext()) { @@ -114,7 +114,7 @@ static void findLocalData(SgStatement* func, SgStatement* end, vectorlineNumber(), st->fileName(), tag[st->variant()]); if (st->variant() == VAR_DECL || st->variant() == VAR_DECL_90) - findDecls(st->expr(0), local, localParams, added, IntentInParams); + findDecls(st->expr(0), local, localParams, added, intentInParams); } } diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h index 1085084..3e68a6a 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h @@ -216,7 +216,7 @@ void InitPassesDependencies(map> &passDepsIn, set Pass(RESTORE_LOOP_FROM_ASSIGN) <= list({ SUBST_EXPR_AND_UNPARSE, SUBST_EXPR_RD_AND_UNPARSE }); - Pass(GET_ALL_ARRAY_DECL) <= Pass(CALL_GRAPH_IR); + Pass(GET_ALL_ARRAY_DECL) <= list({ CALL_GRAPH_IR, INSERT_NO_DISTR_FLAGS_FROM_GUI }); Pass(LOOP_GRAPH) <= Pass(PRIVATE_CALL_GRAPH_STAGE3) <= list(FIND_FUNC_TO_INCLUDE, PRIVATE_ANALYSIS_IR) <= list({ LOOP_ANALYZER_DATA_DIST_S0, LOOP_ANALYZER_DATA_DIST_S1, ONLY_ARRAY_GRAPH, LOOP_ANALYZER_ALIGNS }); diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp index 432dfd2..6a16906 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.cpp @@ -4396,6 +4396,7 @@ void removeSpecialCommentsFromProject(SgFile* file) } } +//TODO: for gen_block and other variations, and redistributions dirs void getMaxMinBlockDistribution(SgFile* file, pair& min_max) { SgStatement* st = file->firstStatement(); @@ -4445,3 +4446,40 @@ void getMaxMinBlockDistribution(SgFile* file, pair& min_max) st = st->lexNext(); } } + +void addPrivatesToArraysFromGUI(SgFile* file, const map, pair>& declaredArrays, + const map& distrStateFromGUI) +{ + map> added; + + for (auto& arrayPair : declaredArrays) + { + DIST::Array* array = arrayPair.second.first; + string key = array->GetIndepUniqName(); + auto it = distrStateFromGUI.find(key); + if (it == distrStateFromGUI.end()) + continue; + + if (it->second != DIST::NO_DISTR) + continue; + + for (auto& decl : array->GetDeclInfoWithSymb()) + { + auto& place = decl.first; + const auto& symb = decl.second->GetOriginal(); + + if (place.first != file->filename()) + continue; + + SgStatement* declSt = SgStatement::getStatementByFileAndLine(place.first, place.second); + checkNull(declSt, convertFileName(__FILE__).c_str(), __LINE__); + + string toAdd = "!$SPF ANALYSIS(PRIVATE(" + string(symb->identifier()) + "))\n"; + added[declSt].insert(toAdd); + } + } + + for (auto& toInsert : added) + for (auto& elem : toInsert.second) + toInsert.first->addComment(elem.c_str()); +} \ No newline at end of file diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h index 02b12e7..b952a5b 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/SgUtils.h @@ -109,4 +109,6 @@ std::set getAllFilesInProject(); void LogIftoIfThen(SgStatement* stmt); void removeSpecialCommentsFromProject(SgFile* file); -void getMaxMinBlockDistribution(SgFile* file, std::pair& min_max); \ No newline at end of file +void getMaxMinBlockDistribution(SgFile* file, std::pair& min_max); + +void addPrivatesToArraysFromGUI(SgFile* file, const std::map, std::pair>& declaredArrays, const std::map& distrStateFromGUI); \ No newline at end of file diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/utils.cpp b/sapfor/experts/Sapfor_2017/_src/Utils/utils.cpp index 0c6792f..303a273 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/utils.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Utils/utils.cpp @@ -1404,7 +1404,6 @@ pair, vector> splitCommandLineForParse(char** argv, int a for (int z = 0; z < argc; ++z) { string arg = argv[z]; - string ext = OnlyExt(arg.c_str()); convertToLower(ext); if (arg.find("*") != string::npos || checkFormat(ext, "")) @@ -1423,11 +1422,11 @@ pair, vector> splitCommandLineForParse(char** argv, int a { auto cmp_ext = file.extension().string(); convertToLower(cmp_ext); + if (cmp_ext.size() && cmp_ext[0] == '.') + cmp_ext.erase(cmp_ext.begin()); - if (checkFormat(cmp_ext, arg)) + if (checkFormat(cmp_ext, ext)) files.insert(file.filename().string()); - else - printf(" skip file %s\n", arg.c_str()); } #endif } diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index 741a709..5d8326d 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2258" +#define VERSION_SPF "2262" diff --git a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp index 15575dd..826c2cf 100644 --- a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp +++ b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp @@ -1560,7 +1560,7 @@ int SPF_GetFileLineInfo(void*& context, int winHandler, short *options, short *p return retSize; } -extern map keyValueFromGUI; +extern map distrStateFromGUI; int SPF_SetDistributionFlagToArray(void*& context, char *key, int flag) { MessageManager::clearCache(); @@ -1589,7 +1589,7 @@ int SPF_SetDistributionFlagToArray(void*& context, char *key, int flag) } } else - keyValueFromGUI[keyStr] = flag; + distrStateFromGUI[keyStr] = flag; } catch (...) { @@ -1654,7 +1654,7 @@ int SPF_SetDistributionFlagToArrays(void*& context, const char* keys, const char int flagI = -1; if (sscanf(flagsS[z].c_str(), "%d", &flagI) == -1) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); - keyValueFromGUI[keysS[z]] = flagI; + distrStateFromGUI[keysS[z]] = flagI; } } } @@ -1887,6 +1887,14 @@ int SPF_SharedMemoryParallelization(void*& context, int winHandler, short* optio return simpleTransformPass(INSERT_PARALLEL_DIRS_NODIST, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize); } +int SPF_InsertPrivateFromGUI(void*& context, int winHandler, short* options, short* projName, short* folderName, short*& output, + int*& outputSize, short*& outputMessage, int*& outputMessageSize) +{ + MessageManager::clearCache(); + MessageManager::setWinHandler(winHandler); + return simpleTransformPass(INSERT_NO_DISTR_FLAGS_FROM_GUI, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize); +} + static inline void convertBackSlash(char *str, int strL) { for (int z = 0; z < strL; ++z) @@ -2597,6 +2605,8 @@ const wstring Sapfor_RunTransformation(const char* transformName_c, const char* retCode = SPF_ResolveCommonBlockConflicts(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize); else if (whichRun == "SPF_SharedMemoryParallelization") retCode = SPF_SharedMemoryParallelization(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize); + else if (whichRun == "SPF_InsertPrivateFromGUI") + retCode = SPF_InsertPrivateFromGUI(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize); else { if (showDebug)