no message
This commit is contained in:
37
src/_VisualDVM/GlobalData/Module/Module.java
Normal file
37
src/_VisualDVM/GlobalData/Module/Module.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package _VisualDVM.GlobalData.Module;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
public class Module extends ModuleAnchestor {
|
||||
public int makefile_id = CommonConstants.Nan;
|
||||
public LanguageName language = LanguageName.n;
|
||||
public int on = 1; //учитывать ли модуль при сборке. указание пользователя. если файлы отсутствуют - игнорится
|
||||
public Module() {
|
||||
}
|
||||
public Module(LanguageName language_in, Makefile makefile) {
|
||||
language = language_in;
|
||||
if (makefile != null) {
|
||||
makefile_id = makefile.id;
|
||||
machine_id = makefile.machine_id;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return Current.HasMakefile() && (makefile_id == Current.getMakefile().id);
|
||||
}
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return on > 0;
|
||||
}
|
||||
@Override
|
||||
public void Select(boolean flag) {
|
||||
on = flag ? 1 : 0;
|
||||
try {
|
||||
CommonUtils.db.Update(this);
|
||||
} catch (Exception e) {
|
||||
CommonUtils.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
src/_VisualDVM/GlobalData/Module/ModuleAnchestor.java
Normal file
36
src/_VisualDVM/GlobalData/Module/ModuleAnchestor.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package _VisualDVM.GlobalData.Module;
|
||||
import Common.CommonConstants;
|
||||
import Common.Utils.CommonUtils;
|
||||
import Common.Database.Objects.iDBObject;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
public class ModuleAnchestor extends iDBObject {
|
||||
//--------------------------------------------------------------------------------------
|
||||
public int machine_id = CommonConstants.Nan;
|
||||
public int compiler_id = CommonConstants.Nan;
|
||||
public String command = ""; //дополнительная команда компилятору. между вызовом и флагами.
|
||||
public String flags = ""; //последовательность флагов
|
||||
//---------------------------------------------------------------------------------------
|
||||
//для таблиц
|
||||
public String getCompilerDescription() {
|
||||
Compiler compiler;
|
||||
return ((compiler = getCompiler()) == null) ? "" : compiler.getDescription();
|
||||
}
|
||||
public Compiler getCompiler() {
|
||||
return CommonUtils.db.getById(Compiler.class, compiler_id);
|
||||
}
|
||||
public String getDescription() {
|
||||
String res = "";
|
||||
if (getCompiler() != null) {
|
||||
res += CommonUtils.Brackets(getCompiler().getDescription());
|
||||
if (!command.isEmpty())
|
||||
res += " " + CommonUtils.Brackets(command);
|
||||
if (!flags.isEmpty())
|
||||
res += " " + CommonUtils.Brackets(flags);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public String getStatCommand() {
|
||||
Compiler compiler = getCompiler();
|
||||
return ((compiler != null) ? (compiler.call_command) : "");
|
||||
}
|
||||
}
|
||||
65
src/_VisualDVM/GlobalData/Module/ModulesDBTable.java
Normal file
65
src/_VisualDVM/GlobalData/Module/ModulesDBTable.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package _VisualDVM.GlobalData.Module;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.GlobalData.Module.UI.ModuleAnchestorForm;
|
||||
public class ModulesDBTable extends iDBTable<Module> {
|
||||
public ModulesDBTable() {
|
||||
super(Module.class);
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "языковой модуль";
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "языковые модули";
|
||||
}
|
||||
@Override
|
||||
public DBObjectDialog<Module, ? extends DialogFields> getDialog() {
|
||||
return new ModuleAnchestorForm<>();
|
||||
}
|
||||
@Override
|
||||
protected DataSetControlForm createUI() {
|
||||
return new DataSetControlForm(this) {
|
||||
@Override
|
||||
public boolean hasCheckBox() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void AdditionalInitColumns() {
|
||||
columns.get(0).setVisible(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public Object getFieldAt(Module object, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 2:
|
||||
return object.language.getDescription();
|
||||
case 3:
|
||||
return object.getCompilerDescription();
|
||||
case 4:
|
||||
return object.command;
|
||||
case 5:
|
||||
return object.flags;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String[] getUIColumnNames() {
|
||||
return new String[]{
|
||||
"Язык",
|
||||
"Компилятор",
|
||||
"Команда",
|
||||
"Флаги"
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public Current CurrentName() {
|
||||
return Current.Module;
|
||||
}
|
||||
}
|
||||
8
src/_VisualDVM/GlobalData/Module/ModulesMenuBar.java
Normal file
8
src/_VisualDVM/GlobalData/Module/ModulesMenuBar.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.GlobalData.Module;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class ModulesMenuBar extends DataMenuBar {
|
||||
public ModulesMenuBar() {
|
||||
super("языковые модули", PassCode_2021.EditModule);
|
||||
}
|
||||
}
|
||||
111
src/_VisualDVM/GlobalData/Module/UI/ModuleAnchestorFields.form
Normal file
111
src/_VisualDVM/GlobalData/Module/UI/ModuleAnchestorFields.form
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.GlobalData.Module.UI.ModuleAnchestorFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="730" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="f6ea3" class="javax.swing.JComboBox" binding="cbCompilers">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="0"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="2c3c6">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="da1b3" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="компилятор"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="70919" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="флаги"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="54213" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="команда компиляции"/>
|
||||
<toolTipText value="дополнительная команда компиляции помимо флагов"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f1643" class="javax.swing.JComboBox" binding="cbCommands">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<editable value="false"/>
|
||||
<font name="Times New Roman" size="16" style="0"/>
|
||||
<model>
|
||||
<item value=""/>
|
||||
<item value="flink"/>
|
||||
<item value="clink"/>
|
||||
<item value="f"/>
|
||||
<item value="c"/>
|
||||
</model>
|
||||
<toolTipText value="Выберите из списка дополнительную команду компиляции ( актуально для DVM компиляторов)"/>
|
||||
</properties>
|
||||
</component>
|
||||
<toolbar id="3961e">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="1" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="-1" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<floatable value="false"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="3ccf3" class="javax.swing.JComboBox" binding="cbFlags" custom-create="true">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<editable value="true"/>
|
||||
<font name="Times New Roman" size="16" style="0"/>
|
||||
<model>
|
||||
<item value=""/>
|
||||
<item value="-O2 -g -fprofile-arcs -ftest-coverage"/>
|
||||
</model>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="76c58" class="javax.swing.JButton" binding="bHelp">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<icon value="icons/Help.png"/>
|
||||
<text value=""/>
|
||||
<toolTipText value="Отобразить справочную информацию компилятора"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="91678" class="javax.swing.JButton" binding="BPickOptions">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<icon value="icons/Menu/Regions.png"/>
|
||||
<text value=""/>
|
||||
<toolTipText value="Назначить опции компилятора"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</toolbar>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,74 @@
|
||||
package _VisualDVM.GlobalData.Module.UI;
|
||||
import Common.Visual.CommonUI;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.Controls.StyledTextComboBox;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.GlobalData.Module.Module;
|
||||
import _VisualDVM.GlobalData.Module.ModuleAnchestor;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.Pass_2021;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.LinkedHashMap;
|
||||
public class ModuleAnchestorFields implements DialogFields {
|
||||
public JPanel content;
|
||||
public JComboBox<Compiler> cbCompilers;
|
||||
public JComboBox<String> cbCommands;
|
||||
public JComboBox<String> cbFlags;
|
||||
private JButton bHelp;
|
||||
private JButton BPickOptions;
|
||||
private Compiler compiler;
|
||||
//считаем что машина есть.
|
||||
public ModuleAnchestorFields() {
|
||||
//-
|
||||
LinkedHashMap<Integer, Compiler> compilers = Current.getMachine().getCompilers();
|
||||
compilers.values().forEach(compiler -> cbCompilers.addItem(compiler));
|
||||
bHelp.addActionListener(e -> {
|
||||
if (cbCompilers.getSelectedItem() != null) {
|
||||
Pass_2021.passes.get(PassCode_2021.ShowCompilerHelp).Do(compiler, true);
|
||||
} else CommonUI.Info("Компилятор не выбран");
|
||||
});
|
||||
BPickOptions.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Pass_2021<String> pass = Pass_2021.passes.get(PassCode_2021.PickCompilerOptions);
|
||||
if (pass.Do(compiler)) {
|
||||
CommonUI.TrySelect(cbFlags, pass.target);
|
||||
}
|
||||
}
|
||||
});
|
||||
cbCompilers.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
compiler = (Compiler) cbCompilers.getSelectedItem();
|
||||
}
|
||||
});
|
||||
}
|
||||
public void setListeners(ModuleAnchestor target) {
|
||||
boolean linker = (target instanceof Makefile);
|
||||
LanguageName languageName = linker ?
|
||||
(Current.HasProject() ? Current.getProject().languageName : LanguageName.n) :
|
||||
((Module) target).language;
|
||||
cbCompilers.addActionListener(e -> {
|
||||
if (cbCompilers.getSelectedItem() instanceof Compiler) {
|
||||
Compiler compiler = ((Compiler) cbCompilers.getSelectedItem());
|
||||
CommonUI.TrySelect(cbCommands,
|
||||
linker ? compiler.getSpecialLinkCommand(languageName) : compiler.getSpecialCompilationCommand(languageName));
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
cbFlags = new StyledTextComboBox();
|
||||
}
|
||||
}
|
||||
110
src/_VisualDVM/GlobalData/Module/UI/ModuleAnchestorForm.java
Normal file
110
src/_VisualDVM/GlobalData/Module/UI/ModuleAnchestorForm.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package _VisualDVM.GlobalData.Module.UI;
|
||||
import Common.CommonConstants;
|
||||
import Common.Visual.CommonUI;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import _VisualDVM.GlobalData.Compiler.Compiler;
|
||||
import _VisualDVM.GlobalData.Compiler.CompilerType;
|
||||
import _VisualDVM.GlobalData.Makefile.Makefile;
|
||||
import _VisualDVM.GlobalData.Module.Module;
|
||||
import _VisualDVM.GlobalData.Module.ModuleAnchestor;
|
||||
import _VisualDVM.ProjectData.LanguageName;
|
||||
public class ModuleAnchestorForm<T extends ModuleAnchestor> extends DBObjectDialog<T, ModuleAnchestorFields> {
|
||||
public static String[] banned_flags = new String[]{
|
||||
"-c", "-o",
|
||||
"-ffree-form", "-ffixed-line-length-132", "-ffixed-form",
|
||||
"-FI", "-f90",
|
||||
"-fixed", "-free"
|
||||
};
|
||||
String command;
|
||||
String flags;
|
||||
public ModuleAnchestorForm() {
|
||||
super(ModuleAnchestorFields.class);
|
||||
}
|
||||
@Override
|
||||
public int getDefaultHeight() {
|
||||
return 250;
|
||||
}
|
||||
@Override
|
||||
public void validateFields() {
|
||||
Compiler compiler = (Compiler) fields.cbCompilers.getSelectedItem();
|
||||
command = (String) fields.cbCommands.getSelectedItem();
|
||||
if (command == null) {
|
||||
Log.Writeln("команда компиляции не выбрана");
|
||||
} else {
|
||||
if ((compiler != null) && compiler.type.equals(CompilerType.dvm)) {
|
||||
//проверим команду.
|
||||
if (Result instanceof Makefile) {
|
||||
//могут быть только flink/clink
|
||||
if (!command.equals("flink") && !command.equals("clink")
|
||||
&&
|
||||
!command.equals("f") && !command.equals("c")
|
||||
) {
|
||||
Log.Writeln("При линковке DVM системой допустимы\n" +
|
||||
"только команды f,с, flink или clink");
|
||||
}
|
||||
} else if (Result instanceof Module) {
|
||||
//могут быть только f/c
|
||||
LanguageName languageName = ((Module) Result).language;
|
||||
switch (languageName) {
|
||||
case fortran:
|
||||
case c:
|
||||
if (!command.equals(languageName.getDVMCompile()))
|
||||
Log.Writeln("компиляция " + languageName.getDescription() +
|
||||
" программ DVM системой осуществляется только командой " +
|
||||
languageName.getDVMCompile()
|
||||
);
|
||||
break;
|
||||
default:
|
||||
Log.Writeln("язык " + languageName + " не поддерживается DVM системой");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!command.isEmpty())
|
||||
Log.Writeln("Для всех компиляторов, кроме DVM системы, команда компиляции/линковки должна быть пуста.");
|
||||
}
|
||||
}
|
||||
flags = (String) fields.cbFlags.getSelectedItem();
|
||||
if (flags == null) Log.Writeln("флаги компиляции не выбраны");
|
||||
else {
|
||||
//проверка на служебные флаги
|
||||
String[] data = flags.split(" ");
|
||||
for (String flag : data) {
|
||||
if (!flag.isEmpty()) {
|
||||
/*
|
||||
if (!flag.startsWith("-")) {
|
||||
Log.Writeln("неверный формат флага " + Utils.Brackets(flag));
|
||||
} else {
|
||||
*/
|
||||
for (String banned_flag : banned_flags) {
|
||||
if (flag.equalsIgnoreCase(banned_flag)) {
|
||||
Log.Writeln("флаги:\n" +
|
||||
String.join(",", banned_flags) +
|
||||
"\nзарезервированы системой.");
|
||||
return;
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//проврка команды
|
||||
}
|
||||
@Override
|
||||
public void fillFields() {
|
||||
CommonUI.TrySelect(fields.cbFlags, Result.flags);
|
||||
CommonUI.TrySelect(fields.cbCommands, Result.command);
|
||||
CommonUI.TrySelect(fields.cbCompilers, Result.getCompiler());
|
||||
//--------------------------------------------
|
||||
fields.setListeners(Result);
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result.machine_id = Current.getMachine().id;
|
||||
Compiler compiler = (Compiler) fields.cbCompilers.getSelectedItem();
|
||||
Result.compiler_id = (compiler != null) ? compiler.id : CommonConstants.Nan;
|
||||
Result.command = command;
|
||||
Result.flags = flags;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user