added json to SPF_GetArrayLinks

This commit is contained in:
ALEXks
2025-05-18 20:15:50 +03:00
committed by Egor Mayorov
parent b59dcfffe1
commit 7ab4e7555a
2 changed files with 13 additions and 8 deletions

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION_SPF "2420" #define VERSION_SPF "2421"

View File

@@ -1158,8 +1158,6 @@ int SPF_GetArrayLinks(void*& context, int winHandler, short *options, short *pro
{ {
runPassesForVisualizer(projName, { CALL_GRAPH2 } ); runPassesForVisualizer(projName, { CALL_GRAPH2 } );
string resVal = "";
map<DIST::Array*, set<DIST::Array*>> linkedArrays; map<DIST::Array*, set<DIST::Array*>> linkedArrays;
for (auto& inMap : arrayLinksByFuncCalls) for (auto& inMap : arrayLinksByFuncCalls)
{ {
@@ -1173,17 +1171,24 @@ int SPF_GetArrayLinks(void*& context, int winHandler, short *options, short *pro
linkedArrays[ref].insert(toAdd); linkedArrays[ref].insert(toAdd);
} }
json links;
json allLinks = json::array();
for (auto& array : linkedArrays) for (auto& array : linkedArrays)
{ {
resVal += to_string(array.first->GetId()) + "|" + to_string(array.second.size()) + "|"; json currLink;
currLink["id"] = array.first->GetId();
json links = json::array();
for (auto& link : array.second) for (auto& link : array.second)
resVal += to_string(link->GetId()) + "|"; links.push_back(link->GetId());
currLink["links"] = links;
allLinks.push_back(currLink);
} }
links["allLinks"] = allLinks;
if (resVal[resVal.size() - 1] == '|') string resVal = allLinks.dump();
resVal.erase(resVal.size() - 1);
copyStringToShort(result, resVal); copyStringToShort(result, resVal);
retSize = (int)resVal.size() + 1; retSize = (int)resVal.size() + 1;
} }