added json for call graph positions, removed SPF_GetGraphVizOfFunctions
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION_SPF "2405"
|
#define VERSION_SPF "2406"
|
||||||
|
|||||||
@@ -642,11 +642,19 @@ int SPF_GetGraphFunctionPositions(void*& context, int winHandler, short *options
|
|||||||
|
|
||||||
auto positions = buildLocationOfGraph(allFuncInfo, iters, coef, 0.9 * w, 0.9 * h, sendVisible ? &visible : NULL);
|
auto positions = buildLocationOfGraph(allFuncInfo, iters, coef, 0.9 * w, 0.9 * h, sendVisible ? &visible : NULL);
|
||||||
|
|
||||||
string resVal = "";
|
json pos_array= json::array();
|
||||||
resVal = to_string(positions.size());
|
for (auto& [fname, coords] : positions) {
|
||||||
for (auto& elem : positions)
|
json elem;
|
||||||
resVal += "|" + elem.first + "|" + to_string(elem.second.first) + "|" + to_string(elem.second.second);
|
elem["functionName"] = fname;
|
||||||
|
elem["x"] = (double)coords.first;
|
||||||
|
elem["y"] = (double)coords.second;
|
||||||
|
pos_array.push_back(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
json allPositions;
|
||||||
|
allPositions["allPositions"] = pos_array;
|
||||||
|
|
||||||
|
string resVal = allPositions.dump();
|
||||||
copyStringToShort(result, resVal);
|
copyStringToShort(result, resVal);
|
||||||
retSize = (int)resVal.size() + 1;
|
retSize = (int)resVal.size() + 1;
|
||||||
}
|
}
|
||||||
@@ -672,61 +680,6 @@ int SPF_GetGraphFunctionPositions(void*& context, int winHandler, short *options
|
|||||||
return retSize;
|
return retSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SPF_GetGraphVizOfFunctions(void*& context, short *options, short *projName, short *&result, short *&output, int *&outputSize,
|
|
||||||
short *&outputMessage, int *&outputMessageSize)
|
|
||||||
{
|
|
||||||
MessageManager::clearCache();
|
|
||||||
clearGlobalMessagesBuffer();
|
|
||||||
setOptions(options);
|
|
||||||
|
|
||||||
int retSize = -1;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
runPassesForVisualizer(projName, { FILL_PAR_REGIONS_LINES });
|
|
||||||
|
|
||||||
map<string, CallV> V;
|
|
||||||
vector<string> E;
|
|
||||||
CreateCallGraphViz(NULL, allFuncInfo, V, E);
|
|
||||||
|
|
||||||
string graph = to_string(V.size()) += "|";
|
|
||||||
for (auto &v : V)
|
|
||||||
graph += v.second.to_string() + "|";
|
|
||||||
|
|
||||||
graph += to_string(E.size()) + "|";
|
|
||||||
for (auto &e : E)
|
|
||||||
graph += e + "|";
|
|
||||||
//erase last "|"
|
|
||||||
graph.erase(graph.end() - 1);
|
|
||||||
|
|
||||||
copyStringToShort(result, graph);
|
|
||||||
retSize = (int)graph.size();
|
|
||||||
|
|
||||||
if (showDebug)
|
|
||||||
printf("GraphViz: '%s'\n", graph.c_str());
|
|
||||||
}
|
|
||||||
catch (int ex)
|
|
||||||
{
|
|
||||||
try { __spf_print(1, "catch code %d\n", ex); }
|
|
||||||
catch (...) {}
|
|
||||||
if (ex == -99)
|
|
||||||
return -99;
|
|
||||||
else
|
|
||||||
retSize = -1;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
retSize = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//convertBuffers(outputMessage, outputMessageSize, output, outputSize);
|
|
||||||
|
|
||||||
if (showDebug)
|
|
||||||
printf("SAPFOR: return from DLL\n");
|
|
||||||
|
|
||||||
MessageManager::setWinHandler(-1);
|
|
||||||
return retSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int PASSES_DONE[EMPTY_PASS];
|
extern int PASSES_DONE[EMPTY_PASS];
|
||||||
extern int *ALGORITHMS_DONE[EMPTY_ALGO];
|
extern int *ALGORITHMS_DONE[EMPTY_ALGO];
|
||||||
extern const char *passNames[EMPTY_PASS + 1];
|
extern const char *passNames[EMPTY_PASS + 1];
|
||||||
@@ -2463,8 +2416,6 @@ const wstring Sapfor_RunAnalysis(const char* analysisName_c, const char* options
|
|||||||
retCode = SPF_GetGraphFunctions(context, winHandler, optSh, projSh, result, output, outputSize, outputMessage, outputMessageSize);
|
retCode = SPF_GetGraphFunctions(context, winHandler, optSh, projSh, result, output, outputSize, outputMessage, outputMessageSize);
|
||||||
else if (whichRun == "SPF_GetGraphFunctionPositions")
|
else if (whichRun == "SPF_GetGraphFunctionPositions")
|
||||||
retCode = SPF_GetGraphFunctionPositions(context, winHandler, optSh, projSh, result, output, outputSize, outputMessage, outputMessageSize);
|
retCode = SPF_GetGraphFunctionPositions(context, winHandler, optSh, projSh, result, output, outputSize, outputMessage, outputMessageSize);
|
||||||
else if (whichRun == "SPF_GetGraphVizOfFunctions")
|
|
||||||
retCode = SPF_GetGraphVizOfFunctions(context, optSh, projSh, result, output, outputSize, outputMessage, outputMessageSize);
|
|
||||||
else if (whichRun == "SPF_GetArrayDistribution")
|
else if (whichRun == "SPF_GetArrayDistribution")
|
||||||
retCode = SPF_GetArrayDistribution(context, winHandler, optSh, projSh, result, output, outputSize, outputMessage, outputMessageSize, 0);
|
retCode = SPF_GetArrayDistribution(context, winHandler, optSh, projSh, result, output, outputSize, outputMessage, outputMessageSize, 0);
|
||||||
else if (whichRun == "SPF_GetArrayDistributionOnlyAnalysis")
|
else if (whichRun == "SPF_GetArrayDistributionOnlyAnalysis")
|
||||||
|
|||||||
Reference in New Issue
Block a user