отображение инклудов

This commit is contained in:
2025-04-16 14:16:38 +03:00
parent a0c45a2df0
commit 611194be8c
5 changed files with 29 additions and 61 deletions

View File

@@ -55,7 +55,7 @@ public class CombineFiles extends Transformation {
Vector<String> all_includes = new Vector<>();
//-----------------------------
result_lines.add("!-Found " + target.allIncludes.size() + " headers");
for (String name : target.allIncludes.keySet()) {
for (String name : target.allIncludes) {
all_includes.add(" include " + Utils_.Quotes(Utils_.toU(name)));
result_lines.add("! include " + Utils_.Quotes(Utils_.toU(name)));
}

View File

@@ -35,66 +35,36 @@ public class SPF_GetIncludeDependencies extends SapforAnalysis {
}
@Override
public void unpack(String packed) throws Exception {
/*
IncludesJson includesJson = Utils_.gson.fromJson(packed, IncludesJson.class);
System.out.println("packed="+packed);
for (FileIncludesJson fileIncludesJson : includesJson.allIncludes) {
String file_name = Utils_.toW(fileIncludesJson.file);
DBProjectFile dbProjectFile = target.db.files.get(file_name);
for (Include include : fileIncludesJson.includes)
dbProjectFile.dependencies.add(include.dependencyFileName);
}
*/
//--
update_current = false;
FileInfo fileInfo = null;
String[] data_ = packed.split("@");
for (int i = 0; i < data_.length; ++i) {
String s = Utils_.toW(data_[i]);
if (i % 2 == 0) {
if (target.db.files.Data.containsKey(s)) {
fileInfo = new FileInfo(s);
} else fileInfo = null;
} else {
if ((fileInfo != null) && (s != "")) {
String[] data__ = s.split("\\|");
for (int j = 0; j < data__.length; ++j) {
if (data__[j].length() > 0) {
fileInfo.dependencies.add(
new Include(fileInfo.file, data__[j]));
//-------------------------------------
if (!target.addictedFiles.containsKey(fileInfo.file))
target.addictedFiles.put(fileInfo.file, fileInfo);
//-------------------------------------
String include_name = data__[j];
if (target.db.files.containsKey(include_name)) {
DBProjectFile d_file = target.db.files.Data.get(include_name);
//----------------->>
if (!target.allIncludes.containsKey(d_file.name))
target.allIncludes.put(d_file.name, d_file);
//----------------->>
//--
DBProjectFile father = target.db.files.Data.get(fileInfo.file);
if (!father.dependencies.contains(include_name))
father.dependencies.add(include_name);
//--
d_file.UpdateType(FileType.header);
if (d_file.languageName == LanguageName.n)
d_file.UpdateLanguage(father.languageName);
if (d_file.style == LanguageStyle.none)
d_file.UpdateStyle(father.style);
//----------------------------------------
if (Global.mainModule.HasFile() && Global.mainModule.getFile().name.equals(d_file.name))
update_current = true;
//-----------------------------------------
}
}
}
for (FileIncludesJson fileIncludesJson : includesJson.allIncludes) {
fileIncludesJson.file = Utils_.toW(fileIncludesJson.file);
FileInfo fileInfo = new FileInfo(fileIncludesJson.file);
//---
DBProjectFile file = target.db.files.get(fileIncludesJson.file);
for (Include include : fileIncludesJson.includes) {
fileInfo.dependencies.add(include);
if (!target.allIncludes.contains(include.file))
target.allIncludes.add(include.file);
//- определение типов языков инклудов по файлу куда они цепляютс.
if (!file.dependencies.contains(include.dependencyFileName)) {
file.dependencies.add(include.dependencyFileName);
//---
DBProjectFile include_file = target.db.files.get(include.dependencyFileName);
include_file.UpdateType(FileType.header);
if (include_file.languageName == LanguageName.n)
include_file.UpdateLanguage(file.languageName);
if (include_file.style == LanguageStyle.none)
include_file.UpdateStyle(file.style);
if (Global.mainModule.HasFile() && Global.mainModule.getFile().name.equals(include_file.name))
update_current = true;
}
fileInfo = null;
}
//----
if (!target.addictedFiles.containsKey(fileInfo.file))
target.addictedFiles.put(fileInfo.file, fileInfo);
}
//-теперь строим граф
//-теперь строим граф. todo отображать его аналогично графу процедур?
for (FileInfo file : target.addictedFiles.values()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(
file);

View File

@@ -145,7 +145,7 @@ public class db_project_info extends DBObject {
public File Home = null;
public DefaultMutableTreeNode filesTreeRoot = null;
public ProjectDatabase db = null;
public LinkedHashMap<String, DBProjectFile> allIncludes = new LinkedHashMap<>();
public Vector<String> allIncludes = new Vector<>();
public SapforProperties sapforProperties = null;
DBLastProject info = null; //обновляется при открытии проекта.
public db_project_info() {