небольшие правки с инклудами
This commit is contained in:
7
.idea/workspace.xml
generated
7
.idea/workspace.xml
generated
@@ -8,9 +8,12 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CombineFiles.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/CombineFiles.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetIncludeDependencies.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_GetIncludeDependencies.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_InsertIncludesPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Passes/All/SPF_InsertIncludesPass.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/Include.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/SapforData/Includes/Include.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Files/DBProjectFile.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/ProjectData/Files/DBProjectFile.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Utils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainEditorMenu.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Visual/Menus/MainEditorMenu.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"ServerUserPassword": "mprit_2011",
|
||||
"OfferRegistrationOnStart": true,
|
||||
"Workspace": "E:\\Tests",
|
||||
"ProjectsSearchDirectory": "E:\\SAPFOR\\Tests\\BT_inserted",
|
||||
"ProjectsSearchDirectory": "E:\\Tests\\Downloads\\bug_1643809587",
|
||||
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
|
||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||
|
||||
@@ -75,10 +75,9 @@ public class CombineFiles extends Transformation {
|
||||
for (String line : file_lines) {
|
||||
String header = Utils.extractHeaderName(line);
|
||||
if (header != null) {
|
||||
if (file.relativeHeaders.containsKey(header))
|
||||
if (file.dependencies.contains(header))
|
||||
result_lines.add(" include " + Utils_.Quotes(
|
||||
Utils_.toU(
|
||||
file.relativeHeaders.get(header).name)));
|
||||
Utils_.toU(header)));
|
||||
} else
|
||||
result_lines.add(line);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import _VisualDVM.ProjectData.Files.LanguageStyle;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import _VisualDVM.ProjectData.SapforData.Includes.FileInfo;
|
||||
import _VisualDVM.ProjectData.SapforData.Includes.Include;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.ProjectData.SapforData.Includes.Json.FileIncludesJson;
|
||||
import _VisualDVM.ProjectData.SapforData.Includes.Json.IncludesJson;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
public class SPF_GetIncludeDependencies extends SapforAnalysis {
|
||||
@@ -30,12 +31,21 @@ public class SPF_GetIncludeDependencies extends SapforAnalysis {
|
||||
target.includes_root.removeAllChildren();
|
||||
target.allIncludes.clear();
|
||||
for (DBProjectFile file : target.db.files.Data.values())
|
||||
file.relativeHeaders.clear();
|
||||
file.dependencies.clear();
|
||||
}
|
||||
@Override
|
||||
public void unpack(String packed) throws Exception {
|
||||
// IncludesJson includesJson = Utils_.gson.fromJson(packed, IncludesJson.class);
|
||||
// System.out.println("packed="+packed);
|
||||
/*
|
||||
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("@");
|
||||
@@ -56,16 +66,18 @@ public class SPF_GetIncludeDependencies extends SapforAnalysis {
|
||||
if (!target.addictedFiles.containsKey(fileInfo.file))
|
||||
target.addictedFiles.put(fileInfo.file, fileInfo);
|
||||
//-------------------------------------
|
||||
String file_name = data__[j];
|
||||
if (target.db.files.containsKey(file_name)) {
|
||||
DBProjectFile d_file = target.db.files.Data.get(file_name);
|
||||
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);
|
||||
father.relativeHeaders.put(Utils.getRelativeName(father.file.getParentFile(), d_file.file), d_file);
|
||||
// if (d_file.fileType == FileType.none)
|
||||
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);
|
||||
|
||||
@@ -14,6 +14,7 @@ import _VisualDVM.ProjectData.SapforData.FileObjectWithMessages;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.FuncCall;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.FuncInfo;
|
||||
import _VisualDVM.ProjectData.SapforData.Functions.FunctionType;
|
||||
import _VisualDVM.ProjectData.SapforData.Includes.Include;
|
||||
import _VisualDVM.ProjectData.SapforData.Loops.Loop;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.Visual.Windows.FileForm;
|
||||
@@ -63,7 +64,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
public LinkedHashMap<Integer, Loop> AllLoops = new LinkedHashMap<>();
|
||||
public LinkedHashMap<String, FuncInfo> function_decls = new LinkedHashMap<>(); //объявления
|
||||
public Vector<ArrayDecl> array_decls = new Vector<>();
|
||||
public LinkedHashMap<String, DBProjectFile> relativeHeaders = new LinkedHashMap<>();
|
||||
public Vector<String> dependencies = new Vector<>();
|
||||
public GCOV_info gcov_info = new GCOV_info();
|
||||
private PrintStream Sys;
|
||||
public DBProjectFile() {
|
||||
@@ -228,7 +229,7 @@ public class DBProjectFile extends ProjectFile {
|
||||
AllLoops.clear();
|
||||
CallGraphTitle = Constants.no_data;
|
||||
function_decls.clear();
|
||||
relativeHeaders.clear();
|
||||
dependencies.clear();
|
||||
ArrayGraphTitle = Constants.no_data;
|
||||
array_decls.clear();
|
||||
gcov_info.clear();
|
||||
|
||||
@@ -286,12 +286,19 @@ public class Utils {
|
||||
}
|
||||
//</editor-fold>
|
||||
public static String extractHeaderName(String line) {
|
||||
String res =null;
|
||||
String tline = line.trim().toLowerCase();
|
||||
if (tline.startsWith("include")) {
|
||||
String[] data = tline.split("'");
|
||||
return data.length > 1 ? data[1] : null;
|
||||
res = data.length > 1 ? Utils_.toW(data[1]) : null;
|
||||
if (res!=null){
|
||||
if (res.startsWith("\\")){
|
||||
res= res.substring(1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
System.out.println(res);
|
||||
return res;
|
||||
}
|
||||
public static String getRelativeName(File dir, File file) {
|
||||
return
|
||||
|
||||
@@ -280,11 +280,11 @@ public class MainEditorMenu extends TextEditorMenu {
|
||||
m_gotoHeader.setText("Невозможно перейти к заголовочному файлу. Выполните проход \"Поиск зависимостей по включению\"");
|
||||
return;
|
||||
}
|
||||
if (!Global.mainModule.getFile().relativeHeaders.containsKey(header_)) {
|
||||
if (!Global.mainModule.getFile().dependencies.contains(header_)) {
|
||||
m_gotoHeader.setText("Невозможно перейти к заголовочному файлу " + Utils_.Brackets(header_) + " . Файл не найден среди включений текущего файла.");
|
||||
return;
|
||||
}
|
||||
header = Global.mainModule.getFile().relativeHeaders.get(header_);
|
||||
header = Global.mainModule.getProject().db.files.get(header_);
|
||||
m_gotoHeader.setText("Переход к заголовочному файлу " + Utils_.Brackets(header_));
|
||||
m_gotoHeader.setEnabled(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user