Перевод объявлений массивов в json
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<>();
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user