Перевод объявлений массивов в json

This commit is contained in:
2025-05-07 20:29:58 +03:00
parent 62a45fd8be
commit 571e2d2544
6 changed files with 49 additions and 2 deletions

5
.idea/workspace.xml generated
View File

@@ -7,9 +7,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ArraysJson.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ArrayDecl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ArrayDecl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetAllDeclaratedArrays.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetAllDeclaratedArrays.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ProjectArray.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Arrays/ProjectArray.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/FileObject.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/FileObject.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -41,7 +41,7 @@
"FortranWrapsOn": false,
"ExtensionsOn": false,
"ComparsionDiffMergeOn": true,
"ShowFullArraysDeclarations": false,
"ShowFullArraysDeclarations": true,
"ShowFullTabsNames": true,
"SmallScreen": false,
"BugReportsAgeLimit": 1,

View File

@@ -1,10 +1,13 @@
package _VisualDVM.Passes.All;
import Common.Utils.Index;
import Common.Utils.Utils_;
import _VisualDVM.Global;
import _VisualDVM.Passes.Sapfor.SapforAnalysis;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.SapforData.Arrays.ArraysJson;
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
import javax.rmi.CORBA.Util;
import java.math.BigInteger;
public class SPF_GetAllDeclaratedArrays extends SapforAnalysis {
@Override
@@ -26,6 +29,18 @@ public class SPF_GetAllDeclaratedArrays extends SapforAnalysis {
}
@Override
public void unpack(String packed) throws Exception {
System.out.println("packed="+ Utils_.Brackets(packed));
ArraysJson arraysJson = Utils_.gson.fromJson(packed, ArraysJson.class);
System.out.println("size="+arraysJson.allArrays.size());
for (ProjectArray array: arraysJson.allArrays){
array.Init();
target.declaratedArrays.put(array.id, array);
array.print();
}
for (DBProjectFile file : target.db.files.Data.values())
file.ArrayGraphTitle = "Объявлений: " + file.array_decls.size();
target.UpdateArraysCount();
/*
if (packed.toCharArray()[packed.length() - 1] == '\0')
packed = packed.substring(packed.length() - 1);
if (packed.length() == 0)
@@ -42,6 +57,7 @@ public class SPF_GetAllDeclaratedArrays extends SapforAnalysis {
for (DBProjectFile file : target.db.files.Data.values())
file.ArrayGraphTitle = "Объявлений: " + file.array_decls.size();
target.UpdateArraysCount();
*/
}
@Override
protected boolean alwaysCheck() {

View File

@@ -5,6 +5,8 @@ import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
import com.google.gson.annotations.Expose;
// это то что отображается в боковом графе файла. не путать с сапфоровским ProjectArray
public class ArrayDecl extends FileObjectWithMessages {
@Expose
public String file = "";
@Expose
public String array_name;
@Expose

View File

@@ -0,0 +1,9 @@
package _VisualDVM.ProjectData.SapforData.Arrays;
import com.google.gson.annotations.Expose;
import java.util.List;
import java.util.Vector;
public class ArraysJson {
@Expose
public List<ProjectArray> allArrays=new Vector<>();
}

View File

@@ -58,6 +58,22 @@ public class ProjectArray extends DBObject {
//json-------------------
public String UniqKey;
public BigInteger address;
public void print(){
Vector<String> res = new Vector<>();
res.add(">");
res.add("id="+id);
res.add("name="+name);
res.add("shortName="+shortName);
res.add("dimSize="+dimSize);
res.add("typeSize="+typeSize);
res.add("state="+state);
res.add("location="+location);
res.add("locName="+locName);
res.add("isTempFlag="+isTemplFlag);
res.add("isLoopArrayFlag="+isLoopArrayFlag);
res.add("<");
System.out.println(String.join("\n",res));
}
//--
public ArrayState getState() {
@@ -144,6 +160,7 @@ public class ProjectArray extends DBObject {
public void Init(){
//короткое имя+ функция/модуль/комон+ размерность
UniqKey = shortName + locName + dimSize;
address = BigInteger.ONE;
}
public static String fill_binary(int d, String binary) {
int delta = Math.abs(binary.length() - d);