Commit cf2d0868 authored by Andrey Filippov's avatar Andrey Filippov

Got rid of static variables and methods in FormatProcessor, continue

debugging.
parent d8bf8483
...@@ -129,9 +129,9 @@ public class LaunchCore { ...@@ -129,9 +129,9 @@ public class LaunchCore {
String valueAttrName = LaunchCore.getValueAttributeName(param); String valueAttrName = LaunchCore.getValueAttributeName(param);
if(param.getType().isList()) if(param.getType().isList())
workingCopy.setAttribute(valueAttrName, param.getValue()); workingCopy.setAttribute(valueAttrName, param.getValue(null)); // null for topFormatProcessor
else else
workingCopy.setAttribute(valueAttrName, param.getValue().get(0)); workingCopy.setAttribute(valueAttrName, param.getValue(null).get(0)); // null for topFormatProcessor
} }
setToolToLaunch(workingCopy, tool); setToolToLaunch(workingCopy, tool);
...@@ -227,6 +227,8 @@ public class LaunchCore { ...@@ -227,6 +227,8 @@ public class LaunchCore {
IProject project, IProject project,
String resource, String resource,
String logBuildStamp) throws CoreException { String logBuildStamp) throws CoreException {
// System.out.println("1.DebugUITools.launch() tool="+tool+" project="+project+" resource="+resource+" logBuildStamp="+logBuildStamp);
// System.out.println("2.DebugUITools.launch() tool="+tool.getName()+" project="+project.getName()+" resource="+resource.toString()+" logBuildStamp="+logBuildStamp); //Unhandled event loop exception
if (!saveAllEditors(true)) return; // Andrey: added it here if (!saveAllEditors(true)) return; // Andrey: added it here
try { try {
...@@ -236,13 +238,18 @@ public class LaunchCore { ...@@ -236,13 +238,18 @@ public class LaunchCore {
resource, resource,
logBuildStamp); logBuildStamp);
if (VDTLaunchUtil.getRunner().getRunningBuilds().isAlreadyOpen(tool.getName())){ if (VDTLaunchUtil.getRunner().getRunningBuilds().isAlreadyOpen(tool.getName())){
return; // System.out.println("LaunchCore:launch() tool="+tool.getName()+" was already open! Ignoring... ");
// return;
} }
// System.out.println("DebugUITools.launch() tool="+tool.getName()+" project="+project.getName()+" resource="+resource.toString()+" logBuildStamp="+logBuildStamp);
DebugUITools.launch(launchConfig, ILaunchManager.RUN_MODE); DebugUITools.launch(launchConfig, ILaunchManager.RUN_MODE);
} catch (CoreException e) { } catch (CoreException e) {
IStatus status = e.getStatus(); IStatus status = e.getStatus();
if (status.getSeverity() != IStatus.CANCEL) if (status.getSeverity() != IStatus.CANCEL)
throw e; throw e;
} finally {
// System.out.println("3.DebugUITools.launch() tool="+tool.getName()+" project="+project.getName()+" resource="+resource.toString()+" logBuildStamp="+logBuildStamp);
} }
} // launch() } // launch()
...@@ -378,7 +385,8 @@ public class LaunchCore { ...@@ -378,7 +385,8 @@ public class LaunchCore {
*/ */
protected static boolean saveAllEditors(boolean confirm) { protected static boolean saveAllEditors(boolean confirm) {
if (VerilogPlugin.getActiveWorkbenchWindow() == null) { if (VerilogPlugin.getActiveWorkbenchWindow() == null) {
return false; System.out.println("VerilogPlugin.getActiveWorkbenchWindow() == null");
return true; // false;
} }
return PlatformUI.getWorkbench().saveAllEditors(confirm); return PlatformUI.getWorkbench().saveAllEditors(confirm);
} }
......
...@@ -186,17 +186,19 @@ public class RunningBuilds { ...@@ -186,17 +186,19 @@ public class RunningBuilds {
} }
public void removeConfiguration(String consoleName){ public void removeConfiguration(String consoleName){
System.out.println("VDTRunnerConfiguration#removeConfiguration("+consoleName+")");
unfinishedBuilds.remove(consoleName); unfinishedBuilds.remove(consoleName);
System.out.println("Running consoles:"); if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
listConfigurations(); System.out.println("VDTRunnerConfiguration#removeConfiguration("+consoleName+"), running consoles:");
listConfigurations();
}
} }
public void saveUnfinished(String consoleName, VDTRunnerConfiguration configuration ){ public void saveUnfinished(String consoleName, VDTRunnerConfiguration configuration ){
System.out.println("VDTRunnerConfiguration#saveUnfinished("+consoleName+", configuration)");
unfinishedBuilds.put(consoleName, configuration); unfinishedBuilds.put(consoleName, configuration);
System.out.println("Running consoles:"); if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
listConfigurations(); System.out.println("VDTRunnerConfiguration#saveUnfinished("+consoleName+", configuration), running consoles:");
listConfigurations();
}
} }
public void listConfigurations(){ public void listConfigurations(){
......
...@@ -279,7 +279,7 @@ public class VDTConsoleRunner{ ...@@ -279,7 +279,7 @@ public class VDTConsoleRunner{
for (int i=0;i<fArguments.length;i++){ for (int i=0;i<fArguments.length;i++){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.LOCAL_ECHO)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.LOCAL_ECHO)) {
fOutStream.write(fArguments[i]+"\n"); // writes to console itself fOutStream.write(fArguments[i]+"\n"); // writes to console itself
System.out.println("--->"+fArguments[i]+"\n"); // System.out.println("--->"+fArguments[i]+"\n");
} }
consoleInStreamProxy.write(fArguments[i]+"\n"); consoleInStreamProxy.write(fArguments[i]+"\n");
} }
......
...@@ -144,10 +144,10 @@ public class VDTLaunchUtil { ...@@ -144,10 +144,10 @@ public class VDTLaunchUtil {
try { try {
if(param.getType().isList()) { if(param.getType().isList()) {
List<String> value = List<String> value =
configuration.getAttribute(valueAttrName, param.getDefaultValue()); configuration.getAttribute(valueAttrName, param.getDefaultValue(null)); // null for topFormatProcessor
param.setCurrentValue(value); param.setCurrentValue(value);
} else { } else {
String value = configuration.getAttribute(valueAttrName, param.getDefaultValue().get(0)); String value = configuration.getAttribute(valueAttrName, param.getDefaultValue(null).get(0)); // null for topFormatProcessor
param.setCurrentValue(value); param.setCurrentValue(value);
} }
} catch(ToolException e) { } catch(ToolException e) {
......
...@@ -59,7 +59,7 @@ public class ParamBasedListOption extends ParamBasedOption { ...@@ -59,7 +59,7 @@ public class ParamBasedListOption extends ParamBasedOption {
} }
public List<String> getValueList() { public List<String> getValueList() {
return param.getValue(); return param.getValue(null); // null for topFormatProcessor
} }
public List<String> doLoadList() { public List<String> doLoadList() {
...@@ -83,7 +83,7 @@ public class ParamBasedListOption extends ParamBasedOption { ...@@ -83,7 +83,7 @@ public class ParamBasedListOption extends ParamBasedOption {
} }
public List<String> doLoadDefaultList() { public List<String> doLoadDefaultList() {
List<String> list = param.getDefaultValue(); List<String> list = param.getDefaultValue(null); // null for topFormatProcessor
doClear(); doClear();
return list; return list;
} }
...@@ -109,7 +109,7 @@ public class ParamBasedListOption extends ParamBasedOption { ...@@ -109,7 +109,7 @@ public class ParamBasedListOption extends ParamBasedOption {
super.doClear(); super.doClear();
return true; return true;
} else } else
return super.doStore(OptionsUtils.convertListToString(param.getValue())); return super.doStore(OptionsUtils.convertListToString(param.getValue(null))); // null for topFormatProcessor
} }
} // class ParamBasedOption } // class ParamBasedOption
...@@ -49,7 +49,7 @@ public class ParamBasedOption extends Option { ...@@ -49,7 +49,7 @@ public class ParamBasedOption extends Option {
} }
public String getValue() { public String getValue() {
return param.getValue().get(0); return param.getValue(null).get(0); // null for topFormatProcessor
} }
public Parameter getParam() { public Parameter getParam() {
...@@ -73,13 +73,13 @@ public class ParamBasedOption extends Option { ...@@ -73,13 +73,13 @@ public class ParamBasedOption extends Option {
} }
public String doLoadDefault() { public String doLoadDefault() {
String value = param.getDefaultValue(true).get(0); // Andrey: ignore faults in TopModuleName generator String value = param.getDefaultValue(true, null).get(0); // Andrey: ignore faults in TopModuleName generator // null for topFormatProcessor
doClear(); doClear();
return value; return value;
} }
public String doLoadDefault(boolean menuMode) { public String doLoadDefault(boolean menuMode) {
String value = param.getDefaultValue(menuMode).get(0); String value = param.getDefaultValue(menuMode,null).get(0);
doClear(); doClear();
return value; return value;
} }
......
...@@ -224,7 +224,7 @@ public abstract class Context { ...@@ -224,7 +224,7 @@ public abstract class Context {
CommandLinesBlock commandLinesBlock = (CommandLinesBlock)commandLinesBlockIter.next(); CommandLinesBlock commandLinesBlock = (CommandLinesBlock)commandLinesBlockIter.next();
if (commandLinesBlock.isConsoleKind()){ if (commandLinesBlock.isConsoleKind()){
Parameter parName = findParam(commandLinesBlock.getDestination()); // command file or console name Parameter parName = findParam(commandLinesBlock.getDestination()); // command file or console name
String consoleName = (parName != null)? parName.getValue().get(0).trim() : null; String consoleName = (parName != null)? parName.getValue(null).get(0).trim() : null;
if (consoleName!=null) consoleList.add(consoleName); if (consoleName!=null) consoleList.add(consoleName);
} }
} }
...@@ -282,8 +282,9 @@ public abstract class Context { ...@@ -282,8 +282,9 @@ public abstract class Context {
String toolInfo= subsitutePattern(commandLinesBlock.getInfo()); String toolInfo= subsitutePattern(commandLinesBlock.getInfo());
String stderr=commandLinesBlock.getStderr(); String stderr=commandLinesBlock.getStderr();
String stdout=commandLinesBlock.getStdout(); String stdout=commandLinesBlock.getStdout();
String prompt= buildSimpleString(commandLinesBlock.getPrompt()); // evaluate string // the result will not be used as some other parameter value, so topProcessor is null in the next 2 lines /Andrey
String sTimeout=buildSimpleString(commandLinesBlock.getTimeout()); String prompt= buildSimpleString(commandLinesBlock.getPrompt(), null); // evaluate string
String sTimeout=buildSimpleString(commandLinesBlock.getTimeout(),null);
int timeout=0; int timeout=0;
try{ try{
timeout=Integer.parseInt(sTimeout); timeout=Integer.parseInt(sTimeout);
...@@ -307,7 +308,8 @@ public abstract class Context { ...@@ -307,7 +308,8 @@ public abstract class Context {
List<List<String>> commandSequence = new ArrayList<List<String>>(); List<List<String>> commandSequence = new ArrayList<List<String>>();
for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) { for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) {
String line = (String)lineIter.next(); String line = (String)lineIter.next();
commandSequence.add(buildCommandString(line)); // TODO: parses them here? VERIFY // the result will not be used as some other parameter value, so topProcessor is null in the next line /Andrey
commandSequence.add(buildCommandString(line,null)); // TODO: parses them here? VERIFY
} }
// Here - already resolved to empty // Here - already resolved to empty
...@@ -315,7 +317,7 @@ public abstract class Context { ...@@ -315,7 +317,7 @@ public abstract class Context {
if(destName != null) { if(destName != null) {
Parameter parName = findParam(destName); // command file or console name Parameter parName = findParam(destName); // command file or console name
String controlFileName = parName != null? String controlFileName = parName != null?
parName.getValue().get(0).trim() : null; parName.getValue(null).get(0).trim() : null;
if (isConsoleName) { if (isConsoleName) {
// System.out.println("TODO: Enable console command generation here"); // System.out.println("TODO: Enable console command generation here");
printStringsToConsoleLine(commandLineParams, commandSequence,sep,mark); printStringsToConsoleLine(commandLineParams, commandSequence,sep,mark);
...@@ -427,7 +429,7 @@ public abstract class Context { ...@@ -427,7 +429,7 @@ public abstract class Context {
return (BuildParamsItem[])buildParamItems.toArray(new BuildParamsItem[buildParamItems.size()]); return (BuildParamsItem[])buildParamItems.toArray(new BuildParamsItem[buildParamItems.size()]);
} }
protected List<String> buildCommandString(String paramStringTemplate) protected List<String> buildCommandString(String paramStringTemplate, FormatProcessor topProcessor)
throws ToolException throws ToolException
{ {
FormatProcessor processor = new FormatProcessor(new Recognizer[] { FormatProcessor processor = new FormatProcessor(new Recognizer[] {
...@@ -435,26 +437,26 @@ public abstract class Context { ...@@ -435,26 +437,26 @@ public abstract class Context {
new RepeaterRecognizer() new RepeaterRecognizer()
// new ContextParamRecognizer(this), // new ContextParamRecognizer(this),
// new ContextParamRepeaterRecognizer(this) // new ContextParamRepeaterRecognizer(this)
}); },topProcessor);
return processor.process(paramStringTemplate); return processor.process(paramStringTemplate);
} }
// recognizes parameter name (just %name), or simple generators // recognizes parameter name (just %name), or simple generators
protected String buildSimpleString(String stringTemplate) protected String buildSimpleString(String stringTemplate, FormatProcessor topProcessor)
throws ToolException throws ToolException
{ {
if (stringTemplate==null) return null; if (stringTemplate==null) return null;
Parameter parName=findParam(stringTemplate); Parameter parName=findParam(stringTemplate);
if (parName!=null){ if (parName!=null){
return parName.getValue().get(0).trim(); // get parameter return parName.getValue(topProcessor).get(0).trim(); // get parameter
} }
FormatProcessor processor = new FormatProcessor(new Recognizer[] { FormatProcessor processor = new FormatProcessor(new Recognizer[] {
new SimpleGeneratorRecognizer(), new SimpleGeneratorRecognizer(),
new RepeaterRecognizer() new RepeaterRecognizer()
// new ContextParamRecognizer(this), // new ContextParamRecognizer(this),
// new ContextParamRepeaterRecognizer(this) // new ContextParamRepeaterRecognizer(this)
}); },topProcessor);
List<String> result= processor.process(stringTemplate); List<String> result= processor.process(stringTemplate);
if (result.size()==0) return ""; if (result.size()==0) return "";
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.generators; package com.elphel.vdt.core.tools.generators;
import com.elphel.vdt.core.Utils; import com.elphel.vdt.core.Utils;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Tool; import com.elphel.vdt.core.tools.params.Tool;
import com.elphel.vdt.ui.MessageUI; import com.elphel.vdt.ui.MessageUI;
...@@ -34,26 +35,29 @@ public abstract class AbstractGenerator { ...@@ -34,26 +35,29 @@ public abstract class AbstractGenerator {
private final boolean forcedMultiline; private final boolean forcedMultiline;
private boolean menuMode=false; // managing menu items, not running tool. Ignore Generator errors private boolean menuMode=false; // managing menu items, not running tool. Ignore Generator errors
protected Tool tool0; // "tool" was already used in ToolParamRecognizer / Andrey protected Tool tool0; // "tool" was already used in ToolParamRecognizer / Andrey
protected FormatProcessor topProcessor; // to protect from cycles in recursion, replacing static in FormatProcessor / Andrey
public AbstractGenerator() { public AbstractGenerator(FormatProcessor processor) {
this(false); this(false, processor);
} }
public AbstractGenerator(String prefix, public AbstractGenerator(String prefix,
String suffix, String suffix,
String separator) String separator,
FormatProcessor processor)
{ {
this(prefix, suffix, separator, false); this(prefix, suffix, separator, false,processor);
} }
protected AbstractGenerator(boolean forcedMultiline) { protected AbstractGenerator(boolean forcedMultiline, FormatProcessor processor) {
this("", "", "", forcedMultiline); this("", "", "", forcedMultiline, processor);
} }
protected AbstractGenerator(String prefix, protected AbstractGenerator(String prefix,
String suffix, String suffix,
String sep, String sep,
boolean forcedMultiline) boolean forcedMultiline,
FormatProcessor processor)
{ {
this.prefix = prefix; this.prefix = prefix;
this.suffix = suffix; this.suffix = suffix;
...@@ -63,6 +67,7 @@ public abstract class AbstractGenerator { ...@@ -63,6 +67,7 @@ public abstract class AbstractGenerator {
separator = separator.replace("\\n", "\n"); separator = separator.replace("\\n", "\n");
separator = separator.replace("\\t", "\t"); separator = separator.replace("\\t", "\t");
} }
topProcessor=processor;
} }
public void setMenuMode(boolean menuMode){ public void setMenuMode(boolean menuMode){
this.menuMode=menuMode; this.menuMode=menuMode;
...@@ -73,6 +78,7 @@ public abstract class AbstractGenerator { ...@@ -73,6 +78,7 @@ public abstract class AbstractGenerator {
public void setTool(Tool tool){ public void setTool(Tool tool){
this.tool0=tool; this.tool0=tool;
} }
protected FormatProcessor getTopProcessor(){return topProcessor;}
public abstract String getName(); public abstract String getName();
......
...@@ -26,6 +26,11 @@ public class BuildStampGenerator extends AbstractGenerator { ...@@ -26,6 +26,11 @@ public class BuildStampGenerator extends AbstractGenerator {
return NAME; return NAME;
} }
public BuildStampGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() { protected String[] getStringValues() {
// if ( return new String[] {(tool0!=null)?tool0.getStateFile(): ""}; // if ( return new String[] {(tool0!=null)?tool0.getStateFile(): ""};
// System.out.println("#### BuildStampGenerator(): tool0="+ // System.out.println("#### BuildStampGenerator(): tool0="+
......
...@@ -25,7 +25,11 @@ public class ChosenActionGenerator extends AbstractGenerator { ...@@ -25,7 +25,11 @@ public class ChosenActionGenerator extends AbstractGenerator {
public String getName() { public String getName() {
return NAME; return NAME;
} }
public ChosenActionGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() { protected String[] getStringValues() {
int choice=SelectedResourceManager.getDefault().getChosenAction(); int choice=SelectedResourceManager.getDefault().getChosenAction();
return new String[] { ""+choice }; return new String[] { ""+choice };
......
...@@ -26,7 +26,11 @@ public class CurrentFileBaseGenerator extends AbstractGenerator { ...@@ -26,7 +26,11 @@ public class CurrentFileBaseGenerator extends AbstractGenerator {
public String getName() { public String getName() {
return NAME; return NAME;
} }
public CurrentFileBaseGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() { protected String[] getStringValues() {
String name=SelectedResourceManager.getDefault().getChosenShort(); // last segment of the file name String name=SelectedResourceManager.getDefault().getChosenShort(); // last segment of the file name
if (name!=null){ if (name!=null){
......
...@@ -29,6 +29,11 @@ public class CurrentFileGenerator extends AbstractGenerator { ...@@ -29,6 +29,11 @@ public class CurrentFileGenerator extends AbstractGenerator {
public String getName() { public String getName() {
return NAME; return NAME;
} }
public CurrentFileGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() { protected String[] getStringValues() {
IResource resource; IResource resource;
if (getMenuMode()) { if (getMenuMode()) {
......
...@@ -36,7 +36,7 @@ public class FileListGenerator extends AbstractGenerator { ...@@ -36,7 +36,7 @@ public class FileListGenerator extends AbstractGenerator {
String suffix, String suffix,
String separator) String separator)
{ {
super(prefix, suffix, separator); super(prefix, suffix, separator,null); // null for topFormatProcessor - this generator can not reference other parameters
} }
public String getName() { public String getName() {
......
...@@ -54,7 +54,7 @@ public class FilteredSourceListGenerator extends AbstractGenerator { ...@@ -54,7 +54,7 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
String suffix, String suffix,
String separator) String separator)
{ {
super(prefix, suffix, separator); super(prefix, suffix, separator, null ); // null for topFormatProcessor - this generator can not reference other parameters
} }
public String getName() { public String getName() {
......
...@@ -30,9 +30,13 @@ public class OSNameGenerator extends AbstractGenerator { ...@@ -30,9 +30,13 @@ public class OSNameGenerator extends AbstractGenerator {
public String getName() { public String getName() {
return NAME; return NAME;
} }
public OSNameGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() { protected String[] getStringValues() {
String osName = System.getProperty("os.name"); String osName = System.getProperty("os.name");
if(osName.indexOf(OS_WINDOWS) >= 0) { if(osName.indexOf(OS_WINDOWS) >= 0) {
return new String[] { OS_WINDOWS }; return new String[] { OS_WINDOWS };
......
...@@ -37,6 +37,11 @@ public class ProjectNameGenerator extends AbstractGenerator { ...@@ -37,6 +37,11 @@ public class ProjectNameGenerator extends AbstractGenerator {
return NAME; return NAME;
} }
public ProjectNameGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() { protected String[] getStringValues() {
String[] value = null; String[] value = null;
IResource resource = SelectedResourceManager.getDefault().getSelectedResource(); IResource resource = SelectedResourceManager.getDefault().getSelectedResource();
......
...@@ -34,6 +34,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager; ...@@ -34,6 +34,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class ProjectPathGenerator extends AbstractGenerator { public class ProjectPathGenerator extends AbstractGenerator {
public static final String NAME = VDT.GENERATOR_ID_PROJECT_PATH; public static final String NAME = VDT.GENERATOR_ID_PROJECT_PATH;
public ProjectPathGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() { public String getName() {
return NAME; return NAME;
......
...@@ -27,6 +27,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager; ...@@ -27,6 +27,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class SelectedFileGenerator extends AbstractGenerator { public class SelectedFileGenerator extends AbstractGenerator {
private static final String NAME = VDT.GENERATOR_ID_SELECTED_FILE; private static final String NAME = VDT.GENERATOR_ID_SELECTED_FILE;
// private boolean menuMode=false; // managing menu items, not running tool // private boolean menuMode=false; // managing menu items, not running tool
public SelectedFileGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() { public String getName() {
return NAME; return NAME;
......
...@@ -43,7 +43,7 @@ public class SourceListGenerator extends AbstractGenerator { ...@@ -43,7 +43,7 @@ public class SourceListGenerator extends AbstractGenerator {
String suffix, String suffix,
String separator) String separator)
{ {
super(prefix, suffix, separator); super(prefix, suffix, separator,null); // null for topFormatProcessor - this generator can not reference other parameters
} }
public String getName() { public String getName() {
......
...@@ -22,11 +22,16 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager; ...@@ -22,11 +22,16 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
/** /**
* Generates name of teh sate file without extension * Generates name of the sate file without extension
* *
*/ */
public class StateBaseGenerator extends AbstractGenerator { public class StateBaseGenerator extends AbstractGenerator {
public static final String NAME = VDT.GENERATOR_ID_STATE_FILE; public static final String NAME = VDT.GENERATOR_ID_STATE_FILE;
public StateBaseGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() { public String getName() {
return NAME; return NAME;
} }
......
...@@ -21,6 +21,10 @@ import com.elphel.vdt.VDT; ...@@ -21,6 +21,10 @@ import com.elphel.vdt.VDT;
public class StateDirGenerator extends AbstractGenerator { public class StateDirGenerator extends AbstractGenerator {
public static final String NAME = VDT.GENERATOR_ID_STATE_DIR; public static final String NAME = VDT.GENERATOR_ID_STATE_DIR;
public StateDirGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() { public String getName() {
return NAME; return NAME;
} }
......
...@@ -22,6 +22,11 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager; ...@@ -22,6 +22,11 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class StateFileGenerator extends AbstractGenerator { public class StateFileGenerator extends AbstractGenerator {
public static final String NAME = VDT.GENERATOR_ID_STATE_FILE; public static final String NAME = VDT.GENERATOR_ID_STATE_FILE;
public StateFileGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() { public String getName() {
return NAME; return NAME;
} }
......
...@@ -17,11 +17,13 @@ ...@@ -17,11 +17,13 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.generators; package com.elphel.vdt.core.tools.generators;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class StringsGenerator extends AbstractGenerator { public abstract class StringsGenerator extends AbstractGenerator {
private final String[] paramStrings; private final String[] paramStrings;
public StringsGenerator(String[] paramStrings) { public StringsGenerator(String[] paramStrings, FormatProcessor topProcessor) {
super(true); super(true, topProcessor);
this.paramStrings = paramStrings; this.paramStrings = paramStrings;
} }
......
...@@ -32,7 +32,11 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager; ...@@ -32,7 +32,11 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class TopModuleNameGenerator extends AbstractGenerator { public class TopModuleNameGenerator extends AbstractGenerator {
private static final String NAME = VDT.GENERATOR_ID_TOP_MODULE; private static final String NAME = VDT.GENERATOR_ID_TOP_MODULE;
public TopModuleNameGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() { public String getName() {
return NAME; return NAME;
} }
......
...@@ -38,7 +38,7 @@ public class TopModulesNameGenerator extends AbstractGenerator { ...@@ -38,7 +38,7 @@ public class TopModulesNameGenerator extends AbstractGenerator {
String suffix, String suffix,
String separator) String separator)
{ {
super(prefix, suffix, separator); super(prefix, suffix, separator,null); // null for topFormatProcessor - this generator can not reference other parameters
} }
public String getName() { public String getName() {
......
...@@ -20,12 +20,17 @@ package com.elphel.vdt.core.tools.generators; ...@@ -20,12 +20,17 @@ package com.elphel.vdt.core.tools.generators;
import com.elphel.vdt.VDT; import com.elphel.vdt.VDT;
public class UserNameGenerator extends AbstractGenerator { public class UserNameGenerator extends AbstractGenerator {
public static final String NAME = VDT.GENERATOR_ID_USERNAME; public static final String NAME = VDT.GENERATOR_ID_USERNAME;
public String getName() { public UserNameGenerator()
return NAME; {
} super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() {
return new String[] {System.getProperty("user.name")}; public String getName() {
} return NAME;
}
protected String[] getStringValues() {
return new String[] {System.getProperty("user.name")};
}
} //UserNameGenerator } //UserNameGenerator
...@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.generators; ...@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.generators;
import java.util.*; import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
public class ValueGenerator extends AbstractGenerator { public class ValueGenerator extends AbstractGenerator {
...@@ -27,9 +28,10 @@ public class ValueGenerator extends AbstractGenerator { ...@@ -27,9 +28,10 @@ public class ValueGenerator extends AbstractGenerator {
public ValueGenerator(Parameter param, public ValueGenerator(Parameter param,
String prefix, String prefix,
String suffix, String suffix,
String separator) String separator,
FormatProcessor topProcessor)
{ {
super(prefix, suffix, separator); super(prefix, suffix, separator, topProcessor);
this.param = param; this.param = param;
} }
...@@ -41,14 +43,22 @@ public class ValueGenerator extends AbstractGenerator { ...@@ -41,14 +43,22 @@ public class ValueGenerator extends AbstractGenerator {
} }
protected String[] getStringValues() { protected String[] getStringValues() {
List<String> values = param.getValue(); List<String> values = param.getValue(topProcessor);
return values.toArray(new String[values.size()]); return values.toArray(new String[values.size()]);
} }
public String[] generate() { public String[] generate() {
if (!param.getType().isList()) if (!param.getType().isList()) {
return new String[]{prefix + param.getValue().get(0) + suffix}; List<String> rslt=param.getValue(topProcessor);
if (rslt.isEmpty()){
System.out.println("BUG in ValueGenerator.java#generate: param.getValue() isEmpty for "+param.getID());
return new String[]{prefix + "" + suffix};
} else {
return new String[]{prefix + rslt.get(0) + suffix};
}
// return new String[]{prefix + param.getValue(topProcessor).get(0) + suffix};
}
else else
return super.generate(); return super.generate();
} }
......
...@@ -26,6 +26,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager; ...@@ -26,6 +26,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class ViewSelectedFileGenerator extends AbstractGenerator { public class ViewSelectedFileGenerator extends AbstractGenerator {
private static final String NAME = VDT.GENERATOR_ID_SELECTED_FILE; private static final String NAME = VDT.GENERATOR_ID_SELECTED_FILE;
public ViewSelectedFileGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() { public String getName() {
return NAME; return NAME;
......
...@@ -44,7 +44,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -44,7 +44,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
// for commands being sent to opened remote console: // for commands being sent to opened remote console:
private String prompt; // relevant for commands sent to remote console - double prompt means "done" (extra separator on input) private String prompt; // relevant for commands sent to remote console - double prompt means "done" (extra separator on input)
private String stderr; // name of the command to (command line block) to launch in a separate process/console private String stderr; // name of the command to (command line block) to launch in a separate process/console
// and connect to stderr of the terminakl session // and connect to stderr of the terminal session
private String stdout; // name of the command to (command line block) to launch in a separate process/console private String stdout; // name of the command to (command line block) to launch in a separate process/console
// and connect to stderr of the terminal session // and connect to stderr of the terminal session
// If both are specified and pointing to the same command block - two instances/consoles will be launched. // If both are specified and pointing to the same command block - two instances/consoles will be launched.
...@@ -229,7 +229,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -229,7 +229,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
return !destination.equals(""); return !destination.equals("");
} }
public void update(Updateable from) throws ConfigException { public void update(Updateable from, FormatProcessor topProcessor) throws ConfigException {
CommandLinesBlock block = (CommandLinesBlock)from; CommandLinesBlock block = (CommandLinesBlock)from;
if(name == null) if(name == null)
...@@ -241,6 +241,11 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -241,6 +241,11 @@ public class CommandLinesBlock extends UpdateableStringsContainer
if(separator == null) if(separator == null)
separator = block.separator; separator = block.separator;
super.update(from); super.update(from, topProcessor);
}
public void update(Updateable from) throws ConfigException {
update(from,null);
System.out.println("CommandLinesBlock#update(from,null)");
} }
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.params; package com.elphel.vdt.core.tools.params;
import java.util.*; import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import com.elphel.vdt.core.tools.generators.AbstractGenerator; import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.params.recognizers.Recognizer; import com.elphel.vdt.core.tools.params.recognizers.Recognizer;
...@@ -28,26 +29,40 @@ public class FormatProcessor { ...@@ -28,26 +29,40 @@ public class FormatProcessor {
private static final String CONTROL_SEQ = "%"; private static final String CONTROL_SEQ = "%";
private static final int CONTROL_SEQ_LEN = CONTROL_SEQ.length(); private static final int CONTROL_SEQ_LEN = CONTROL_SEQ.length();
private static List<String> expandedGenerators = new ArrayList<String>(); // private static List<String> expandedGenerators = new ArrayList<String>();
private static int callCount = 0;
// TODO: Get rid of this static list used to verify cycles - does not work in multi-threaded environment
// private static List<String> expandedGenerators = new CopyOnWriteArrayList<String>();
private List<String> expandedGenerators = null;
private final boolean recursive = true; private final boolean recursive = true;
private final boolean multiline; private final boolean multiline;
private final Recognizer[] recognizers; private final Recognizer[] recognizers;
private String initialTemplate; private String initialTemplate;
private FormatProcessor topProcessor=null;
// private static int callCount = 0;
private int callCount = 0; // only valid for topProcessor
public FormatProcessor(Recognizer[] recognizers, boolean multiline) { public FormatProcessor(Recognizer[] recognizers, boolean multiline, FormatProcessor processor) {
this.recognizers = recognizers; this.recognizers = recognizers;
this.multiline = multiline; this.multiline = multiline;
this.topProcessor=processor;
if (topProcessor==null){
topProcessor=this;
expandedGenerators=new ArrayList<String>();
} else {
expandedGenerators=topProcessor.expandedGenerators;
}
} }
public FormatProcessor(Recognizer[] recognizers) { public FormatProcessor(Recognizer[] recognizers,FormatProcessor processor) {
this(recognizers, true); this(recognizers, true, processor);
} }
public List<String> process(String template) throws ToolException { public List<String> process(String template) throws ToolException {
if(callCount++ == 0) if(topProcessor.callCount++ == 0)
expandedGenerators.clear(); expandedGenerators.clear();
initialTemplate = template; initialTemplate = template;
...@@ -57,7 +72,7 @@ public class FormatProcessor { ...@@ -57,7 +72,7 @@ public class FormatProcessor {
try { try {
outputLines = processTemplate(template); // echo %SimulationTopFile %%SelectedFile ; -> null outputLines = processTemplate(template); // echo %SimulationTopFile %%SelectedFile ; -> null
} finally { } finally {
callCount--; topProcessor.callCount--;
} }
if(!multiline) { if(!multiline) {
...@@ -80,7 +95,7 @@ public class FormatProcessor { ...@@ -80,7 +95,7 @@ public class FormatProcessor {
if(template.startsWith(CONTROL_SEQ, pos)) { if(template.startsWith(CONTROL_SEQ, pos)) {
pos += CONTROL_SEQ_LEN; pos += CONTROL_SEQ_LEN;
// got different instance of ToolParamRecognizer with tool==null // got different instance of ToolParamRecognizer with tool==null
RecognizerResult result = recognize(template, pos); // Already skipped blank lines (and spaces in each line, added separators - no, on deifferent level RecognizerResult result = recognize(template, pos, topProcessor); // Already skipped blank lines (and spaces in each line, added separators - no, on different level
if(result != null && result.getGenerator() != null) { if(result != null && result.getGenerator() != null) {
assert result.getNewPos() > pos; assert result.getNewPos() > pos;
...@@ -111,9 +126,9 @@ public class FormatProcessor { ...@@ -111,9 +126,9 @@ public class FormatProcessor {
return outputLines; return outputLines;
} }
private RecognizerResult recognize(String template, int pos) throws ToolException { private RecognizerResult recognize(String template, int pos, FormatProcessor topProcessor) throws ToolException {
for(int i = 0; i < recognizers.length; i++) { for(int i = 0; i < recognizers.length; i++) {
RecognizerResult result = recognizers[i].recognize(template, pos); RecognizerResult result = recognizers[i].recognize(template, pos, topProcessor);
assert result != null; assert result != null;
...@@ -215,11 +230,19 @@ public class FormatProcessor { ...@@ -215,11 +230,19 @@ public class FormatProcessor {
"and try to detect the cyclic dependency by successively removing them."); "and try to detect the cyclic dependency by successively removing them.");
} }
private static void pushGen(String genName) { // private static void pushGen(String genName) {
private void pushGen(String genName) {
if (expandedGenerators.size()>5) System.out.println(">>PushGen("+genName+"):"+expandedGenerators.size());
expandedGenerators.add(genName); expandedGenerators.add(genName);
} }
private static void popGen() { // private static void popGen() {
expandedGenerators.remove(expandedGenerators.size()-1); private void popGen() {
try {
if (expandedGenerators.size()>6) System.out.println(">>PopGen():"+expandedGenerators.size());
expandedGenerators.remove(expandedGenerators.size()-1); // got -1
} catch (Exception e){
System.out.println("Failed to expandedGenerators.remove(expandedGenerators.size()-1), e="+e); // Andrey where does this concurrency come from? SOLVED: got rid of static
}
} }
} }
...@@ -95,7 +95,7 @@ public class ParamGroup extends UpdateableStringsContainer ...@@ -95,7 +95,7 @@ public class ParamGroup extends UpdateableStringsContainer
} }
public boolean isRelevant() { public boolean isRelevant() {
return relevant == null || relevant.isTrue(); return relevant == null || relevant.isTrue(null); // null for topFormatProcessor (this value will not be used for other parameter value)
} }
public List<String> getParams() { public List<String> getParams() {
...@@ -111,7 +111,7 @@ public class ParamGroup extends UpdateableStringsContainer ...@@ -111,7 +111,7 @@ public class ParamGroup extends UpdateableStringsContainer
if(label == null) if(label == null)
label = paramGroup.label; label = paramGroup.label;
super.update(from); super.update(from,null);// null for topFormatProcessor (this value will not be used for other parameter value)
} }
} }
...@@ -229,18 +229,18 @@ public class Parameter implements Cloneable, Updateable { ...@@ -229,18 +229,18 @@ public class Parameter implements Cloneable, Updateable {
} }
public boolean isVisible() { public boolean isVisible() {
return resolveBooleanFieldValue(visible, "visible"); return resolveBooleanFieldValue(visible, "visible", null); // the value will not be used in other parameters, null is OK
} }
public boolean isReadOnly() { public boolean isReadOnly() {
return resolveBooleanFieldValue(readonly, "readonly"); return resolveBooleanFieldValue(readonly, "readonly", null); // the value will not be used in other parameters, null is OK
} }
// checks whether the passed id belongs to this param's id // checks whether the passed id belongs to this param's id
// it is only proper way to resolve parameter relevantness! // it is only proper way to resolve parameter relevantness!
public boolean isSame(String paramID) { public boolean isSame(String paramID) {
if(paramID.equals(id)) { if(paramID.equals(id)) {
if(relevant == null || relevant.isTrue()) if(relevant == null || relevant.isTrue(null))
return true; return true;
} }
...@@ -335,24 +335,24 @@ public class Parameter implements Cloneable, Updateable { ...@@ -335,24 +335,24 @@ public class Parameter implements Cloneable, Updateable {
return currentValue; return currentValue;
} }
public List<String> getDefaultValue() { public List<String> getDefaultValue(FormatProcessor topProcessor) {
return getDefaultValue(false); return getDefaultValue(false,topProcessor);
} }
public List<String> getDefaultValue(boolean menuMode) { public List<String> getDefaultValue(boolean menuMode,FormatProcessor topProcessor) {
String resolvedDefaultValue = ConditionUtils.resolveContextCondition(context, defaultValue); String resolvedDefaultValue = ConditionUtils.resolveContextCondition(context, defaultValue, topProcessor);
String errmsg = "Parameter '" + id + String errmsg = "Parameter '" + id +
"' of context '" + context.getName() + "' of context '" + context.getName() +
"' - error processing default value: "; "' - error processing default value: ";
List<String> processedDefaultValue = null; List<String> processedDefaultValue = null;
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor(new Recognizer[] { FormatProcessor processor = new FormatProcessor(new Recognizer[] {
//new RepeaterRecognizer(), //new RepeaterRecognizer(),
new SimpleGeneratorRecognizer(menuMode), new SimpleGeneratorRecognizer(menuMode),
new ContextParamListRecognizer(context) // Andrey: returning list as the source parameter new ContextParamListRecognizer(context, topProcessor) // Andrey: returning list as the source parameter
// new ContextParamRecognizer(context) // new ContextParamRecognizer(context)
}); }, topProcessor);
try { try {
processedDefaultValue = processor.process(resolvedDefaultValue); processedDefaultValue = processor.process(resolvedDefaultValue);
...@@ -482,19 +482,19 @@ public class Parameter implements Cloneable, Updateable { ...@@ -482,19 +482,19 @@ public class Parameter implements Cloneable, Updateable {
// returns current value if it is set // returns current value if it is set
// otherwise returns default value // otherwise returns default value
public List<String> getValue() { public List<String> getValue(FormatProcessor topProcessor) {
if(!currentValue.isEmpty()) if(!currentValue.isEmpty())
return currentValue; return currentValue;
return getDefaultValue(); return getDefaultValue(topProcessor);
} }
// returns external form of the current value unless it equals null; // returns external form of the current value unless it equals null;
// otherwise returns external form of the default value // otherwise returns external form of the default value
public List<String> getExternalValueForm() { public List<String> getExternalValueForm(FormatProcessor topProcessor) {
List<String> externalFormValue = new ArrayList<String>(); List<String> externalFormValue = new ArrayList<String>();
for(Iterator<String> i = getValue().iterator(); i.hasNext();) { for(Iterator<String> i = getValue(topProcessor).iterator(); i.hasNext();) {
String elem = type.toExternalForm((String)i.next()); String elem = type.toExternalForm((String)i.next());
if(elem == null) if(elem == null)
...@@ -514,9 +514,9 @@ public class Parameter implements Cloneable, Updateable { ...@@ -514,9 +514,9 @@ public class Parameter implements Cloneable, Updateable {
currentValue.clear(); currentValue.clear();
} }
public String[] getCommandLine() throws ToolException { public String[] getCommandLine(FormatProcessor topProcessor) throws ToolException {
String omit = getOmitValue(); String omit = getOmitValue(topProcessor);
List<String> value = getValue(); List<String> value = getValue(topProcessor);
if(value.size() == 1) { if(value.size() == 1) {
if(omit != null && type.equal(omit, value.get(0))) if(omit != null && type.equal(omit, value.get(0)))
...@@ -524,13 +524,13 @@ public class Parameter implements Cloneable, Updateable { ...@@ -524,13 +524,13 @@ public class Parameter implements Cloneable, Updateable {
} }
String format = syntax.getFormat(); String format = syntax.getFormat();
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor(new Recognizer[] { FormatProcessor processor = new FormatProcessor(new Recognizer[] {
new ParamFormatRecognizer(this), new ParamFormatRecognizer(this),
new ParamRepeaterRecognizer(this), new ParamRepeaterRecognizer(this),
new SimpleGeneratorRecognizer(), new SimpleGeneratorRecognizer(),
new RepeaterRecognizer(), new RepeaterRecognizer(),
}); },topProcessor);
List<String> commandLine = processor.process(format); List<String> commandLine = processor.process(format);
...@@ -628,14 +628,14 @@ public class Parameter implements Cloneable, Updateable { ...@@ -628,14 +628,14 @@ public class Parameter implements Cloneable, Updateable {
// private stuff below // private stuff below
// //
private String getOmitValue() { private String getOmitValue(FormatProcessor topProcessor) {
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor(new Recognizer[] { FormatProcessor processor = new FormatProcessor(new Recognizer[] {
new ContextParamRecognizer(context), new ContextParamRecognizer(context, topProcessor),
new SimpleGeneratorRecognizer() new SimpleGeneratorRecognizer()
}, }, false,topProcessor);
false);
String resolvedOmitValue = ConditionUtils.resolveContextCondition(context, omitValue); String resolvedOmitValue = ConditionUtils.resolveContextCondition(context, omitValue, topProcessor);
String result = null; String result = null;
if(resolvedOmitValue != null) { if(resolvedOmitValue != null) {
...@@ -649,8 +649,8 @@ public class Parameter implements Cloneable, Updateable { ...@@ -649,8 +649,8 @@ public class Parameter implements Cloneable, Updateable {
return result; return result;
} }
private boolean resolveBooleanFieldValue(String field, String fieldName) { private boolean resolveBooleanFieldValue(String field, String fieldName, FormatProcessor topProcessor) {
String fieldValue = ConditionUtils.resolveContextCondition(context, field); String fieldValue = ConditionUtils.resolveContextCondition(context, field, topProcessor);
if(!field.equals(fieldValue)) { if(!field.equals(fieldValue)) {
try { try {
......
...@@ -118,7 +118,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -118,7 +118,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
private String resultFile; // used to overwrite name of the default result file that normally private String resultFile; // used to overwrite name of the default result file that normally
// is calculated from result and timestamp; // is calculated from result and timestamp;
private String openState=null; // (only for open sessions) - last successful result ran in this session private String [] openState=null; // (only for open sessions) - last successful [name,result] ran in this session
private Tool openTool=null; // (only for open sessions) - tool last successful result ran in this session (null if none/failed) private Tool openTool=null; // (only for open sessions) - tool last successful result ran in this session (null if none/failed)
private Tool restoreMaster; // Tool, for which this one is restore (or null if for none). Same restore for private Tool restoreMaster; // Tool, for which this one is restore (or null if for none). Same restore for
// multiple masters is not allowed // multiple masters is not allowed
...@@ -294,7 +294,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -294,7 +294,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public List<String> getDependStateNames() { return dependStateNames; } public List<String> getDependStateNames() { return dependStateNames; }
public List<String> getDependFileNames() { return dependFileNames; } public List<String> getDependFileNames() { return dependFileNames; }
public boolean isDirty() { return dirty || !hashMatch(); } public boolean isDirty() { return dirty; }
public boolean isDirtyOrChanged() { public boolean isDirtyOrChanged() {
return isDirty() || !hashMatch(); return isDirty() || !hashMatch();
} }
...@@ -313,8 +313,14 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -313,8 +313,14 @@ public class Tool extends Context implements Cloneable, Inheritable {
public TOOL_STATE getState() { return state; } public TOOL_STATE getState() { return state; }
public boolean isPinned() { return pinned; } public boolean isPinned() { return pinned; }
public String getOpenState() { return openState; } public String getOpenStateName() { return (openState!=null)?openState[0]:null; }
public void setOpenState(String stateName) { openState=stateName;} public String getOpenStateFile() { return (openState!=null)?openState[1]:null; }
public void setOpenState(String stateName, String stateFile) {
if ((stateName!=null) && (stateFile!=null)) {
String [] pair={stateName, stateFile};
openState=pair;
}
}
public Tool getOpenTool() { return openTool; } public Tool getOpenTool() { return openTool; }
public void setOpenTool(Tool openTool) { this.openTool=openTool;} public void setOpenTool(Tool openTool) { this.openTool=openTool;}
...@@ -323,7 +329,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -323,7 +329,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public void setDirty(boolean dirty) { public void setDirty(boolean dirty) {
this.dirty=dirty; this.dirty=dirty;
// toolFinished(); // toolFinished();
System.out.println("SetDirty("+dirty+")"); System.out.println("SetDirty("+dirty+") tool:"+getName());
} }
public void setPinned(boolean pinned) { public void setPinned(boolean pinned) {
this.pinned=pinned; this.pinned=pinned;
...@@ -333,10 +339,28 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -333,10 +339,28 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
} }
public void setModeWait(
TOOL_MODE mode,
int choice,
String fullPath,
String ignoreFilter) {
setModeWait(new ToolWaitingArguments(
mode,
choice,
fullPath,
ignoreFilter));
}
public void setModeWait(ToolWaitingArguments toolWaitingArguments) { public void setModeWait(ToolWaitingArguments toolWaitingArguments) {
this.toolWaitingArguments = toolWaitingArguments; this.toolWaitingArguments = toolWaitingArguments;
setMode(TOOL_MODE.WAIT); setMode(TOOL_MODE.WAIT);
} }
public ToolWaitingArguments getToolWaitingArguments(){
return toolWaitingArguments;
}
public void setMode(TOOL_MODE mode) { public void setMode(TOOL_MODE mode) {
if (mode !=TOOL_MODE.WAIT) this.toolWaitingArguments = null; if (mode !=TOOL_MODE.WAIT) this.toolWaitingArguments = null;
...@@ -352,7 +376,10 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -352,7 +376,10 @@ public class Tool extends Context implements Cloneable, Inheritable {
setTimeStamp(); // copy current time to tool timestamp setTimeStamp(); // copy current time to tool timestamp
restoreTimeStamp=null; restoreTimeStamp=null;
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println(":::: Tool "+name+": setTimeStamp="+timeStamp); System.out.println("::::: Tool "+name+": setTimeStamp="+timeStamp);
if (name.equals("VivadoTimingReportSynthesis")){
System.out.println("Tool.setMode()");
}
} }
} else if (mode == TOOL_MODE.RESTORE){ } else if (mode == TOOL_MODE.RESTORE){
if (restoreMaster!=null){ if (restoreMaster!=null){
...@@ -381,7 +408,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -381,7 +408,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
this.state=state; this.state=state;
// toolFinished(); // toolFinished();
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("SetState("+state+")"); System.out.println("SetState("+state+") for tool "+getName());
} }
} }
...@@ -512,7 +539,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -512,7 +539,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public boolean isDisabled(){ public boolean isDisabled(){
if (abstractTool) return true; // abstract are always disabled if (abstractTool) return true; // abstract are always disabled
if (disabled==null) return false; if (disabled==null) return false;
List<String> values=disabled.getValue(); List<String> values=disabled.getValue(null); // null for topFormatProcessor
if ((values==null) || (values.size()==0)) return false; if ((values==null) || (values.size()==0)) return false;
return (!values.get(0).equals("true")); return (!values.get(0).equals("true"));
} }
...@@ -582,7 +609,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -582,7 +609,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
if ((dependFiles == null) || (dependFiles.size()==0)) return null; if ((dependFiles == null) || (dependFiles.size()==0)) return null;
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
for (Iterator<Parameter> iter= dependFiles.iterator(); iter.hasNext();) { for (Iterator<Parameter> iter= dependFiles.iterator(); iter.hasNext();) {
List<String> vList=iter.next().getValue(); List<String> vList=iter.next().getValue(null); // null for topFormatProcessor
if (vList!=null) { if (vList!=null) {
for (String item:vList){ for (String item:vList){
if ((item!=null) && (item.trim().length()>0)){ if ((item!=null) && (item.trim().length()>0)){
...@@ -599,7 +626,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -599,7 +626,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
if ((dependStates == null) || (dependStates.size()==0)) return null; if ((dependStates == null) || (dependStates.size()==0)) return null;
List<String> list = new ArrayList<String>(); List<String> list = new ArrayList<String>();
for (Iterator<Parameter> iter= dependStates.iterator(); iter.hasNext();) { for (Iterator<Parameter> iter= dependStates.iterator(); iter.hasNext();) {
List<String> vList=iter.next().getValue(); List<String> vList=iter.next().getValue(null); // null for topFormatProcessor
for (String item:vList){ for (String item:vList){
if ((item!=null) && (item.trim().length()>0)){ if ((item!=null) && (item.trim().length()>0)){
list.add(item.trim()); list.add(item.trim());
...@@ -647,7 +674,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -647,7 +674,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
"' is absent"); "' is absent");
} else if(!(autoSave.getType() instanceof ParamTypeBool)) { } else if(!(autoSave.getType() instanceof ParamTypeBool)) {
throw new ConfigException("Parameter autoSave='" + autoSaveString + throw new ConfigException("Parameter autoSave='" + autoSaveString +
"' defined in "+result.getSourceXML()+" used for tool '" + name + "' defined in "+autoSave.getSourceXML()+" used for tool '" + name +
"' must be of type '" + ParamTypeBool.NAME + "' must be of type '" + ParamTypeBool.NAME +
"'"); "'");
} }
...@@ -655,14 +682,14 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -655,14 +682,14 @@ public class Tool extends Context implements Cloneable, Inheritable {
public boolean getAutoSave(){ public boolean getAutoSave(){
if (autoSave==null) return false; if (autoSave==null) return false;
List<String>result=autoSave.getValue(); List<String>result=autoSave.getValue(null); // null for topFormatProcessor
if (!result.isEmpty()) return result.get(0).equals("true"); if (!result.isEmpty()) return result.get(0).equals("true");
return false; return false;
} }
public List<String> getResultNames(){ public List<String> getResultNames(){
if (result==null) return null; if (result==null) return null;
return result.getValue(); return result.getValue(null); // null for topFormatProcessor
} }
public void initRestore() throws ConfigException{ public void initRestore() throws ConfigException{
...@@ -716,9 +743,9 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -716,9 +743,9 @@ public class Tool extends Context implements Cloneable, Inheritable {
return saveTool; return saveTool;
} }
public Tool getSaveMaster(){ public Tool getSaveMaster(){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { // if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("getSaveMaster("+name+")-> "+((saveMaster==null)?"null":"NOT null")); // System.out.println("getSaveMaster("+name+")-> "+((saveMaster==null)?"null":"NOT null"));
} // }
return saveMaster; return saveMaster;
} }
...@@ -775,7 +802,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -775,7 +802,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public String getLogDir() {return getLogDir(true); } public String getLogDir() {return getLogDir(true); }
public String getLogDir(boolean first) { public String getLogDir(boolean first) {
if (logDir!=null) { // has logDir specified, but may be empty if (logDir!=null) { // has logDir specified, but may be empty
List<String> value=logDir.getValue(); List<String> value=logDir.getValue(null); // null for topFormatProcessor
if (value.size()==0) return null; // overwrites with empty if (value.size()==0) return null; // overwrites with empty
return value.get(0); return value.get(0);
} }
...@@ -788,7 +815,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -788,7 +815,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public String getStateDir() {return getStateDir(true); } public String getStateDir() {return getStateDir(true); }
public String getStateDir(boolean first) { public String getStateDir(boolean first) {
if (stateDir!=null) { // has stateDir specified, but may be empty if (stateDir!=null) { // has stateDir specified, but may be empty
List<String> value=stateDir.getValue(); List<String> value=stateDir.getValue(null); // null for topFormatProcessor
if (value.size()==0) return null; // overwrites with empty if (value.size()==0) return null; // overwrites with empty
return value.get(0); return value.get(0);
} }
...@@ -1021,12 +1048,12 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1021,12 +1048,12 @@ public class Tool extends Context implements Cloneable, Inheritable {
public String[] getExtensions() { public String[] getExtensions() {
if(extensions == null) if(extensions == null)
return null; return null;
FormatProcessor topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor( FormatProcessor processor = new FormatProcessor(
new Recognizer[] { new Recognizer[] {
new ContextParamRecognizer(this), new ContextParamRecognizer(this,topProcessor),
// new SimpleGeneratorRecognizer() // Andrey: Trying // new SimpleGeneratorRecognizer() // Andrey: Trying
}); },topProcessor); // null for topFormatProcessor - this generator can not reference other parameters
String[] actualExtensions = new String[extensions.size()]; String[] actualExtensions = new String[extensions.size()];
...@@ -1054,13 +1081,13 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1054,13 +1081,13 @@ public class Tool extends Context implements Cloneable, Inheritable {
// Can be two different processors for labels and resources // Can be two different processors for labels and resources
//SimpleGeneratorRecognizer(true) may be not needed, as current file is already set here //SimpleGeneratorRecognizer(true) may be not needed, as current file is already set here
FormatProcessor topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor( FormatProcessor processor = new FormatProcessor(
new Recognizer[] { new Recognizer[] {
new ContextParamRecognizer(this), new ContextParamRecognizer(this,topProcessor),
new SimpleGeneratorRecognizer(true) // in menuMode new SimpleGeneratorRecognizer(true) // in menuMode
// new SimpleGeneratorRecognizer(false) // in menuMode // new SimpleGeneratorRecognizer(false) // in menuMode
}); },topProcessor); // null for topFormatProcessor - this generator can not reference other parameters
RunFor[] actualActions = new RunFor[runfor.size()]; RunFor[] actualActions = new RunFor[runfor.size()];
...@@ -1095,12 +1122,13 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1095,12 +1122,13 @@ public class Tool extends Context implements Cloneable, Inheritable {
// Should be called after getMenuActions to have updateContextOptions() already ran // Should be called after getMenuActions to have updateContextOptions() already ran
public String getIgnoreFilter(){ // calculate and get public String getIgnoreFilter(){ // calculate and get
if (ignoreFilter==null) return null; if (ignoreFilter==null) return null;
FormatProcessor topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor( FormatProcessor processor = new FormatProcessor(
new Recognizer[] { new Recognizer[] {
new ContextParamRecognizer(this), new ContextParamRecognizer(this,topProcessor),
new SimpleGeneratorRecognizer(true) // in menuMode new SimpleGeneratorRecognizer(true) // in menuMode
// new SimpleGeneratorRecognizer(false) // in menuMode // new SimpleGeneratorRecognizer(false) // in menuMode
}); },topProcessor); // null for topFormatProcessor - this generator can not reference other parameters
List<String> results=null; List<String> results=null;
try { try {
results=processor.process(ignoreFilter); results=processor.process(ignoreFilter);
...@@ -1223,7 +1251,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1223,7 +1251,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public BuildParamsItem[] buildParams(boolean dryRun) throws ToolException { public BuildParamsItem[] buildParams(boolean dryRun) throws ToolException {
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("tool "+getName()+" state="+getState()+" dirty="+isDirty()+" pinned="+isPinned()+" dryRun="+dryRun); System.out.println("buildParams("+dryRun+"): tool "+getName()+" state="+getState()+" dirty="+isDirty()+" hashMatch()="+hashMatch()+" pinned="+isPinned());
} }
if(parentPackage != null) if(parentPackage != null)
...@@ -1241,17 +1269,18 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1241,17 +1269,18 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
protected List<String> buildCommandString(String paramStringTemplate) protected List<String> buildCommandString(String paramStringTemplate, FormatProcessor topProcessor)
throws ToolException throws ToolException
{ {
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor(new Recognizer[] { FormatProcessor processor = new FormatProcessor(new Recognizer[] {
new ToolParamRecognizer(this), new ToolParamRecognizer(this,topProcessor),
// new SimpleGeneratorRecognizer(), // new SimpleGeneratorRecognizer(),
new SimpleGeneratorRecognizer(this), new SimpleGeneratorRecognizer(this),
new RepeaterRecognizer(), new RepeaterRecognizer(),
new ContextParamRecognizer(this), new ContextParamRecognizer(this,topProcessor),
new ContextParamRepeaterRecognizer(this) new ContextParamRepeaterRecognizer(this)
}); }, topProcessor); // topFormatProcessor=null: this value will not be used as other parameter value
return processor.process(paramStringTemplate); return processor.process(paramStringTemplate);
} }
...@@ -1397,7 +1426,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -1397,7 +1426,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
// //
private String getResolvedExeName() { private String getResolvedExeName() {
return ConditionUtils.resolveContextCondition(this, exeName); return ConditionUtils.resolveContextCondition(this, exeName, null); // null for topFormatProcessor
} }
/* /*
private String getResolvedShellName() { private String getResolvedShellName() {
......
...@@ -22,7 +22,6 @@ import org.eclipse.core.resources.IFolder; ...@@ -22,7 +22,6 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IActionBars; import org.eclipse.ui.IActionBars;
...@@ -30,12 +29,12 @@ import org.eclipse.ui.IMemento; ...@@ -30,12 +29,12 @@ import org.eclipse.ui.IMemento;
import com.elphel.vdt.Txt; import com.elphel.vdt.Txt;
import com.elphel.vdt.VDT; import com.elphel.vdt.VDT;
import com.elphel.vdt.VerilogUtils;
import com.elphel.vdt.core.launching.LaunchCore; import com.elphel.vdt.core.launching.LaunchCore;
import com.elphel.vdt.core.launching.ToolLogFile; import com.elphel.vdt.core.launching.ToolLogFile;
import com.elphel.vdt.core.tools.ToolsCore; import com.elphel.vdt.core.tools.ToolsCore;
import com.elphel.vdt.core.tools.params.Tool.TOOL_MODE; import com.elphel.vdt.core.tools.params.Tool.TOOL_MODE;
import com.elphel.vdt.core.tools.params.Tool.TOOL_STATE; import com.elphel.vdt.core.tools.params.Tool.TOOL_STATE;
import com.elphel.vdt.core.tools.params.Tool.ToolWaitingArguments;
import com.elphel.vdt.ui.MessageUI; import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.ui.options.FilteredFileSelector; import com.elphel.vdt.ui.options.FilteredFileSelector;
import com.elphel.vdt.ui.variables.SelectedResourceManager; import com.elphel.vdt.ui.variables.SelectedResourceManager;
...@@ -45,10 +44,12 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings; ...@@ -45,10 +44,12 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class ToolSequence { public class ToolSequence {
...@@ -64,12 +65,13 @@ public class ToolSequence { ...@@ -64,12 +65,13 @@ public class ToolSequence {
private static final String TAG_CURRENTSTATE_STATEFILE = ".currentState.stateFile."; private static final String TAG_CURRENTSTATE_STATEFILE = ".currentState.stateFile.";
private static final String TAG_CURRENTSTATE_TOOLSTAMP = ".currentState.toolStamp."; private static final String TAG_CURRENTSTATE_TOOLSTAMP = ".currentState.toolStamp.";
// private static final int MAX_TOOLS_TO_RUN=100;
private boolean shiftPressed=false; private boolean shiftPressed=false;
private DesignFlowView designFlowView; private DesignFlowView designFlowView;
private boolean stopOn; // Stop button is pressed private boolean stopOn; // Stop button is pressed
private boolean saveOn; // save button is on private boolean saveOn; // save button is on
private Map<String,Tool> stateProvides; private Map<String,Set<Tool>> stateProviders;
private Map<String,ToolStateStamp> currentStates; private Map<String,ToolStateStamp> currentStates;
private IMemento unfinishedMemento=null; private IMemento unfinishedMemento=null;
private String menuName=null; private String menuName=null;
...@@ -100,8 +102,6 @@ public class ToolSequence { ...@@ -100,8 +102,6 @@ public class ToolSequence {
designFlowView.finalizeAfterVEditorDB(unfinishedMemento); designFlowView.finalizeAfterVEditorDB(unfinishedMemento);
} }
} }
public void toolFinished(Tool tool){ public void toolFinished(Tool tool){
doToolFinished(tool); doToolFinished(tool);
...@@ -121,7 +121,7 @@ public class ToolSequence { ...@@ -121,7 +121,7 @@ public class ToolSequence {
} }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("\nTool "+tool.getName()+" FINISHED , state="+tool.getState()+", mode="+tool.getLastMode()); System.out.println("\nTool "+tool.getName()+" FINISHED , state="+tool.getState()+", mode="+tool.getLastMode());
if (tool.getState()==TOOL_STATE.SUCCESS){ if ((tool.getState()==TOOL_STATE.SUCCESS) || (tool.getState()==TOOL_STATE.KEPT_OPEN)){
// Update state of the session(s) - should be done after run or restore // Update state of the session(s) - should be done after run or restore
if ((tool.getLastMode()==TOOL_MODE.RUN) || (tool.getLastMode()==TOOL_MODE.RESTORE)){ if ((tool.getLastMode()==TOOL_MODE.RUN) || (tool.getLastMode()==TOOL_MODE.RESTORE)){
boolean sessionUpdated=updateSessionTools(tool); // Update state boolean sessionUpdated=updateSessionTools(tool); // Update state
...@@ -132,7 +132,7 @@ public class ToolSequence { ...@@ -132,7 +132,7 @@ public class ToolSequence {
restoreToolProperties(tool);// set last run hashcode and timestamp for the tool just restored restoreToolProperties(tool);// set last run hashcode and timestamp for the tool just restored
if (tool.getRestoreMaster()!=null) tool.setPinned(true); if (tool.getRestoreMaster()!=null) tool.setPinned(true);
else { else {
System.out.println("Pribably a bug - tool.getRestoreMaster()==null for "+tool.getName()+", while state is "+tool.getState()); System.out.println("Probably a bug - tool.getRestoreMaster()==null for "+tool.getName()+", while state is "+tool.getState());
tool.setPinned(true); // restored state should be pinned? tool.setPinned(true); // restored state should be pinned?
} }
} }
...@@ -142,7 +142,16 @@ public class ToolSequence { ...@@ -142,7 +142,16 @@ public class ToolSequence {
if (tool.getLastMode()==TOOL_MODE.RUN) { if (tool.getLastMode()==TOOL_MODE.RUN) {
setDependState(tool); setDependState(tool);
} }
setToolsDirtyFlag(false); // no need to recalculate all parameters here setToolsDirtyFlag(false); // no need to recalculate all parameters here
// if (SelectedResourceManager.getDefault().isToolsLinked()) {
// System.out.println("===Propagating 'dirty' flags to dependent non-pinned tools");
// propagateDirty();
// }
if (isStop()){
releaseStop();
System.out.println("Stop was ctivated");
return; // do nothing more
}
// Check for stop here // Check for stop here
if ((tool.getLastMode()==TOOL_MODE.RUN) || (tool.getLastMode()==TOOL_MODE.SAVE)){ if ((tool.getLastMode()==TOOL_MODE.RUN) || (tool.getLastMode()==TOOL_MODE.SAVE)){
...@@ -150,44 +159,269 @@ public class ToolSequence { ...@@ -150,44 +159,269 @@ public class ToolSequence {
} }
getToolsToSave(); // find if there are any sessions in unsaved state - returns list (not yet processed) getToolsToSave(); // find if there are any sessions in unsaved state - returns list (not yet processed)
if (tryAutoSave(tool)) return; // started autoSave that will trigger "toolFinished" again if (tryAutoSave(tool)) return; // started autoSave that will trigger "toolFinished" again
} else if (tool.getState()==TOOL_STATE.KEPT_OPEN){ // Got here after launching a session if (continueRunningTools()) return; // started next needed tool
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) // will get here if no more tools to run or failed to find one
System.out.println("\nTool "+tool.getName()+" kept open , state="+tool.getState()+", mode="+tool.getLastMode()); Tool waitingTool=findWaitingTool();
if (waitingTool==null){
System.out.println("No tool is waiting to run, all done.");
return;
} else {
waitingTool.setState(TOOL_STATE.FAILURE); // should state be set to FAILURE?
waitingTool.setMode(TOOL_MODE.STOP);
String msg="Failed to find a tool to run for "+waitingTool.getName();
System.out.println(msg);
MessageUI.error(msg);
}
// } else if (tool.getState()==TOOL_STATE.KEPT_OPEN){ // Got here after launching a session
// if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
// System.out.println("\nTool "+tool.getName()+" kept open , state="+tool.getState()+", mode="+tool.getLastMode());
} else { // Process failures here } else { // Process failures here
//Turn off any Waiting tool
Tool waitingTool=findWaitingTool();
if (waitingTool!=null){
waitingTool.setState(TOOL_STATE.FAILURE); // should state be set to FAILURE?
waitingTool.setMode(TOOL_MODE.STOP);
}
}
}
private boolean continueRunningTools(){
if (SelectedResourceManager.getDefault().isToolsLinked()){
Tool reportTool=findReportTool();
if (reportTool!=null){
// Launch report tool that can be ran from the current state
try {
launchNextTool(reportTool);
} catch (CoreException e) {
String msg="Failed to launch reportTool "+reportTool.getName()+" e="+e;
System.out.println(msg);
MessageUI.error(msg);
return false;
}
return true; // launched report tool
}
Tool waitingTool=findWaitingTool();
if (waitingTool!=null){
// prevent recursion - limit number of steps to the total number of tools (each should run once at most ?)
Tool nextTool=findToolToLaunch(waitingTool,ToolsCore.getConfig().getContextManager().getToolList().size());
if (nextTool!=null){
try {
launchNextTool(nextTool);
} catch (CoreException e) {
String msg="Failed to launch next tool "+nextTool.getName()+" e="+e;
System.out.println(msg);
MessageUI.error(msg);
return false;
}
return true; // launched next tool
}
return false; // failed to find tool to launch
}
return false; // nothing to do - no tool was waiting
} else {
return false; // tools are not linked
} }
} }
public void launchNextTool(Tool tool) throws CoreException {
// if (!okToRun()) return;
// setStateProvides(); // just testing
tool.setDesignFlowView(designFlowView); // maybe will not be needed with ToolSequencing class
if (tool.isWaiting()){
ToolWaitingArguments twa=tool.getToolWaitingArguments();
if (twa!=null){
SelectedResourceManager.getDefault().updateActionChoice(
twa.getFullPath(), //fullPath,
twa.getChoice(), // choice,
twa.getIgnoreFilter()); //ignoreFilter);
tool.setMode(twa.getMode()) ; //TOOL_MODE.RUN);
tool.setChoice(twa.getChoice());
LaunchCore.launch( tool,
SelectedResourceManager.getDefault().getSelectedProject(),
twa.getFullPath(),
null); // run, not playback
return;
}
}
tool.setMode(TOOL_MODE.RUN) ; //TOOL_MODE.RUN);
// tool.toolFinished();
tool.setChoice(0);
// SelectedResourceManager.getDefault().updateActionChoice(fullPath, choice, ignoreFilter); // Andrey
// SelectedResourceManager.getDefault().setBuildStamp(); // Andrey
// apply designFlowView to the tool itself
LaunchCore.launch( tool,
SelectedResourceManager.getDefault().getSelectedProject(),
SelectedResourceManager.getDefault().getChosenTarget(),
null); // run, not playback
} // launchTool()
/** /**
* Find which tool to run to satisfy dependency of the specified tool (may be recursive - make sure no loops) * Find which tool to run to satisfy dependency of the specified tool (may be recursive - make sure no loops)
* @param tool tool to satisfy dependency for * @param tool tool to satisfy dependency for
* @param numSteps Maximal number of tools to run automatically (to prevent recursion)
* @return tool to run or null - failed to find any * @return tool to run or null - failed to find any
*/ */
private Tool findToolToLaunch(Tool tool, boolean launchSessions){ // TODO: support session-less states
private Tool findToolToLaunch(Tool tool, int numSteps){
if (numSteps<0){
MessageUI.error("Maximal number of tool steps exceeded");
return null;
}
// get list of states of the open sessions
List<Tool> sessions=getOpenSessions();
Map<String,String> openStates=new ConcurrentHashMap<String,String>();
for (Tool session:sessions){
if (session.getOpenStateName() != null) openStates.put(session.getOpenStateName(),session.getOpenStateFile());
}
// First see if all the state dependencies are met
List<String> depStates=tool.getDependStates();
// restore tools should not have any dependencies but console, check it here just in case
if (!tool.isPinned() && (depStates!=null) && (tool.getRestoreMaster()==null)) for (String state:depStates){
// see if the state is available, good and not dirty
System.out.println("findToolToLaunch("+tool.getName()+" state= "+state);
ToolStateStamp tss=currentStates.get(state);
// Check that this state provider
if (tss!=null){
System.out.println("State "+state+" tss.toolName="+tss.toolName+" tss.toolStateFile="+tss.toolStateFile+" tss.toolStamp="+tss.toolStamp );
if ((tss.getToolName()!=null) ){
Tool depTool=ToolsCore.getContextManager().findTool(tss.getToolName());
if ((depTool.getState()==TOOL_STATE.SUCCESS) &&
(depTool.isPinned() || !depTool.isDirtyOrChanged())){
System.out.println("depTool= "+depTool.getName());
// dependency satisfied, but is this state current for some session?
for (String osn:openStates.keySet()){
System.out.println("-- openStateName="+osn+" state="+state); // openState - with ts, state - link
}
if (openStates.keySet().contains(state)){
continue; // dependency satisfied and the state is open
} else {
// The state was achieved, but it is not current. Try restore tool if possible
System.out.println("State "+state+" was previously achieved, but it is not current - will need to restore/re-run");
// just do nothing here and fall through to tss be set to null ?
}
}
}
tss=null; // missing or dirty tool - will need to re-run
}
if (tss==null){
System.out.println("State "+state+" is not available");
if (stateProviders.containsKey(state)){
Set<Tool> providersSet=stateProviders.get(state);
for (Tool provider:providersSet){
if (!provider.isDisabled()){
System.out.println("For wanted tool "+tool.getName()+
" using tool "+provider.getName()+
" to get needed state "+state);
return findToolToLaunch(provider, numSteps-1);
}
}
MessageUI.error("Could not find enabled tool to provide state "+state);
System.out.println("Could not find enabled tool to provide state "+state);
return null;
} else {
MessageUI.error("No tool provide state "+state);
System.out.println("No tool provide state "+state);
return null;
}
}
}
// Got here if all state dependencies are met (or there are none)
// Does the tool need a console that needs to be started?
List<Tool> consoleTools= getUsedConsoles(tool); List<Tool> consoleTools= getUsedConsoles(tool);
if (launchSessions) for (Tool consoleTool:consoleTools){ // or maybe do it after other dependencies? for (Tool consoleTool:consoleTools){ // or maybe do it after other dependencies?
if (consoleTool.getState()!=TOOL_STATE.KEPT_OPEN) { if (consoleTool.getState()!=TOOL_STATE.KEPT_OPEN) {
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER)) {
System.out.println("Need to launch tool"+consoleTool.getName()+" to satisfy dependencies of tool "+tool.getName()); System.out.println("Need to launch tool"+consoleTool.getName()+" to satisfy dependencies of tool "+tool.getName());
} }
return consoleTool; return consoleTool; // start the console session
} }
} }
// All session tools are running // everything is met to run this tool. Can we just restore it instead (only if it is not in WAIT state)
return null; if (tool.isWaiting()){
System.out.println("OK to run waiting tool "+tool.getName());
return tool;
}
if ((tool.getRestore()!=null) &&
(tool.isPinned() || !tool.isDirtyOrChanged()) &&
(tool.getState() == TOOL_STATE.SUCCESS)){
System.out.println("Try to restore tool "+tool.getName()+" using "+tool.getRestore());
return tool.getRestore();
}
System.out.println("All cleared to run "+tool.getName());
return tool;
}
/**
* Find enabled tool that can be ran from the current state without changing it (such as various reports)
* and is "dirty" or never ran
* @return found tool to launch or null
*/
private Tool findReportTool(){
// get open session(s)
List<Tool> sessions=getOpenSessions();
if (sessions.size()==0) return null;
Map<String,String> openStates=new ConcurrentHashMap<String,String>();
for (Tool session:sessions){
if (session.getOpenStateName() != null) openStates.put(session.getOpenStateName(),session.getOpenStateFile());
}
if (openStates.size()==0) return null;
for (Tool tool:ToolsCore.getConfig().getContextManager().getToolList()){
if (
tool.isDisabled() || // disabled tool (or abstract)
(tool.getSaveMaster()!=null) || // Is Save tool
(tool.getRestoreMaster()!=null) || // or is Restore tool
(tool.getStateLink()!=null)) { // or changes output state(s)
continue;
}
// already good and nothing changed?
if (
(tool.getState()==TOOL_STATE.SUCCESS) && !tool.isDirtyOrChanged()){
continue;
}
// dependencies met (and do exist)?
List<String> depStates=tool.getDependStates();
if ((depStates==null) || (depStates.size()==0)){
continue; // no dependencies at all;
}
boolean met=true;
for (String state:depStates){
if (!openStates.keySet().contains(state)){
met=false;
break;
}
}
if (!met) {
continue; // dependencies not among open session states (TODO: what about non-session states?
}
return tool; // All checks passed, return this tool
}
return null; // Nothing found
} }
/** /**
* Setup what tools can provide needed states * Setup what tools can provide needed states
*/ */
public void setStateProvides(){ public void setStateProvides(){
stateProvides=new ConcurrentHashMap<String,Tool>(); stateProviders=new ConcurrentHashMap<String,Set<Tool>>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){ for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
System.out.println("Looking for all states defined, tool= "+tool.getName()); System.out.println("Looking for all states defined, tool= "+tool.getName());
if (!tool.isDisabled()){ if (!tool.isDisabled()){
String state=tool.getStateLink(); // some tools (like reports) do not change states String state=tool.getStateLink(); // some tools (like reports) do not change states
if (state!=null) stateProvides.put(state,tool); if (state!=null) {
// stateProviders.putIfAbsent(state,(Set<Tool>) new HashSet<Tool>());
if (!stateProviders.containsKey(state)){
stateProviders.put(state,(Set<Tool>) new HashSet<Tool>());
}
stateProviders.get(state).add(tool);
}
} }
} }
// Verify that each dependent state has a provider // Verify that each dependent state has a provider
...@@ -197,7 +431,7 @@ public class ToolSequence { ...@@ -197,7 +431,7 @@ public class ToolSequence {
List<String> dependStates=tool.getDependStates(); List<String> dependStates=tool.getDependStates();
if ((dependStates!=null) && (dependStates.size()>0)){ if ((dependStates!=null) && (dependStates.size()>0)){
for (String state:dependStates){ for (String state:dependStates){
if (!stateProvides.containsKey(state)){ if (!stateProviders.containsKey(state)){
MessageUI.error("No tool provide output state '"+state+"' needed to satisfy dependency of the tool "+tool.getName()); MessageUI.error("No tool provide output state '"+state+"' needed to satisfy dependency of the tool "+tool.getName());
System.out.println("No tool provide output state '"+state+"' needed to satisfy dependency of the tool "+tool.getName()); System.out.println("No tool provide output state '"+state+"' needed to satisfy dependency of the tool "+tool.getName());
} }
...@@ -207,7 +441,7 @@ public class ToolSequence { ...@@ -207,7 +441,7 @@ public class ToolSequence {
} }
// List<String> list = new ArrayList<String>(hashset); // List<String> list = new ArrayList<String>(hashset);
System.out.println("Got "+stateProvides.keySet().size()+" different states, number of mappings="+stateProvides.keySet().size()); System.out.println("Got "+stateProviders.keySet().size()+" different states, number of mappings="+stateProviders.keySet().size());
// For each state - find latest tool that made it // For each state - find latest tool that made it
...@@ -230,11 +464,21 @@ public class ToolSequence { ...@@ -230,11 +464,21 @@ public class ToolSequence {
tool.setChoice(0); tool.setChoice(0);
SelectedResourceManager.getDefault().updateActionChoice(fullPath, choice, ignoreFilter); // Andrey SelectedResourceManager.getDefault().updateActionChoice(fullPath, choice, ignoreFilter); // Andrey
SelectedResourceManager.getDefault().setBuildStamp(); // Andrey SelectedResourceManager.getDefault().setBuildStamp(); // Andrey
// apply designFlowView to the tool itself if (((mode==TOOL_MODE.RUN) || (mode==TOOL_MODE.RESTORE)) && SelectedResourceManager.getDefault().isToolsLinked()){
LaunchCore.launch( tool, tool.setModeWait(
SelectedResourceManager.getDefault().getSelectedProject(), mode,
fullPath, choice,
null); // run, not playback fullPath,
ignoreFilter);
if (!continueRunningTools()){
System.out.println("Failed to initiate continueRunningTools() for tool="+tool.getName());
}
} else {
LaunchCore.launch( tool,
SelectedResourceManager.getDefault().getSelectedProject(),
fullPath,
null); // run, not playback
}
} // launchTool() } // launchTool()
// TODO: restore "working copy" functionality here to be able to play back logs while tools are running // TODO: restore "working copy" functionality here to be able to play back logs while tools are running
...@@ -296,9 +540,30 @@ public class ToolSequence { ...@@ -296,9 +540,30 @@ public class ToolSequence {
stopAllRunnig(); stopAllRunnig();
} }
} }
public void releaseStop(){
this.stopOn=false;
designFlowView.setToggleStopTools(false);
}
public void setSave(boolean pressed){ public void setSave(boolean pressed){
this.saveOn=pressed; this.saveOn=pressed;
if (saveOn){
List<Tool> toolsToSave=getToolsToSave(); // find if there are any sessions in unsaved state - returns list (not yet processed)
if ((toolsToSave==null) || (toolsToSave.size()==0)){
System.out.println("Nothing to save - how was the button pressed?");
releaseSave();
return;
}
tryAutoSave(toolsToSave.get(0)); // launch autosave and trigger toolFinished() when done
}
} }
public void releaseSave(){
this.saveOn=false;
designFlowView.setToggleSaveTools(false);
}
public boolean isStop(){ public boolean isStop(){
return stopOn; return stopOn;
} }
...@@ -313,12 +578,11 @@ public class ToolSequence { ...@@ -313,12 +578,11 @@ public class ToolSequence {
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
List<Tool> sessionList=new ArrayList<Tool>(); List<Tool> sessionList=new ArrayList<Tool>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){ for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
System.out.println("Looking for open console: "+tool.getName()+ // System.out.println("Looking for open console: "+tool.getName()+ " state="+tool.getState());
" state="+tool.getState());
if ( if (
(tool.getState()==TOOL_STATE.KEPT_OPEN) && (tool.getState()==TOOL_STATE.KEPT_OPEN) &&
(tool.getOpenTool()!=null) && (tool.getOpenTool()!=null) &&
(tool.getOpenState()!=null)){ (tool.getOpenStateFile()!=null)){
// See if state file is not saved // See if state file is not saved
Tool ranTool=tool.getOpenTool(); Tool ranTool=tool.getOpenTool();
String stateDirString=ranTool.getStateDir(); String stateDirString=ranTool.getStateDir();
...@@ -333,9 +597,20 @@ public class ToolSequence { ...@@ -333,9 +597,20 @@ public class ToolSequence {
} }
IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString); IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString);
IFile link= stateDir.getFile(linkString); // null IFile link= stateDir.getFile(linkString); // null
IFile target= stateDir.getFile(tool.getOpenState()); IFile target= stateDir.getFile(tool.getOpenStateFile());
System.out.println("****link.getRawLocation()= "+link.getRawLocation().toString()); System.out.println("*****link.getRawLocation()= "+link.getRawLocation().toString());
System.out.println("****target.getLocation()= "+target.getLocation().toString()); System.out.println("******target.getLocation()= "+target.getLocation().toString());
// Debug
try {
Map<QualifiedName,String> allPP= target.getPersistentProperties();
System.out.println("1. Getting persistent properties from properties from "+target.getLocation().toOSString()+" / "+tool.getOpenStateFile());
for (QualifiedName qn:allPP.keySet()){
System.out.println("... "+qn.toString()+": "+allPP.get(qn));
}
} catch (CoreException e2) {
System.out.println("Failed to get persistent properties from "+target.getLocation().toOSString());
}
sessionList.add(tool); sessionList.add(tool);
} }
} }
...@@ -361,7 +636,7 @@ public class ToolSequence { ...@@ -361,7 +636,7 @@ public class ToolSequence {
if ( if (
(tool.getState()==TOOL_STATE.KEPT_OPEN) && (tool.getState()==TOOL_STATE.KEPT_OPEN) &&
(tool.getOpenTool()!=null) && (tool.getOpenTool()!=null) &&
(tool.getOpenState()!=null)){ (tool.getOpenStateFile()!=null)){
// See if state file is not saved // See if state file is not saved
Tool ranTool=tool.getOpenTool(); Tool ranTool=tool.getOpenTool();
String stateDirString=ranTool.getStateDir(); String stateDirString=ranTool.getStateDir();
...@@ -376,13 +651,24 @@ public class ToolSequence { ...@@ -376,13 +651,24 @@ public class ToolSequence {
} }
IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString); IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString);
IFile link= stateDir.getFile(linkString); // null IFile link= stateDir.getFile(linkString); // null
IFile target= stateDir.getFile(tool.getOpenState()); IFile target= stateDir.getFile(tool.getOpenStateFile());
System.out.println("****link.getRawLocation()= "+link.getRawLocation().toString()); System.out.println("**link.getRawLocation()= "+link.getRawLocation().toString());
System.out.println("****target.getLocation()= "+target.getLocation().toString()); System.out.println("***target.getLocation()= "+target.getLocation().toString());
if (!link.getRawLocation().toString().equals(target.getLocation().toString())){ if (!link.getRawLocation().toString().equals(target.getLocation().toString())){
saveToolsList.add(ranTool); saveToolsList.add(ranTool);
System.out.println("****Adding= "+ranTool.getName()); System.out.println("****Adding= "+ranTool.getName());
} }
// Debug
try {
Map<QualifiedName,String> allPP= target.getPersistentProperties();
System.out.println("2. Getting persistent properties from properties from "+target.getLocation().toOSString()+" / "+tool.getOpenStateFile());
for (QualifiedName qn:allPP.keySet()){
System.out.println("... "+qn.toString()+": "+allPP.get(qn));
}
} catch (CoreException e2) {
System.out.println("Failed to get persistent properties from "+target.getLocation().toOSString());
}
} }
} }
return saveToolsList; return saveToolsList;
...@@ -390,20 +676,29 @@ public class ToolSequence { ...@@ -390,20 +676,29 @@ public class ToolSequence {
//TODO: make possible to run multiple tools async if they do not share common session //TODO: make possible to run multiple tools async if they do not share common session
public boolean isAnyToolRunnigOrWaiting(){ public boolean isAnyToolRunnigOrWaiting(){
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here // IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
List<Tool> saveToolsList=new ArrayList<Tool>(); // List<Tool> saveToolsList=new ArrayList<Tool>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){ for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
if (tool.isRunning() || tool.isWaiting()) return true; if (tool.isRunning() || tool.isWaiting()) return true;
} }
return false; return false;
} }
private Tool findWaitingTool(){
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
if (tool.isWaiting()) return tool;
}
return null;
}
// call when double-click on stop? // call when double-click on stop?
public void stopAllRunnig(){ // does not actually stop - just marks as if stopped for debug purposes public void stopAllRunnig(){ // does not actually stop - just marks as if stopped for debug purposes
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here // IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
List<Tool> saveToolsList=new ArrayList<Tool>(); // List<Tool> saveToolsList=new ArrayList<Tool>();
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){ for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
if (tool.isRunning()) { if (tool.isRunning() || tool.isWaiting()) {
tool.setState(TOOL_STATE.FAILURE); tool.setState(TOOL_STATE.FAILURE);
tool.setMode(TOOL_MODE.STOP); tool.setMode(TOOL_MODE.STOP);
} }
...@@ -413,22 +708,40 @@ public class ToolSequence { ...@@ -413,22 +708,40 @@ public class ToolSequence {
public boolean restoreToolProperties(Tool tool){ public boolean restoreToolProperties(Tool tool){
if (tool.getLastMode()!=TOOL_MODE.RESTORE) return false; if (tool.getLastMode()!=TOOL_MODE.RESTORE) return false;
if (tool.getRestoreMaster()!=null) tool=tool.getRestoreMaster(); String targetString=tool.getStateFile(); // With timestamp or specifically set through selection
if (tool.getRestoreMaster()!=null) {
// System.out.println("restoreToolProperties("+tool.getName()+") tool.getRestoreMaster()="+tool.getRestoreMaster().getName()+" tool.getStateFile()="+tool.getStateFile());
// System.out.println("tool.getRestoreMaster().getStateFile()="+tool.getRestoreMaster().getStateFile());
// targetString=tool.getResultName(); // after restore this is the actual file name
targetString=tool.getStateFile();
System.out.println("targetString="+targetString+" tool.getName()="+tool.getName()+"tool.getRestoreMaster().getName()="+tool.getRestoreMaster().getName());
tool=tool.getRestoreMaster();
}
else { else {
System.out.println("Tool "+tool.getName()+" does not have restoreMaster, but it came with getLastMode()!=TOOL_MODE.RESTORE"); System.out.println("Tool "+tool.getName()+" does not have restoreMaster, but it came with getLastMode()!=TOOL_MODE.RESTORE");
} }
String stateDirString=tool.getStateDir(); String stateDirString=tool.getStateDir();
// String linkString=tool.getStateLink(); System.out.println("Tool "+tool.getName()+" getStateDir()="+tool.getStateDir());
String targetString=tool.getStateFile(); // With timestamp or specifically set through selection
IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here IProject project = SelectedResourceManager.getDefault().getSelectedProject(); // should not be null when we got here
IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString); IFolder stateDir= project.getFolder((stateDirString==null)?"":stateDirString);
// Create file for target and see if it actually exists // Create file for target and see if it actually exists
IFile target= stateDir.getFile(targetString); IFile target= stateDir.getFile(targetString); //null po
if (!target.exists()){ if (!target.exists()){
System.out.println("BUG: file that was just restored does not exist: "+ System.out.println("BUG: file that was just restored does not exist: "+
target.getLocation().toOSString()); target.getLocation().toOSString());
return false; return false;
} }
// Debug
try {
Map<QualifiedName,String> allPP= target.getPersistentProperties();
System.out.println("3. Getting persistent properties from properties from "+target.getLocation().toOSString()+" / "+targetString);
for (QualifiedName qn:allPP.keySet()){
System.out.println("... "+qn.toString()+": "+allPP.get(qn));
}
} catch (CoreException e2) {
System.out.println("Failed to get persistent properties from "+target.getLocation().toOSString());
}
String timestamp=null; String timestamp=null;
String sHashCode=null; String sHashCode=null;
int hashCode=0; int hashCode=0;
...@@ -444,6 +757,8 @@ public class ToolSequence { ...@@ -444,6 +757,8 @@ public class ToolSequence {
System.out.println("Got hashcode="+hashCode+" ("+sHashCode+") in "+target.getLocation().toOSString()); System.out.println("Got hashcode="+hashCode+" ("+sHashCode+") in "+target.getLocation().toOSString());
} catch (CoreException e) { } catch (CoreException e) {
System.out.println("No hashcode in "+target.getLocation().toOSString()); System.out.println("No hashcode in "+target.getLocation().toOSString());
} catch (NumberFormatException e1){
System.out.println("Bad hashcode "+sHashCode+" in "+target.getLocation().toOSString());
} }
if (timestamp!=null) { if (timestamp!=null) {
tool.setTimeStamp(timestamp); tool.setTimeStamp(timestamp);
...@@ -465,7 +780,7 @@ public class ToolSequence { ...@@ -465,7 +780,7 @@ public class ToolSequence {
} }
if ((stateToolName==null) || !tool.getName().equals(stateToolName)){ if ((stateToolName==null) || !tool.getName().equals(stateToolName)){
System.out.println("State file "+target.getLocation().toOSString()+" was saved for tool "+stateToolName+ System.out.println("State file "+target.getLocation().toOSString()+" was saved for tool "+stateToolName+
", while restoring tool is "+tool.getName()+" - ivalidating all dependencies timestamps."); ", while restoring tool is "+tool.getName()+" - invalidating all dependencies timestamps.");
tool.clearDependStamps(); tool.clearDependStamps();
return false; return false;
} }
...@@ -495,7 +810,7 @@ public class ToolSequence { ...@@ -495,7 +810,7 @@ public class ToolSequence {
private boolean tryAutoSave(Tool tool){ private boolean tryAutoSave(Tool tool){
if ((tool.getSave()!=null) && // save tool exists if ((tool.getSave()!=null) && // save tool exists
tool.getAutoSave() && // autosave enabled (tool.getAutoSave() || isSave())&& // autosave enabled or save button pressed
(designFlowView!=null) && // not needed anymore? (designFlowView!=null) && // not needed anymore?
(tool.getLastMode()==TOOL_MODE.RUN)) { // it was not playback of logs (tool.getLastMode()==TOOL_MODE.RUN)) { // it was not playback of logs
final Tool fTool=tool.getSave(); final Tool fTool=tool.getSave();
...@@ -530,8 +845,21 @@ public class ToolSequence { ...@@ -530,8 +845,21 @@ public class ToolSequence {
tool=tool.getSaveMaster(); tool=tool.getSaveMaster();
tool.setMode(TOOL_MODE.STOP); tool.setMode(TOOL_MODE.STOP);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("Finished autosave tool "+tool.getName()+" for "+tool.getName()); System.out.println("Finished (auto)save tool "+tool.getName()+" for "+tool.getName());
} }
if (isSave()) { // more to save?
List<Tool> toolsToSave=getToolsToSave(); // find if there are any sessions in unsaved state - returns list (not yet processed)
if ((toolsToSave!=null) && (toolsToSave.size()>=0)){
if (toolsToSave.get(0).getSaveMaster()!=null){
System.out.println("Seems to be a BUG that might cause infinite attempts to save while processing tool "+
tool.getName()+", first save tool "+toolsToSave.get(0).getName()+
", saveMaster()="+toolsToSave.get(0).getSaveMaster().getName());
return false;
}
if (tryAutoSave(toolsToSave.get(0))) return true;
}
}
releaseSave();
} }
return false; return false;
} }
...@@ -551,7 +879,7 @@ public class ToolSequence { ...@@ -551,7 +879,7 @@ public class ToolSequence {
String linkString=tool.getStateLink(); String linkString=tool.getStateLink();
String targetString=tool.getStateFile(); // With timestamp or specifically set through selection String targetString=tool.getStateFile(); // With timestamp or specifically set through selection
System.out.println("Tool:"+tool.getName()+ System.out.println("updateLinkLatest("+tool.getName()+")"+
" stateDirString="+stateDirString+ " stateDirString="+stateDirString+
" linkString ="+linkString+ " linkString ="+linkString+
" targetString="+targetString); " targetString="+targetString);
...@@ -577,11 +905,17 @@ public class ToolSequence { ...@@ -577,11 +905,17 @@ public class ToolSequence {
" in "+stateDirString+": "+target.getLocation()); " in "+stateDirString+": "+target.getLocation());
return; // No link created as there was no snapshot, but the console state is valid. return; // No link created as there was no snapshot, but the console state is valid.
} }
if (linkString==null){ // Debug
System.out.println("No link name available for "+tool.getName()); try {
return; Map<QualifiedName,String> allPP= target.getPersistentProperties();
} System.out.println("4. Getting persistent properties from properties from "+target.getLocation().toOSString());
for (QualifiedName qn:allPP.keySet()){
System.out.println("... "+qn.toString()+": "+allPP.get(qn));
}
} catch (CoreException e2) {
System.out.println("Failed to get persistent properties from "+target.getLocation().toOSString());
}
IFile link= stateDir.getFile(linkString); IFile link= stateDir.getFile(linkString);
try { try {
...@@ -662,6 +996,24 @@ public class ToolSequence { ...@@ -662,6 +996,24 @@ public class ToolSequence {
" on "+target.getLocation().toOSString()); " on "+target.getLocation().toOSString());
} }
} }
// debug - readback:
try {
target.refreshLocal(0, null); // long-running
} catch (CoreException e1) {
System.out.println("Failed to refreshLocal "+target.getLocation().toOSString()+" e="+e1.toString());
}
try {
Map<QualifiedName,String> allPP= target.getPersistentProperties();
System.out.println("5. Getting persistent properties from properties from "+target.getLocation().toOSString());
for (QualifiedName qn:allPP.keySet()){
System.out.println("... "+qn.toString()+": "+allPP.get(qn));
}
} catch (CoreException e2) {
System.out.println("Failed to get persistent properties from "+target.getLocation().toOSString());
}
} }
/** /**
...@@ -671,6 +1023,8 @@ public class ToolSequence { ...@@ -671,6 +1023,8 @@ public class ToolSequence {
*/ */
private boolean updateSessionTools(Tool tool){ private boolean updateSessionTools(Tool tool){
String targetString=tool.getStateFile(); String targetString=tool.getStateFile();
String linkString= tool.getStateLink();
// after restore this may be a non-timestamp file - use current timestamp instead of the restored? // after restore this may be a non-timestamp file - use current timestamp instead of the restored?
if (targetString==null){ if (targetString==null){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
...@@ -684,7 +1038,7 @@ public class ToolSequence { ...@@ -684,7 +1038,7 @@ public class ToolSequence {
if (sessionList.size()>0){ if (sessionList.size()>0){
for(Iterator<Tool> iter = sessionList.iterator(); iter.hasNext();) { for(Iterator<Tool> iter = sessionList.iterator(); iter.hasNext();) {
Tool consoleTool=iter.next(); Tool consoleTool=iter.next();
consoleTool.setOpenState(targetString); consoleTool.setOpenState(linkString,targetString);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE))
System.out.println("Set openState of "+consoleTool.getName()+" to "+targetString); System.out.println("Set openState of "+consoleTool.getName()+" to "+targetString);
if (tool.getRestoreMaster()!=null) { // after restore save master tool if (tool.getRestoreMaster()!=null) { // after restore save master tool
...@@ -841,7 +1195,7 @@ public class ToolSequence { ...@@ -841,7 +1195,7 @@ public class ToolSequence {
} }
setStateProvides(); // Can be called just once - during initialization? setStateProvides(); // Can be called just once - during initialization?
for (String state:stateProvides.keySet()){ for (String state:stateProviders.keySet()){
if ( mementoKeysMap.containsKey(state+TAG_CURRENTSTATE_TOOLNAME)) { if ( mementoKeysMap.containsKey(state+TAG_CURRENTSTATE_TOOLNAME)) {
currentStates.put(state,new ToolStateStamp( currentStates.put(state,new ToolStateStamp(
memento.getString(state+TAG_CURRENTSTATE_TOOLNAME), memento.getString(state+TAG_CURRENTSTATE_TOOLNAME),
...@@ -864,6 +1218,8 @@ public class ToolSequence { ...@@ -864,6 +1218,8 @@ public class ToolSequence {
} }
public void putCurrentState(Tool tool){ public void putCurrentState(Tool tool){
if (tool.getRestoreMaster()!=null) tool.getRestoreMaster();
else if (tool.getSaveMaster()!=null) tool.getSaveMaster();
String linkString=tool.getStateLink(); // name of the state file w/o timestamp String linkString=tool.getStateLink(); // name of the state file w/o timestamp
if (linkString!=null) currentStates.put(linkString, new ToolStateStamp(tool)); if (linkString!=null) currentStates.put(linkString, new ToolStateStamp(tool));
} }
...@@ -889,6 +1245,63 @@ public class ToolSequence { ...@@ -889,6 +1245,63 @@ public class ToolSequence {
tool.setDirty(!matchDependState(tool)); tool.setDirty(!matchDependState(tool));
} }
} }
// why did it fail?
if (SelectedResourceManager.getDefault().isToolsLinked()) {
System.out.println("====Propagating 'dirty' flags to dependent non-pinned tools");
propagateDirty();
}
}
private void propagateDirty(){
boolean newDirty=false;
// private Map<String,ToolStateStamp> currentStates;
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
if (
tool.isDisabled() || // disabled tool (or abstract)
(tool.getSaveMaster()!=null) || // Is Save tool
(tool.getRestoreMaster()!=null)){ // or is Restore tool
continue;
}
if (!tool.isDirty()){
List<String> depStates=tool.getDependStates();
if ((depStates==null) || (depStates.size()==0)){
continue; // no dependencies at all;
}
boolean met=true;
if (currentStates!=null) for (String state:depStates){
Tool provider=(currentStates.get(state)==null)?null: ToolsCore.getTool(currentStates.get(state).getToolName());
if (provider==null){
met=false;
System.out.println("No providers for depend state "+state);
break;
}
if (provider.getRestoreMaster()!=null){
System.out.println("propagateDirty(): should not happen: tool "+
provider.getName()+".getRestoreMaster()="+
provider.getRestoreMaster().getName());
provider=provider.getRestoreMaster();
} else if (provider.getSaveMaster()!=null){
System.out.println("propagateDirty(): should not happen: tool "+
provider.getName()+".getSaveMaster()="+
provider.getSaveMaster().getName());
provider=provider.getSaveMaster();
}
if (provider.isDirty() && !provider.isPinned()){
met=false;
System.out.println("Provider for depend state "+state+" - "+provider.getName()+" : isDirty()="+
provider.isDirty()+", provider.isPinned()="+provider.isPinned());
break;
}
}
if (!met) {
tool.setDirty(true);
newDirty=true;
}
}
}
if (newDirty) propagateDirty(); // recursive call until no more new tools are marked dirty
} }
/** /**
......
...@@ -19,7 +19,9 @@ package com.elphel.vdt.core.tools.params.conditions; ...@@ -19,7 +19,9 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.List; import java.util.List;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public interface AbstractConditonValue { public interface AbstractConditonValue {
public abstract String getValue(); public abstract String getValue(FormatProcessor topProcessor);
public abstract List<String> getDependencies(); public abstract List<String> getDependencies();
} }
...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions; ...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.List; import java.util.List;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class Comparison extends Condition { public abstract class Comparison extends Condition {
protected COMPARE_OP op; protected COMPARE_OP op;
...@@ -41,6 +43,6 @@ public abstract class Comparison extends Condition { ...@@ -41,6 +43,6 @@ public abstract class Comparison extends Condition {
} }
public abstract boolean equals(Object other); public abstract boolean equals(Object other);
public abstract boolean isTrue(); public abstract boolean isTrue(FormatProcessor topProcessor);
public abstract List<String> getDependencies(); public abstract List<String> getDependencies();
} }
...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions; ...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*; import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class Condition { public class Condition {
private Condition left, right; private Condition left, right;
private BOOL_OP op; private BOOL_OP op;
...@@ -60,8 +62,8 @@ public class Condition { ...@@ -60,8 +62,8 @@ public class Condition {
right.equals(otherCondition.right); right.equals(otherCondition.right);
} }
public boolean isTrue() { public boolean isTrue(FormatProcessor topProcessor) {
return op.isTrue(left.isTrue(), right.isTrue()); return op.isTrue(left.isTrue(topProcessor), right.isTrue(topProcessor));
} }
public List<String> getDependencies() { public List<String> getDependencies() {
......
...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions; ...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*; import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class ConditionString extends ConditionValue { public class ConditionString extends ConditionValue {
private String value; private String value;
...@@ -28,8 +30,8 @@ public class ConditionString extends ConditionValue { ...@@ -28,8 +30,8 @@ public class ConditionString extends ConditionValue {
this.value = value; this.value = value;
} }
public String getValue() { public String getValue(FormatProcessor topProcessor) {
return condition.isTrue()? value : null; return condition.isTrue(topProcessor)? value : null;
} }
public List<String> getDependencies() { public List<String> getDependencies() {
......
...@@ -20,6 +20,7 @@ package com.elphel.vdt.core.tools.params.conditions; ...@@ -20,6 +20,7 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*; import java.util.*;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.ui.MessageUI; import com.elphel.vdt.ui.MessageUI;
public class ConditionUtils { public class ConditionUtils {
...@@ -33,7 +34,7 @@ public class ConditionUtils { ...@@ -33,7 +34,7 @@ public class ConditionUtils {
Condition relevant = entry.getCondition(); Condition relevant = entry.getCondition();
List<String> strings = entry.getStrings(); List<String> strings = entry.getStrings();
if(relevant == null || relevant.isTrue()) if(relevant == null || relevant.isTrue(null))
relevantStrings.addAll(strings); relevantStrings.addAll(strings);
} }
...@@ -68,11 +69,11 @@ public class ConditionUtils { ...@@ -68,11 +69,11 @@ public class ConditionUtils {
return condValue; return condValue;
} }
public static String resolveContextCondition(Context context, String condString) { public static String resolveContextCondition(Context context, String condString, FormatProcessor topProcessor) {
MultiConditionValue condValue = getContextCondition(context, condString); MultiConditionValue condValue = getContextCondition(context, condString);
if(condValue != null) if(condValue != null)
return condValue.getValue(); return condValue.getValue(topProcessor);
return condString; return condString;
} }
......
...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions; ...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.List; import java.util.List;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class ConditionValue implements AbstractConditonValue { public abstract class ConditionValue implements AbstractConditonValue {
protected Condition condition; protected Condition condition;
...@@ -26,6 +28,6 @@ public abstract class ConditionValue implements AbstractConditonValue { ...@@ -26,6 +28,6 @@ public abstract class ConditionValue implements AbstractConditonValue {
this.condition = condition; this.condition = condition;
} }
public abstract String getValue(); public abstract String getValue(FormatProcessor topProcessor);
public abstract List<String> getDependencies(); public abstract List<String> getDependencies();
} }
...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions; ...@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*; import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class MultiConditionValue implements AbstractConditonValue { public class MultiConditionValue implements AbstractConditonValue {
private List<ConditionValue> conditionValues; private List<ConditionValue> conditionValues;
private String defaultString; private String defaultString;
...@@ -33,9 +35,9 @@ public class MultiConditionValue implements AbstractConditonValue { ...@@ -33,9 +35,9 @@ public class MultiConditionValue implements AbstractConditonValue {
this.defaultString = defaultString; this.defaultString = defaultString;
} }
public String getValue() { public String getValue(FormatProcessor topProcessor) {
for(Iterator<ConditionValue> i = conditionValues.iterator(); i.hasNext();) { for(Iterator<ConditionValue> i = conditionValues.iterator(); i.hasNext();) {
String value = ((ConditionValue)i.next()).getValue(); String value = ((ConditionValue)i.next()).getValue(topProcessor);
if(value != null) if(value != null)
return value; return value;
......
...@@ -31,7 +31,9 @@ import com.elphel.vdt.ui.MessageUI; ...@@ -31,7 +31,9 @@ import com.elphel.vdt.ui.MessageUI;
public class StringComparison extends Comparison { public class StringComparison extends Comparison {
private Context context; private Context context;
private String left, right; private String left, right;
private FormatProcessor topProcessor;
// constructor should not reference topProcessor (it is only used at startup)
public StringComparison(COMPARE_OP op, String left, String right) { public StringComparison(COMPARE_OP op, String left, String right) {
this(op, null, left, right); this(op, null, left, right);
} }
...@@ -59,16 +61,17 @@ public class StringComparison extends Comparison { ...@@ -59,16 +61,17 @@ public class StringComparison extends Comparison {
right.equals(otherComparison.right); right.equals(otherComparison.right);
} }
public boolean isTrue() { public boolean isTrue(FormatProcessor topProcessor) {
String actualLeft = left; String actualLeft = left;
String actualRight = right; String actualRight = right;
if(context != null) { if(context != null) {
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = FormatProcessor processor =
new FormatProcessor(new Recognizer[] { new FormatProcessor(new Recognizer[] {
new ContextParamRecognizer(context), new ContextParamRecognizer(context,topProcessor),
new SimpleGeneratorRecognizer() new SimpleGeneratorRecognizer()
}); },topProcessor);
try { try {
actualLeft = processor.process(left).get(0); actualLeft = processor.process(left).get(0);
......
...@@ -22,6 +22,7 @@ import java.util.List; ...@@ -22,6 +22,7 @@ import java.util.List;
import com.elphel.vdt.core.tools.Updateable; import com.elphel.vdt.core.tools.Updateable;
import com.elphel.vdt.core.tools.config.ConfigException; import com.elphel.vdt.core.tools.config.ConfigException;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class UpdateableStringsContainer implements Updateable { public abstract class UpdateableStringsContainer implements Updateable {
private final static String FIRST_MARK = "first"; private final static String FIRST_MARK = "first";
...@@ -42,7 +43,7 @@ public abstract class UpdateableStringsContainer implements Updateable { ...@@ -42,7 +43,7 @@ public abstract class UpdateableStringsContainer implements Updateable {
public abstract boolean matches(Updateable other); public abstract boolean matches(Updateable other);
public abstract Object clone(); public abstract Object clone();
public void update(Updateable from) throws ConfigException { public void update(Updateable from, FormatProcessor topProcessor) throws ConfigException {
UpdateableStringsContainer container = (UpdateableStringsContainer)from; UpdateableStringsContainer container = (UpdateableStringsContainer)from;
ConditionalStringsList oldStrings = ConditionalStringsList oldStrings =
...@@ -53,11 +54,11 @@ public abstract class UpdateableStringsContainer implements Updateable { ...@@ -53,11 +54,11 @@ public abstract class UpdateableStringsContainer implements Updateable {
strings = oldStrings; strings = oldStrings;
insertSpecifiedStrings(); insertSpecifiedStrings(topProcessor);
deleteSpecifiedStrings(); deleteSpecifiedStrings();
} }
private void insertSpecifiedStrings() throws ConfigException { private void insertSpecifiedStrings(FormatProcessor topProcessor) throws ConfigException {
if(insertStrings == null) if(insertStrings == null)
return; return;
...@@ -83,7 +84,7 @@ public abstract class UpdateableStringsContainer implements Updateable { ...@@ -83,7 +84,7 @@ public abstract class UpdateableStringsContainer implements Updateable {
Condition cond = entry.getCondition(); Condition cond = entry.getCondition();
if(cond != null && !cond.isTrue()) if(cond != null && !cond.isTrue(topProcessor))
continue; continue;
// okay, entry found, and the condition is met // okay, entry found, and the condition is met
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.params.recognizers; package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
...@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.generators.ValueGenerator; ...@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.generators.ValueGenerator;
public class ContextParamListRecognizer extends ParamRecognizer { public class ContextParamListRecognizer extends ParamRecognizer {
private Context context; private Context context;
public ContextParamListRecognizer(Context context) { public ContextParamListRecognizer(Context context,FormatProcessor topProcessor) {
this.context = context; this.context = context;
this.topProcessor=topProcessor;
} }
protected Parameter findParam(String paramID) { protected Parameter findParam(String paramID) {
...@@ -36,6 +38,6 @@ public class ContextParamListRecognizer extends ParamRecognizer { ...@@ -36,6 +38,6 @@ public class ContextParamListRecognizer extends ParamRecognizer {
} }
protected AbstractGenerator getGenerator(Parameter param) throws ToolException { protected AbstractGenerator getGenerator(Parameter param) throws ToolException {
return new ValueGenerator(param, "", "", null); // will return list value of the parameter return new ValueGenerator(param, "", "", null, topProcessor); // will return list value of the parameter
} }
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.params.recognizers; package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
...@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.generators.ValueGenerator; ...@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.generators.ValueGenerator;
public class ContextParamRecognizer extends ParamRecognizer { public class ContextParamRecognizer extends ParamRecognizer {
private Context context; private Context context;
public ContextParamRecognizer(Context context) { public ContextParamRecognizer(Context context, FormatProcessor topProcessor) {
this.context = context; this.context = context;
this.topProcessor=topProcessor;
} }
protected Parameter findParam(String paramID) { protected Parameter findParam(String paramID) {
...@@ -36,6 +38,6 @@ public class ContextParamRecognizer extends ParamRecognizer { ...@@ -36,6 +38,6 @@ public class ContextParamRecognizer extends ParamRecognizer {
} }
protected AbstractGenerator getGenerator(Parameter param) throws ToolException { protected AbstractGenerator getGenerator(Parameter param) throws ToolException {
return new ValueGenerator(param, "", "", ""); return new ValueGenerator(param, "", "", "",topProcessor);
} }
} }
...@@ -20,6 +20,7 @@ package com.elphel.vdt.core.tools.params.recognizers; ...@@ -20,6 +20,7 @@ package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.contexts.Context; import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.generators.AbstractGenerator; import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.generators.ValueGenerator; import com.elphel.vdt.core.tools.generators.ValueGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
...@@ -33,12 +34,13 @@ public class ContextParamRepeaterRecognizer extends RepeaterRecognizer { ...@@ -33,12 +34,13 @@ public class ContextParamRepeaterRecognizer extends RepeaterRecognizer {
protected AbstractGenerator findGenerator(String paramID, protected AbstractGenerator findGenerator(String paramID,
String repPrefix, String repPrefix,
String repSuffix, String repSuffix,
String separator) String separator,
FormatProcessor topProcessor)
{ {
Parameter param = context.findParam(paramID); Parameter param = context.findParam(paramID);
if(param != null) if(param != null)
return new ValueGenerator(param, repPrefix, repSuffix, separator); return new ValueGenerator(param, repPrefix, repSuffix, separator,topProcessor);
return null; return null;
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.params.recognizers; package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.Utils; import com.elphel.vdt.core.Utils;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.core.tools.generators.AbstractGenerator; import com.elphel.vdt.core.tools.generators.AbstractGenerator;
...@@ -40,7 +41,7 @@ public class ParamFormatRecognizer implements Recognizer { ...@@ -40,7 +41,7 @@ public class ParamFormatRecognizer implements Recognizer {
this.param = param; this.param = param;
} }
public RecognizerResult recognize(String template, int startPos) { public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor) {
RecognizerResult result = new RecognizerResult(); RecognizerResult result = new RecognizerResult();
String genName; String genName;
int newPos = -1; int newPos = -1;
...@@ -67,7 +68,7 @@ public class ParamFormatRecognizer implements Recognizer { ...@@ -67,7 +68,7 @@ public class ParamFormatRecognizer implements Recognizer {
assert newPos >= 0; assert newPos >= 0;
if(genName.equals(FORMAT_PARAM_NAME_MARK)) { if(genName.equals(FORMAT_PARAM_NAME_MARK)) {
result.set(new AbstractGenerator() { result.set(new AbstractGenerator(topProcessor) {
public String getName() { public String getName() {
return "ParamName (parameter '" + param.getID() + return "ParamName (parameter '" + param.getID() +
"' of context '" + param.getContext().getName() + "' of context '" + param.getContext().getName() +
...@@ -79,9 +80,9 @@ public class ParamFormatRecognizer implements Recognizer { ...@@ -79,9 +80,9 @@ public class ParamFormatRecognizer implements Recognizer {
} }
}, },
newPos); newPos, topProcessor);
} else if(genName.equals(FORMAT_PARAM_VALUE_MARK)) { } else if(genName.equals(FORMAT_PARAM_VALUE_MARK)) {
result.set(new AbstractGenerator() { result.set(new AbstractGenerator(topProcessor) {
public String getName() { public String getName() {
return "ParamValue (parameter '" + param.getID() + return "ParamValue (parameter '" + param.getID() +
"' of context '" + param.getContext().getName() + "' of context '" + param.getContext().getName() +
...@@ -89,11 +90,11 @@ public class ParamFormatRecognizer implements Recognizer { ...@@ -89,11 +90,11 @@ public class ParamFormatRecognizer implements Recognizer {
} }
protected String[] getStringValues() { protected String[] getStringValues() {
return new String[]{param.getExternalValueForm().get(0)}; return new String[]{param.getExternalValueForm(topProcessor).get(0)};
} }
}, },
newPos); newPos, topProcessor);
} }
return result; return result;
......
...@@ -19,12 +19,15 @@ package com.elphel.vdt.core.tools.params.recognizers; ...@@ -19,12 +19,15 @@ package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.Utils; import com.elphel.vdt.core.Utils;
import com.elphel.vdt.core.tools.generators.AbstractGenerator; import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
public abstract class ParamRecognizer implements Recognizer { public abstract class ParamRecognizer implements Recognizer {
public RecognizerResult recognize(String template, int startPos) throws ToolException { //, FormatProcessor topProcessor - not yet used?
protected FormatProcessor topProcessor=null;
public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor) throws ToolException {
RecognizerResult result = new RecognizerResult(); RecognizerResult result = new RecognizerResult();
int newPos = Utils.findBoundary(template, startPos); int newPos = Utils.findBoundary(template, startPos);
...@@ -33,7 +36,8 @@ public abstract class ParamRecognizer implements Recognizer { ...@@ -33,7 +36,8 @@ public abstract class ParamRecognizer implements Recognizer {
Parameter param = findParam(paramID); Parameter param = findParam(paramID);
if(param != null) if(param != null)
result.set(getGenerator(param), newPos); result.set(getGenerator(param), newPos,topProcessor);
this.topProcessor=topProcessor;
return result; return result;
} }
......
...@@ -23,6 +23,7 @@ import com.elphel.vdt.core.tools.generators.FilteredSourceListGenerator; ...@@ -23,6 +23,7 @@ import com.elphel.vdt.core.tools.generators.FilteredSourceListGenerator;
import com.elphel.vdt.core.tools.generators.SourceListGenerator; import com.elphel.vdt.core.tools.generators.SourceListGenerator;
import com.elphel.vdt.core.tools.generators.TopModulesNameGenerator; import com.elphel.vdt.core.tools.generators.TopModulesNameGenerator;
import com.elphel.vdt.core.tools.generators.ValueGenerator; import com.elphel.vdt.core.tools.generators.ValueGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
...@@ -36,7 +37,8 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer { ...@@ -36,7 +37,8 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer {
protected AbstractGenerator findGenerator(String genName, protected AbstractGenerator findGenerator(String genName,
String repPrefix, String repPrefix,
String repSuffix, String repSuffix,
String separator) String separator,
FormatProcessor topProcessor)
{ {
// TODO make repetitor to accept several pattern generators with only one generating a list // TODO make repetitor to accept several pattern generators with only one generating a list
/* /*
...@@ -55,7 +57,7 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer { ...@@ -55,7 +57,7 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer {
} }
*/ */
if(genName.equals(ParamFormatRecognizer.FORMAT_PARAM_VALUE_MARK)) if(genName.equals(ParamFormatRecognizer.FORMAT_PARAM_VALUE_MARK))
return new ValueGenerator(param, repPrefix, repSuffix, separator); return new ValueGenerator(param, repPrefix, repSuffix, separator, topProcessor);
/* Trying to put these here */ /* Trying to put these here */
if(genName.equals(FilteredSourceListGenerator.NAME)) if(genName.equals(FilteredSourceListGenerator.NAME))
return new FilteredSourceListGenerator(repPrefix, repSuffix, separator); return new FilteredSourceListGenerator(repPrefix, repSuffix, separator);
......
...@@ -17,9 +17,10 @@ ...@@ -17,9 +17,10 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.params.recognizers; package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
public interface Recognizer { public interface Recognizer {
public RecognizerResult recognize(String template, int startPos) throws ToolException; public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor) throws ToolException;
} }
...@@ -18,14 +18,17 @@ ...@@ -18,14 +18,17 @@
package com.elphel.vdt.core.tools.params.recognizers; package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.generators.AbstractGenerator; import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class RecognizerResult { public class RecognizerResult {
private AbstractGenerator generator = null; private AbstractGenerator generator = null;
private int newPos = -1; private int newPos = -1;
private FormatProcessor topProcessor=null;
public void set(AbstractGenerator generator, int newPos) { public void set(AbstractGenerator generator, int newPos, FormatProcessor topProcessor) {
this.generator = generator; this.generator = generator;
this.newPos = newPos; this.newPos = newPos;
this.topProcessor=topProcessor;
} }
public AbstractGenerator getGenerator() { public AbstractGenerator getGenerator() {
...@@ -38,4 +41,5 @@ public class RecognizerResult { ...@@ -38,4 +41,5 @@ public class RecognizerResult {
return newPos; return newPos;
} }
public FormatProcessor getTopProcessor() {return topProcessor;}
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.params.recognizers; package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.Utils; import com.elphel.vdt.core.Utils;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
import com.elphel.vdt.core.tools.generators.AbstractGenerator; import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.generators.FileListGenerator; import com.elphel.vdt.core.tools.generators.FileListGenerator;
...@@ -39,7 +40,7 @@ public class RepeaterRecognizer implements Recognizer { ...@@ -39,7 +40,7 @@ public class RepeaterRecognizer implements Recognizer {
private static final int FORMAT_REPEATER_SEP_LEN = FORMAT_REPEATER_SEP.length(); private static final int FORMAT_REPEATER_SEP_LEN = FORMAT_REPEATER_SEP.length();
private static final int FORMAT_REPEATER_CLOSE_LEN = FORMAT_REPEATER_CLOSE.length(); private static final int FORMAT_REPEATER_CLOSE_LEN = FORMAT_REPEATER_CLOSE.length();
public RecognizerResult recognize(String template, int startPos) public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor)
throws ToolException throws ToolException
{ {
RecognizerResult result = new RecognizerResult(); RecognizerResult result = new RecognizerResult();
...@@ -88,8 +89,8 @@ public class RepeaterRecognizer implements Recognizer { ...@@ -88,8 +89,8 @@ public class RepeaterRecognizer implements Recognizer {
// "', sepBody: '" + sepBody + // "', sepBody: '" + sepBody +
// "'"); // "'");
result.set(findGenerator(genName, repPrefix, repSuffix, sepBody), /* Why did it miss FileListGenerator here? */ result.set(findGenerator(genName, repPrefix, repSuffix, sepBody, topProcessor), /* Why did it miss FileListGenerator here? */
closePos + FORMAT_REPEATER_CLOSE_LEN); closePos + FORMAT_REPEATER_CLOSE_LEN, topProcessor);
if(result.getGenerator() == null) if(result.getGenerator() == null)
throw new ToolException("Unknown generator '" + genName + "'"); throw new ToolException("Unknown generator '" + genName + "'");
...@@ -100,7 +101,8 @@ public class RepeaterRecognizer implements Recognizer { ...@@ -100,7 +101,8 @@ public class RepeaterRecognizer implements Recognizer {
protected AbstractGenerator findGenerator(String genName, protected AbstractGenerator findGenerator(String genName,
String repPrefix, String repPrefix,
String repSuffix, String repSuffix,
String separator) String separator,
FormatProcessor topProcessor)
{ {
System.out.println("Ever get here? RepeaterRecognizer.java:findGenerator()"); // yes, sure System.out.println("Ever get here? RepeaterRecognizer.java:findGenerator()"); // yes, sure
AbstractGenerator gen=new FilteredSourceListGenerator(repPrefix, repSuffix, separator); AbstractGenerator gen=new FilteredSourceListGenerator(repPrefix, repSuffix, separator);
......
...@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.params.recognizers; ...@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.Utils; import com.elphel.vdt.core.Utils;
import com.elphel.vdt.core.tools.generators.*; import com.elphel.vdt.core.tools.generators.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Tool; import com.elphel.vdt.core.tools.params.Tool;
...@@ -66,7 +67,7 @@ public class SimpleGeneratorRecognizer implements Recognizer { ...@@ -66,7 +67,7 @@ public class SimpleGeneratorRecognizer implements Recognizer {
generators[i].setTool(tool); generators[i].setTool(tool);
} }
} }
public RecognizerResult recognize(String template, int startPos) { public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor) {
RecognizerResult result = new RecognizerResult(); RecognizerResult result = new RecognizerResult();
// first see if there is the control sequence // first see if there is the control sequence
...@@ -78,7 +79,7 @@ public class SimpleGeneratorRecognizer implements Recognizer { ...@@ -78,7 +79,7 @@ public class SimpleGeneratorRecognizer implements Recognizer {
String genName = template.substring(startPos, newPos); String genName = template.substring(startPos, newPos);
result.set(findGenerator(genName), newPos); result.set(findGenerator(genName), newPos, topProcessor);
} }
return result; return result;
......
...@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.params.recognizers; ...@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.generators.AbstractGenerator; import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.generators.StringsGenerator; import com.elphel.vdt.core.tools.generators.StringsGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Tool; import com.elphel.vdt.core.tools.params.Tool;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
...@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.params.ToolException; ...@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.params.ToolException;
public class ToolParamRecognizer extends ParamRecognizer { public class ToolParamRecognizer extends ParamRecognizer {
private Tool tool; private Tool tool;
public ToolParamRecognizer(Tool tool) { public ToolParamRecognizer(Tool tool, FormatProcessor topProcessor) {
this.tool = tool; this.tool = tool;
this.topProcessor=topProcessor;
} }
protected Parameter findParam(String paramID) { protected Parameter findParam(String paramID) {
...@@ -36,7 +38,7 @@ public class ToolParamRecognizer extends ParamRecognizer { ...@@ -36,7 +38,7 @@ public class ToolParamRecognizer extends ParamRecognizer {
} }
protected AbstractGenerator getGenerator(final Parameter param) throws ToolException { protected AbstractGenerator getGenerator(final Parameter param) throws ToolException {
return new StringsGenerator(param.getCommandLine()) { return new StringsGenerator(param.getCommandLine(topProcessor),topProcessor) {
String toolName=(tool==null)?"<null>":tool.getName(); String toolName=(tool==null)?"<null>":tool.getName();
public String getName() { public String getName() {
return "Param '" + param + return "Param '" + param +
......
...@@ -84,7 +84,7 @@ public class ComboComponent extends GeneralComponent { ...@@ -84,7 +84,7 @@ public class ComboComponent extends GeneralComponent {
public void setSelection(String value) { public void setSelection(String value) {
ParamTypeEnum type = (ParamTypeEnum)param.getType(); ParamTypeEnum type = (ParamTypeEnum)param.getType();
int pos = type.getValueIndex(param.getValue().get(0)); int pos = type.getValueIndex(param.getValue(null).get(0)); // null for topFormatProcessor
if(pos < 0) if(pos < 0)
pos = 0; pos = 0;
...@@ -96,7 +96,7 @@ public class ComboComponent extends GeneralComponent { ...@@ -96,7 +96,7 @@ public class ComboComponent extends GeneralComponent {
String item = comboField.getText(); String item = comboField.getText();
if (item.length() == 0) if (item.length() == 0)
item = param.getDefaultValue().get(0); item = param.getDefaultValue(null).get(0); // null for topFormatProcessor
ParamTypeEnum type = (ParamTypeEnum)param.getType(); ParamTypeEnum type = (ParamTypeEnum)param.getType();
int pos = type.getLabelIndex(item); int pos = type.getLabelIndex(item);
......
...@@ -62,7 +62,7 @@ public abstract class GeneralComponent extends Component { ...@@ -62,7 +62,7 @@ public abstract class GeneralComponent extends Component {
value = null; value = null;
} else if (isDefault) { } else if (isDefault) {
option.doClear(); option.doClear();
value = param.getDefaultValue().get(0); value = param.getDefaultValue(null).get(0); // null for topFormatProcessor
} else { } else {
value = getSelection(); value = getSelection();
option.doStore(value); option.doStore(value);
...@@ -84,7 +84,7 @@ public abstract class GeneralComponent extends Component { ...@@ -84,7 +84,7 @@ public abstract class GeneralComponent extends Component {
super.setDefault(defaulted); super.setDefault(defaulted);
if (defaulted) { if (defaulted) {
param.setToDefault(); param.setToDefault();
setSelection(param.getDefaultValue().get(0)); setSelection(param.getDefaultValue(null).get(0)); // null for topFormatProcessor
} }
// switchState(defaulted); // switchState(defaulted);
addListeners(); addListeners();
......
...@@ -107,7 +107,7 @@ public abstract class ListComponent extends Component { ...@@ -107,7 +107,7 @@ public abstract class ListComponent extends Component {
super.setDefault(defaulted); super.setDefault(defaulted);
if (defaulted) { if (defaulted) {
param.setToDefault(); param.setToDefault();
promptField.setList(param.getDefaultValue()); promptField.setList(param.getDefaultValue(null)); // null for topFormatProcessor
} }
// switchState(defaulted); // switchState(defaulted);
addListeners(); addListeners();
......
...@@ -83,7 +83,7 @@ public abstract class AbstractTabComponent implements ITabComponent { ...@@ -83,7 +83,7 @@ public abstract class AbstractTabComponent implements ITabComponent {
* component. * component.
*/ */
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
setAttributes(configuration, component.getParam().getDefaultValue().get(0)); setAttributes(configuration, component.getParam().getDefaultValue(null).get(0)); // null for topFormatProcessor
} }
/** /**
......
...@@ -382,6 +382,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -382,6 +382,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
} else { } else {
toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_LINKED); toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_LINKED);
} }
toolSequence.setToolsDirtyFlag(false); //boolean update) - recalculate dirty flags
} }
}; };
toggleLinkedTools.setToolTipText("Toggle tool dependency"); toggleLinkedTools.setToolTipText("Toggle tool dependency");
......
...@@ -84,6 +84,9 @@ ...@@ -84,6 +84,9 @@
<parameter id="ConstraintsFiles" type="Filelist" format="ParamListSyntax" <parameter id="ConstraintsFiles" type="Filelist" format="ParamListSyntax"
default="" label="Constraints files" tooltip="Select constraint files to load to Vivado" readonly="false" default="" label="Constraints files" tooltip="Select constraint files to load to Vivado" readonly="false"
visible="true" /> visible="true" />
<parameter id="ConstraintsFiles" type="Filelist" format="ParamListSyntax"
default="%" label="Constraints files" tooltip="Select constraint files to load to Vivado" readonly="false"
visible="true" />
<parameter id="SkipSnapshotSynth" label="Skip snapshot" tooltip="Do not create snapshot after synthesis" <parameter id="SkipSnapshotSynth" label="Skip snapshot" tooltip="Do not create snapshot after synthesis"
...@@ -206,9 +209,19 @@ ...@@ -206,9 +209,19 @@
visible="false" type="Boolean" format="None"/> visible="false" type="Boolean" format="None"/>
<parameter id="condConstraintsFiles" default="?%%ChosenActionIndex=0 : %ConstraintsFiles, " <parameter id="condConstraintsFiles" default="?%%ChosenActionIndex=0 : %ConstraintsFiles, "
visible="false" type="Filelist" format="None"/> visible="false" type="Filelist" format="None"/>
<!--
<parameter id="blabla1" label="blabla1" tooltip= "blabla1"
default="%blabla2"
visible="true" type="String" format="CopyValue"/>
<parameter id="blabla2" label="blabla2" tooltip= "blabla2"
default="%blabla1"
visible="true" type="String" format="CopyValue"/>
-->
<input> <input>
<group name="General"> <group name="General">
<!--"blabla1"
"blabla2" -->
"ConstraintsFiles" "ConstraintsFiles"
"SkipSnapshotSynth" "SkipSnapshotSynth"
"SnapshotSynth" <!-- same as in project --> "SnapshotSynth" <!-- same as in project -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment