no message

This commit is contained in:
2025-03-13 00:32:20 +03:00
parent 91e40c4393
commit 1d97048de1
204 changed files with 984 additions and 889 deletions

View File

@@ -25,7 +25,7 @@ public class ComponentPublicationInfoJson implements Serializable {
public boolean needsEmail = false;
@Expose
public boolean needsSendFile = false;
public ComponentPublicationInfoJson(Component component) throws Exception{
public ComponentPublicationInfoJson(Component component) throws Exception {
componentType = component.getComponentType();
fileName = component.getFileName();
packedFile = Utils_.fileToBytes(component.getFile());

View File

@@ -10,7 +10,7 @@ public class ComponentVersionsInfoJson implements Serializable {
public String minimal_version = "";
@Expose
public String actual_version = "";
public ComponentVersionsInfoJson(ComponentType componentType_in){
componentType=componentType_in;
public ComponentVersionsInfoJson(ComponentType componentType_in) {
componentType = componentType_in;
}
}

View File

@@ -301,6 +301,112 @@ public abstract class Sapfor extends OSDComponent {
}
return res;
}
//--
public static int getFileMaxDim_C(File file) {
int fileMax = 0;
final String prefix = "#pragma dvm array distribute";
int n = 0;
try {
for (String line : FileUtils.readLines(file, Charset.defaultCharset())) {
// #pragma dvm array distribute[block][block], не важно
String packedLine = Utils_.removeCharacters(Utils_.removeRedundantSpaces(line).toLowerCase(), "\n", "\r", "\t");
if (packedLine.startsWith(prefix)) {
packedLine = packedLine.substring(prefix.length());
boolean bracketOpen = false;
int pragmaMax = 0;
String distr = "";
for (int i = packedLine.indexOf('['); i < packedLine.length(); ++i) {
char c = packedLine.charAt(i);
if (bracketOpen) {
if (c == ']') {
bracketOpen = false;
if (distr.equals("block"))
pragmaMax++;
distr = "";
} else {
distr += c;
}
} else {
if (c == '[') {
bracketOpen = true;
} else {
break;
}
}
}
fileMax = Math.max(fileMax, pragmaMax);
}
++n;
}
} catch (Exception ex) {
ex.printStackTrace();
}
return fileMax;
}
public static int getProjectMinMaxDim_C(db_project_info project) {
int res = 0;
for (DBProjectFile file : project.db.files.Data.values()) {
if (file.isActiveProgram())
res = Math.max(res, Sapfor.getFileMaxDim_C(file.file));
}
return res;
}
public static Pair<Integer, Integer> getProjectFolderMinMaxDim_F(File sapfor_drv, File projectPath) {
String flags = "-noLogo";
Pair<Integer, Integer> res = new Pair<>(0, 0);
try {
if (Sapfor.parse(sapfor_drv, projectPath, flags)
) {
Vector<String> outputLines = new Vector<>();
if (Sapfor.analysis(sapfor_drv, projectPath, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
//---
for (String line : outputLines) {
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
if (line.startsWith(prefix)) {
String s = line.substring(prefix.length());
String[] data = s.split(" ");
res = new Pair<>(Math.max(Integer.parseInt(data[0]), 0), Math.max(Integer.parseInt(data[1]), 0));
break;
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
Utils.deleteFilesByExtensions(projectPath,
"proj", "dep", "jar"
);
File visualiser_data = new File(projectPath, Constants.data);
if (visualiser_data.exists())
FileUtils.forceDelete(visualiser_data);
} catch (Exception ex) {
ex.printStackTrace();
}
}
return res;
}
public static void getTestMinMaxDim_F(File sapfor_drv, Test test) {
Pair<Integer, Integer> res = getProjectFolderMinMaxDim_F(sapfor_drv, test.getServerPath());
test.min_dim = res.getKey();
test.max_dim = res.getValue();
}
public static void getTestMinMaxDime_C(Test test) {
File workspace = test.getServerPath();
Vector<File> files = new Vector<>();
TestFilesJson filesJson = Utils_.gson.fromJson(test.packedFilesJson, TestFilesJson.class);
for (TestFileJson fileJson : filesJson.values) {
files.add(new File(workspace, fileJson.name));
}
int min_dim = 0;
int max_dim = 0;
for (File file : files) {
max_dim = Math.max(max_dim, getFileMaxDim_C(file));
}
test.min_dim = min_dim;
test.max_dim = max_dim;
}
public void refreshPid() {
try {
// UI.Info("Calling SPF_GetCurrentPID...");
@@ -542,110 +648,4 @@ public abstract class Sapfor extends OSDComponent {
Global.mainModule.getUI().getVersionsWindow().BlockVariants();
}
//--
public static int getFileMaxDim_C(File file) {
int fileMax = 0;
final String prefix = "#pragma dvm array distribute";
int n = 0;
try {
for (String line : FileUtils.readLines(file, Charset.defaultCharset())) {
// #pragma dvm array distribute[block][block], не важно
String packedLine = Utils_.removeCharacters(Utils_.removeRedundantSpaces(line).toLowerCase(), "\n", "\r", "\t");
if (packedLine.startsWith(prefix)) {
packedLine = packedLine.substring(prefix.length());
boolean bracketOpen = false;
int pragmaMax = 0;
String distr = "";
for (int i = packedLine.indexOf('['); i < packedLine.length(); ++i) {
char c = packedLine.charAt(i);
if (bracketOpen) {
if (c == ']') {
bracketOpen = false;
if (distr.equals("block"))
pragmaMax++;
distr = "";
} else {
distr += c;
}
} else {
if (c == '[') {
bracketOpen = true;
} else {
break;
}
}
}
fileMax = Math.max(fileMax, pragmaMax);
}
++n;
}
} catch (Exception ex) {
ex.printStackTrace();
}
return fileMax;
}
public static int getProjectMinMaxDim_C(db_project_info project) {
int res = 0;
for (DBProjectFile file : project.db.files.Data.values()) {
if (file.isActiveProgram())
res = Math.max(res, Sapfor.getFileMaxDim_C(file.file));
}
return res;
}
public static Pair<Integer, Integer> getProjectFolderMinMaxDim_F(File sapfor_drv, File projectPath) {
String flags = "-noLogo";
Pair<Integer, Integer> res = new Pair<>(0, 0);
try {
if (Sapfor.parse(sapfor_drv, projectPath, flags)
) {
Vector<String> outputLines = new Vector<>();
if (Sapfor.analysis(sapfor_drv, projectPath, PassCode.SPF_GetMaxMinBlockDistribution, flags, outputLines)) {
//---
for (String line : outputLines) {
String prefix = "GET_MIN_MAX_BLOCK_DIST: ";
if (line.startsWith(prefix)) {
String s = line.substring(prefix.length());
String[] data = s.split(" ");
res = new Pair<>(Math.max(Integer.parseInt(data[0]), 0), Math.max(Integer.parseInt(data[1]), 0));
break;
}
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
Utils.deleteFilesByExtensions(projectPath,
"proj", "dep", "jar"
);
File visualiser_data = new File(projectPath, Constants.data);
if (visualiser_data.exists())
FileUtils.forceDelete(visualiser_data);
} catch (Exception ex) {
ex.printStackTrace();
}
}
return res;
}
public static void getTestMinMaxDim_F(File sapfor_drv, Test test) {
Pair<Integer, Integer> res = getProjectFolderMinMaxDim_F(sapfor_drv, test.getServerPath());
test.min_dim = res.getKey();
test.max_dim = res.getValue();
}
public static void getTestMinMaxDime_C(Test test) {
File workspace = test.getServerPath();
Vector<File> files = new Vector<>();
TestFilesJson filesJson = Utils_.gson.fromJson(test.packedFilesJson,TestFilesJson.class);
for (TestFileJson fileJson : filesJson.values) {
files.add(new File(workspace, fileJson.name));
}
int min_dim = 0;
int max_dim = 0;
for (File file: files){
max_dim = Math.max(max_dim,getFileMaxDim_C(file));
}
test.min_dim = min_dim;
test.max_dim = max_dim;
}
//--
}

View File

@@ -1,6 +1,6 @@
package _VisualDVM.ComponentsServer.Component.UI;
import Common.Visual.Editor.BaseEditor;
import Common.Visual.Windows.Dialog.DialogFields;
import _VisualDVM.Visual.Editor.BaseEditor;
import javax.swing.*;
import java.awt.*;

View File

@@ -85,7 +85,7 @@ public class Visualiser extends Component {
}
return res;
}
public File getDownloadsDirectory(){
public File getDownloadsDirectory() {
File res = new File(getWorkspace(), Constants.DownloadsDirectoryName);
Utils_.CheckDirectory(res);
return res;

View File

@@ -73,8 +73,8 @@ public class Visualizer_2 extends OSDComponent {
}
@Override
public String getAssemblyCommand() {
File src_home= Paths.get(Global.RepoDirectory.getAbsolutePath(),"SAPFOR/src/Server").toFile();
return "cd " +Utils_.DQuotes(src_home)+
File src_home = Paths.get(Global.RepoDirectory.getAbsolutePath(), "SAPFOR/src/Server").toFile();
return "cd " + Utils_.DQuotes(src_home) +
"\n" +
"g++ -O3 -std=c++17 checkUniq.cpp server.cpp -o Visualizer_2 -lpthread -lstdc++fs\n";
}