промежуточный. перенос настроек в проект. есть баги. завтра доделываю, версия не вполне рабочая

This commit is contained in:
2025-01-16 02:26:51 +03:00
parent 483089e954
commit 0f7b65f467
92 changed files with 511 additions and 648 deletions

View File

@@ -415,7 +415,9 @@ public class DBProjectFile extends ProjectFile {
break;
}
languageName = parent.languageName;
if (sapforStyle) style = Global.mainModule.getSapfor().getStyle();
if (sapforStyle) style = father.sapforProperties.FREE_FORM? LanguageStyle.free : LanguageStyle.fixed;
// Global.mainModule.getSapfor().getStyle();
else style = parent.style;
}
public void importSourceCodeSettings(DBProjectFile parent, boolean sapforStyle) throws Exception {
@@ -429,7 +431,8 @@ public class DBProjectFile extends ProjectFile {
break;
}
languageName = parent.languageName;
if (sapforStyle) style = Global.mainModule.getSapfor().getStyle();
// if (sapforStyle) style = Global.mainModule.getSapfor().getStyle();
if (sapforStyle) style = father.sapforProperties.FREE_FORM? LanguageStyle.free : LanguageStyle.fixed;
else style = parent.style;
}
//------------------

View File

@@ -2,7 +2,6 @@ package _VisualDVM.ProjectData.Files.UI.Editor;
import Common.Utils.Utils_;
import Common.Visual.Menus.StyledPopupMenu;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.Files.DBProjectFile;
import _VisualDVM.ProjectData.Files.FileState;
@@ -169,7 +168,7 @@ public class SPFEditor extends BaseEditor implements SPFEditorInterface {
Pair<Long, Integer> p = file.gcov_info.line_info.get(lineNum);
Color color = never;
if (p.getKey() > 0) {
color = (p.getValue() >= (Global.mainModule.getDb()).settings.get(SettingName.GCOVLimit).toInt32()) ?
color = (p.getValue() >= Global.mainModule.getProject().sapforProperties.GCOVLimit) ?
new Color(255, 255, (100 - p.getValue()), 90) : null;
}
if (color != null) {

View File

@@ -3,7 +3,6 @@ import Common.Passes.PassException;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Mode;
import _VisualDVM.ProjectData.SapforData.FileObject;
@@ -27,7 +26,7 @@ public class Message extends FileObject {
(Global.mode != Mode.Normal)) {
value = value_in;
} else {
value = !(Global.mainModule.getDb()).settings.get(SettingName.TRANSLATE_MESSAGES).toBoolean() ? value_in : decodeRussianMessage(value_in);
value = !Global.mainModule.getProject().sapforProperties.TRANSLATE_MESSAGES ? value_in : decodeRussianMessage(value_in);
}
}
// last code - 183

View File

@@ -1,7 +1,6 @@
package _VisualDVM.ProjectData.Messages.Recommendations;
import Common.Database.Objects.iDBObject;
import Common.Utils.Utils_;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Passes.PassCode;
import com.sun.org.glassfish.gmbal.Description;
public class MessageRecommendation extends iDBObject {
@@ -21,16 +20,16 @@ public class MessageRecommendation extends iDBObject {
argName = passCode_in.toString();
text = "Выполните преобразование " + Utils_.Quotes(passCode_in.getDescription());
}
public MessageRecommendation(SettingName settingName_in, String settingValue_in) {
public MessageRecommendation(String settingDescription_in, String settingValue_in) {
type = RecommendationType.Setting;
argName = settingName_in.toString();
argName = settingDescription_in.toString();
argValue = settingValue_in;
if (argValue.equals("1"))
text = "Включите настройку SAPFOR " + Utils_.Quotes(settingName_in.getDescription());
text = "Включите настройку SAPFOR " + Utils_.Quotes(settingDescription_in);
else if (argValue.equals("0"))
text = "Отключите настройку SAPFOR " + Utils_.Quotes(settingName_in.getDescription());
text = "Отключите настройку SAPFOR " + Utils_.Quotes(settingDescription_in);
else
text = "Задайте значение " + Utils_.DQuotes(argValue) + " для настройки SAPFOR " + Utils_.Quotes(settingName_in.getDescription());
text = "Задайте значение " + Utils_.DQuotes(argValue) + " для настройки SAPFOR " + Utils_.Quotes(settingDescription_in);
}
public MessageRecommendation(String text_in) {
type = RecommendationType.Text;

View File

@@ -1,7 +1,6 @@
package _VisualDVM.ProjectData.Messages.Recommendations;
import Common.Database.Tables.iDBTable;
import Common.Visual.DataSetControlForm;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.Messages.Recommendations.UI.RecommendationsForm;
@@ -32,7 +31,7 @@ public class RecommendationsDBTable extends iDBTable<MessageRecommendation> {
result = new MessageRecommendation(PassCode.SPF_LoopEndDoConverterPass);
break;
case 1020:
result = new MessageRecommendation(SettingName.KEEP_DVM_DIRECTIVES, "1");
result = new MessageRecommendation("Учитывать DVM директивы", "1");
break;
case 1027:
case 1060:

View File

@@ -1,10 +0,0 @@
package _VisualDVM.ProjectData.Project;
import Common.Passes.Pass;
import _VisualDVM.GlobalData.Settings.DBSetting;
public class ChangeSettingPass extends Pass<DBSetting> {
@Override
protected boolean canStart(Object... args) throws Exception {
target = (DBSetting) args[0];
return true;
}
}

View File

@@ -11,7 +11,6 @@ import _VisualDVM.Constants;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.DBLastProject.DBLastProject;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.DBArray.DBArray;
import _VisualDVM.ProjectData.Files.DBProjectFile;
@@ -33,6 +32,7 @@ import _VisualDVM.ProjectData.SapforData.Functions.UI.Graph.GraphInfo;
import _VisualDVM.ProjectData.SapforData.Includes.FileInfo;
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegion;
import _VisualDVM.ProjectData.SapforData.Regions.ParallelRegionsSet;
import _VisualDVM.ProjectData.SapforData.SapforProperties;
import _VisualDVM.ProjectData.SapforData.Variants.ParallelVariant;
import _VisualDVM.ProjectData.SapforData.Variants.ParallelVariantsSet;
import _VisualDVM.TestingSystem.Common.Test.ProjectFiles_json;
@@ -145,23 +145,14 @@ public class db_project_info extends DBObject {
public ProjectDatabase db = null;
public LinkedHashMap<String, DBProjectFile> allIncludes = new LinkedHashMap<>();
DBLastProject info = null; //обновляется при открытии проекта.
public SapforProperties sapforProperties=null;
public void SynchronizeSapforProperties() {
System.out.println("Syncronize Sapfor Properties...");
sapforProperties = Utils_.SynschronizeProperties(new File(getDataDirectory(), "properties"), SapforProperties.class);
}
public db_project_info() {
}
//----------------------------------
// в случае восстановления после полной очистки
//восстановление при полной очистке.
public db_project_info(db_project_info to_restore) throws Exception {
Home = to_restore.Home;
name = to_restore.name;
description = to_restore.description;
original = to_restore.original;
fgIterations = to_restore.fgIterations;
fgResistance = to_restore.fgResistance;
fgScreen = to_restore.fgScreen;
creationDate = to_restore.creationDate;
//-
CreateVisualiserData();
}
//конструктор для пустой версии (cо структурой папок)
public db_project_info(db_project_info parent_in,
String letter_in,
@@ -170,7 +161,10 @@ public class db_project_info extends DBObject {
parent = parent_in;
name = parent.GenerateVersionName(letter_in);
languageName = parent.languageName;
style = ((Global.mainModule.getDb()).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed);
// style = ((Global.mainModule.getDb()).settings.get(SettingName.FREE_FORM).toBoolean() ? LanguageStyle.free : LanguageStyle.fixed);
style = (parent_in.sapforProperties.FREE_FORM ? LanguageStyle.free : LanguageStyle.fixed);
description = description_in;
original = original_in;
Home = Paths.get(parent_in.Home.getAbsolutePath(), name).toFile();
@@ -181,18 +175,11 @@ public class db_project_info extends DBObject {
parent.AddVersion(this);
//если это делать раньше, папка версии учтется как подпапка.
parent.CopySubdirectories(Home);
//-- наследование настроек от предка.
this.sapforProperties=new SapforProperties(parent.sapforProperties);
SynchronizeSapforProperties();
}
//------------------------------
//если бд не существует. только для конверсии тестов на корректность.
public db_project_info(File Directory, String description_, boolean create_data) throws Exception {
Home = Directory;
name = Home.getName();
description = description_;
if (create_data) {
creationDate = Utils_.getDateNumber(); //----------------------------------------------------------------------------->>>
CreateVisualiserData();
}
}
//обычное открытие.
public db_project_info(File dir) throws Exception {
Home = dir;
@@ -206,7 +193,7 @@ public class db_project_info extends DBObject {
if (stored_info == null) {
name = Home.getName();
description = "";
creationDate = Utils_.getDateNumber(); //----------------------------------------------------------------------------->>>
creationDate = Utils_.getDateNumber();
db.Insert(this);
} else
ExtractStoredInfo(stored_info);
@@ -243,6 +230,7 @@ public class db_project_info extends DBObject {
db.Connect();
db.prepareTablesStatements();
db.Synchronize();
SynchronizeSapforProperties();
}
public void Close() throws Exception {
db.Disconnect();
@@ -257,11 +245,8 @@ public class db_project_info extends DBObject {
db.prepareTablesStatements();
db.Insert(this);
db.Disconnect();
//--
}
/*
public boolean isGCOVDone() {
return gcov_is_done != 0;
}*/
//------------------------------------
public void UpdatefgIterations(int iterations_in) {
fgIterations = iterations_in;
@@ -916,14 +901,14 @@ public class db_project_info extends DBObject {
}
}
public void createEmptyVersion(String versionLetter, String versionDescription) throws Exception {
boolean needsM = (Global.mainModule.getDb()).settings.get(SettingName.SaveModifications).toBoolean();
if (needsM)
//boolean needsM = (Global.mainModule.getDb()).settings.get(SettingName.SaveModifications).toBoolean();
if (sapforProperties.SaveModifications)
createModification();
last_version = new db_project_info(
this,
versionLetter,
versionDescription,
needsM ? last_modification.name : ""
sapforProperties.SaveModifications ? last_modification.name : ""
);
}
public void joinExistingVersion(File versionDirectory, String description_in) throws Exception {
@@ -936,6 +921,9 @@ public class db_project_info extends DBObject {
last_version.Home = versionDirectory;
last_version.creationDate = Utils_.getDateNumber(); //----------------------------------------------------------------------------->>>
last_version.CreateVisualiserData();
//наследование от предка
last_version.sapforProperties =new SapforProperties(last_version.parent.sapforProperties);
last_version.SynchronizeSapforProperties();
this.AddVersion(last_version);
}
//не является ли текущая версия последней модификацией
@@ -1120,10 +1108,6 @@ public class db_project_info extends DBObject {
to_restore.name = name;
to_restore.description = description;
to_restore.original = original;
// to_restore.fgIterations = fgIterations;
// to_restore.fgResistance = fgResistance;
// to_restore.fgScreen = fgScreen;
//-
CheckVisualiserDirectories();
db.Connect();
db.CreateAllTables();

View File

@@ -7,7 +7,6 @@ import Common.Visual.Tables.DBObjectSelectionRenderer;
import Common.Visual.Tables.DBObjectSelector;
import Common.Visual.Tables.RendererHiddenList;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.Settings.SettingName;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.SapforData.Arrays.ProjectArray;
import _VisualDVM.Visual.Tables.EditorFilesHyperlinks;

View File

@@ -1,27 +1,164 @@
package _VisualDVM.ProjectData.SapforData;
public class SapforProperties {
import Common.Properties;
import Common.Utils.Vector_;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import com.google.gson.annotations.Expose;
import javax.swing.*;
import java.io.File;
import java.util.Vector;
public class SapforProperties extends Properties {
//побочные настройки визулизатора
public boolean Precompilation=true;
public boolean SaveModifications=true; // сохранять исходную версию
public int GCOVLimit=10;
public String DVMConvertationOptions=" ";
@Expose
public boolean Precompilation = true;
@Expose
public boolean SaveModifications = true; // сохранять исходную версию
@Expose
public int GCOVLimit = 10;
@Expose
public String DVMConvertationOptions = " ";
//настройки для компонента SAPFOR
public int STATIC_SHADOW_ANALYSIS=0;
public int STATIC_PRIVATE_ANALYSIS=1;
public int FREE_FORM=0;
public int KEEP_DVM_DIRECTIVES=0;
public int KEEP_SPF_DIRECTIVES=0;
public int PARALLELIZE_FREE_LOOPS=0;
public int MAX_SHADOW_WIDTH=50;
public int OUTPUT_UPPER=0;
public int TRANSLATE_MESSAGES=1;
public int KEEP_LOOPS_CLOSE_NESTING=0;
public int KEEP_GCOV=0;
public int ANALYSIS_OPTIONS=0;
public int DEBUG_PRINT_ON=0;
public int MPI_PROGRAM=0;
public int IGNORE_IO_SAPFOR=0;
public int KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS=0;
public int PARSE_FOR_INLINE=0;
public int EMPTY_OPTION=0;
@Expose
public boolean STATIC_SHADOW_ANALYSIS = false;
@Expose
public boolean STATIC_PRIVATE_ANALYSIS = true;
@Expose
public boolean FREE_FORM = false;
@Expose
public boolean KEEP_DVM_DIRECTIVES = false;
@Expose
public boolean KEEP_SPF_DIRECTIVES = false;
@Expose
public boolean PARALLELIZE_FREE_LOOPS = false;
@Expose
public int MAX_SHADOW_WIDTH = 50;
@Expose
public boolean OUTPUT_UPPER = false;
@Expose
public boolean TRANSLATE_MESSAGES = true;
@Expose
public boolean KEEP_LOOPS_CLOSE_NESTING = false;
@Expose
public boolean KEEP_GCOV = false;
@Expose
public String ANALYSIS_OPTIONS = " ";
@Expose
public boolean DEBUG_PRINT_ON = false;
@Expose
public boolean MPI_PROGRAM = false;
@Expose
public boolean IGNORE_IO_SAPFOR = false;
@Expose
public boolean KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS = false;
@Expose
public boolean PARSE_FOR_INLINE = false;
public String pack() {
Vector<String> res = new Vector_<String>(
STATIC_SHADOW_ANALYSIS ? "1" : "0",
STATIC_PRIVATE_ANALYSIS ? "1" : "0",
FREE_FORM ? "1" : "0",
KEEP_DVM_DIRECTIVES ? "1" : "0",
KEEP_SPF_DIRECTIVES ? "1" : "0",
PARALLELIZE_FREE_LOOPS ? "1" : "0",
String.valueOf(MAX_SHADOW_WIDTH),
OUTPUT_UPPER ? "1" : "0",
TRANSLATE_MESSAGES ? "1" : "0",
KEEP_LOOPS_CLOSE_NESTING ? "1" : "0",
KEEP_GCOV ? "1" : "0",
ANALYSIS_OPTIONS,
DEBUG_PRINT_ON ? "1" : "0",
MPI_PROGRAM ? "1" : "0",
IGNORE_IO_SAPFOR ? "1" : "0",
KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS ? "1" : "0",
PARSE_FOR_INLINE ? "1" : "0"
);
return String.join("|", res);
}
//-
public SapforProperties(File file_in) {
super(file_in);
}
public SapforProperties() {
}
public SapforProperties(SapforProperties src) {
this.Precompilation = src.Precompilation;
this.SaveModifications = src.SaveModifications; // сохранять исходную версию
this.GCOVLimit = src.GCOVLimit;
this.DVMConvertationOptions = src.DVMConvertationOptions;
//настройки для компонента SAPFOR
this.STATIC_SHADOW_ANALYSIS = src.STATIC_SHADOW_ANALYSIS;
this.STATIC_PRIVATE_ANALYSIS = src.STATIC_PRIVATE_ANALYSIS;
this.FREE_FORM = src.FREE_FORM;
this.KEEP_DVM_DIRECTIVES = src.KEEP_DVM_DIRECTIVES;
this.KEEP_SPF_DIRECTIVES = src.KEEP_SPF_DIRECTIVES;
this.PARALLELIZE_FREE_LOOPS = src.PARALLELIZE_FREE_LOOPS;
this.MAX_SHADOW_WIDTH = src.MAX_SHADOW_WIDTH;
this.OUTPUT_UPPER = src.OUTPUT_UPPER;
this.TRANSLATE_MESSAGES = src.TRANSLATE_MESSAGES;
this.KEEP_LOOPS_CLOSE_NESTING = src.KEEP_LOOPS_CLOSE_NESTING;
this.KEEP_GCOV = src.KEEP_GCOV;
this.ANALYSIS_OPTIONS = src.ANALYSIS_OPTIONS;
this.DEBUG_PRINT_ON = src.DEBUG_PRINT_ON;
this.MPI_PROGRAM = src.MPI_PROGRAM;
this.IGNORE_IO_SAPFOR = src.IGNORE_IO_SAPFOR;
this.KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS = src.KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS;
this.PARSE_FOR_INLINE = src.PARSE_FOR_INLINE;
}
//-
@Override
public String getFieldDescription(String fieldName) {
switch (fieldName) {
case "SaveModifications":
return "Сохранять копию исходной версии при преобразованиях";
case "DVMConvertationOptions":
return "Опции DVM конвертации";
case "GCOVLimit":
return "Нижний порог отображения GCOV";
case "Precompilation":
return "Предварительная компиляция";
//------------------------------------------>>
case "STATIC_SHADOW_ANALYSIS":
return "Оптимизация теневых обменов";
case "STATIC_PRIVATE_ANALYSIS":
return "Статический анализ приватностей";
case "FREE_FORM":
return "Свободный выходной стиль";
case "KEEP_DVM_DIRECTIVES":
return "Учитывать DVM директивы";
case "KEEP_SPF_DIRECTIVES":
return "Сохранять SPF директивы при построении параллельных вариантов";
case "PARALLELIZE_FREE_LOOPS":
return "Улучшенное распараллеливание";
case "MAX_SHADOW_WIDTH":
return "Максимальный размер теневых граней";
case "OUTPUT_UPPER":
return "Верхний выходной регистр";
case "TRANSLATE_MESSAGES":
return "Сообщения на русском языке";
case "KEEP_LOOPS_CLOSE_NESTING":
return "Учитывать тесную вложенность циклов";
case "KEEP_GCOV":
return "Учитывать GCOV";
case "ANALYSIS_OPTIONS":
return "Опции анализа";
case "DEBUG_PRINT_ON":
return "Включить отладочную печать";
case "MPI_PROGRAM":
return "Общая память";
case "IGNORE_IO_SAPFOR":
return "Игнорировать ввод/вывод";
case "KEEP_SPF_DIRECTIVES_AMONG_TRANSFORMATIONS":
return "Сохранять SPF директивы при преобразованиях";
case "PARSE_FOR_INLINE":
return "Синтаксический анализ для подстановки";
//------------------------------------------------------
}
return "";
}
//--
@Override
public boolean controlAction(String fieldName, JMenuItem control) {
return (Global.mainModule.getPass(PassCode.UpdateSapforProperty).Do(fieldName));
}
}