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 {
String valueAttrName = LaunchCore.getValueAttributeName(param);
if(param.getType().isList())
workingCopy.setAttribute(valueAttrName, param.getValue());
workingCopy.setAttribute(valueAttrName, param.getValue(null)); // null for topFormatProcessor
else
workingCopy.setAttribute(valueAttrName, param.getValue().get(0));
workingCopy.setAttribute(valueAttrName, param.getValue(null).get(0)); // null for topFormatProcessor
}
setToolToLaunch(workingCopy, tool);
......@@ -227,6 +227,8 @@ public class LaunchCore {
IProject project,
String resource,
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
try {
......@@ -236,13 +238,18 @@ public class LaunchCore {
resource,
logBuildStamp);
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);
} catch (CoreException e) {
IStatus status = e.getStatus();
if (status.getSeverity() != IStatus.CANCEL)
throw e;
} finally {
// System.out.println("3.DebugUITools.launch() tool="+tool.getName()+" project="+project.getName()+" resource="+resource.toString()+" logBuildStamp="+logBuildStamp);
}
} // launch()
......@@ -378,7 +385,8 @@ public class LaunchCore {
*/
protected static boolean saveAllEditors(boolean confirm) {
if (VerilogPlugin.getActiveWorkbenchWindow() == null) {
return false;
System.out.println("VerilogPlugin.getActiveWorkbenchWindow() == null");
return true; // false;
}
return PlatformUI.getWorkbench().saveAllEditors(confirm);
}
......
......@@ -186,18 +186,20 @@ public class RunningBuilds {
}
public void removeConfiguration(String consoleName){
System.out.println("VDTRunnerConfiguration#removeConfiguration("+consoleName+")");
unfinishedBuilds.remove(consoleName);
System.out.println("Running consoles:");
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
System.out.println("VDTRunnerConfiguration#removeConfiguration("+consoleName+"), running consoles:");
listConfigurations();
}
}
public void saveUnfinished(String consoleName, VDTRunnerConfiguration configuration ){
System.out.println("VDTRunnerConfiguration#saveUnfinished("+consoleName+", configuration)");
unfinishedBuilds.put(consoleName, configuration);
System.out.println("Running consoles:");
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
System.out.println("VDTRunnerConfiguration#saveUnfinished("+consoleName+", configuration), running consoles:");
listConfigurations();
}
}
public void listConfigurations(){
Iterator<String> iter=unfinishedBuilds.keySet().iterator();
......
......@@ -279,7 +279,7 @@ public class VDTConsoleRunner{
for (int i=0;i<fArguments.length;i++){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.LOCAL_ECHO)) {
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");
}
......
......@@ -144,10 +144,10 @@ public class VDTLaunchUtil {
try {
if(param.getType().isList()) {
List<String> value =
configuration.getAttribute(valueAttrName, param.getDefaultValue());
configuration.getAttribute(valueAttrName, param.getDefaultValue(null)); // null for topFormatProcessor
param.setCurrentValue(value);
} 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);
}
} catch(ToolException e) {
......
......@@ -59,7 +59,7 @@ public class ParamBasedListOption extends ParamBasedOption {
}
public List<String> getValueList() {
return param.getValue();
return param.getValue(null); // null for topFormatProcessor
}
public List<String> doLoadList() {
......@@ -83,7 +83,7 @@ public class ParamBasedListOption extends ParamBasedOption {
}
public List<String> doLoadDefaultList() {
List<String> list = param.getDefaultValue();
List<String> list = param.getDefaultValue(null); // null for topFormatProcessor
doClear();
return list;
}
......@@ -109,7 +109,7 @@ public class ParamBasedListOption extends ParamBasedOption {
super.doClear();
return true;
} else
return super.doStore(OptionsUtils.convertListToString(param.getValue()));
return super.doStore(OptionsUtils.convertListToString(param.getValue(null))); // null for topFormatProcessor
}
} // class ParamBasedOption
......@@ -49,7 +49,7 @@ public class ParamBasedOption extends Option {
}
public String getValue() {
return param.getValue().get(0);
return param.getValue(null).get(0); // null for topFormatProcessor
}
public Parameter getParam() {
......@@ -73,13 +73,13 @@ public class ParamBasedOption extends Option {
}
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();
return value;
}
public String doLoadDefault(boolean menuMode) {
String value = param.getDefaultValue(menuMode).get(0);
String value = param.getDefaultValue(menuMode,null).get(0);
doClear();
return value;
}
......
......@@ -224,7 +224,7 @@ public abstract class Context {
CommandLinesBlock commandLinesBlock = (CommandLinesBlock)commandLinesBlockIter.next();
if (commandLinesBlock.isConsoleKind()){
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);
}
}
......@@ -282,8 +282,9 @@ public abstract class Context {
String toolInfo= subsitutePattern(commandLinesBlock.getInfo());
String stderr=commandLinesBlock.getStderr();
String stdout=commandLinesBlock.getStdout();
String prompt= buildSimpleString(commandLinesBlock.getPrompt()); // evaluate string
String sTimeout=buildSimpleString(commandLinesBlock.getTimeout());
// the result will not be used as some other parameter value, so topProcessor is null in the next 2 lines /Andrey
String prompt= buildSimpleString(commandLinesBlock.getPrompt(), null); // evaluate string
String sTimeout=buildSimpleString(commandLinesBlock.getTimeout(),null);
int timeout=0;
try{
timeout=Integer.parseInt(sTimeout);
......@@ -307,7 +308,8 @@ public abstract class Context {
List<List<String>> commandSequence = new ArrayList<List<String>>();
for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) {
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
......@@ -315,7 +317,7 @@ public abstract class Context {
if(destName != null) {
Parameter parName = findParam(destName); // command file or console name
String controlFileName = parName != null?
parName.getValue().get(0).trim() : null;
parName.getValue(null).get(0).trim() : null;
if (isConsoleName) {
// System.out.println("TODO: Enable console command generation here");
printStringsToConsoleLine(commandLineParams, commandSequence,sep,mark);
......@@ -427,7 +429,7 @@ public abstract class Context {
return (BuildParamsItem[])buildParamItems.toArray(new BuildParamsItem[buildParamItems.size()]);
}
protected List<String> buildCommandString(String paramStringTemplate)
protected List<String> buildCommandString(String paramStringTemplate, FormatProcessor topProcessor)
throws ToolException
{
FormatProcessor processor = new FormatProcessor(new Recognizer[] {
......@@ -435,26 +437,26 @@ public abstract class Context {
new RepeaterRecognizer()
// new ContextParamRecognizer(this),
// new ContextParamRepeaterRecognizer(this)
});
},topProcessor);
return processor.process(paramStringTemplate);
}
// recognizes parameter name (just %name), or simple generators
protected String buildSimpleString(String stringTemplate)
protected String buildSimpleString(String stringTemplate, FormatProcessor topProcessor)
throws ToolException
{
if (stringTemplate==null) return null;
Parameter parName=findParam(stringTemplate);
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[] {
new SimpleGeneratorRecognizer(),
new RepeaterRecognizer()
// new ContextParamRecognizer(this),
// new ContextParamRepeaterRecognizer(this)
});
},topProcessor);
List<String> result= processor.process(stringTemplate);
if (result.size()==0) return "";
......
......@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.generators;
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.ui.MessageUI;
......@@ -34,26 +35,29 @@ public abstract class AbstractGenerator {
private final boolean forcedMultiline;
private boolean menuMode=false; // managing menu items, not running tool. Ignore Generator errors
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() {
this(false);
public AbstractGenerator(FormatProcessor processor) {
this(false, processor);
}
public AbstractGenerator(String prefix,
String suffix,
String separator)
String separator,
FormatProcessor processor)
{
this(prefix, suffix, separator, false);
this(prefix, suffix, separator, false,processor);
}
protected AbstractGenerator(boolean forcedMultiline) {
this("", "", "", forcedMultiline);
protected AbstractGenerator(boolean forcedMultiline, FormatProcessor processor) {
this("", "", "", forcedMultiline, processor);
}
protected AbstractGenerator(String prefix,
String suffix,
String sep,
boolean forcedMultiline)
boolean forcedMultiline,
FormatProcessor processor)
{
this.prefix = prefix;
this.suffix = suffix;
......@@ -63,6 +67,7 @@ public abstract class AbstractGenerator {
separator = separator.replace("\\n", "\n");
separator = separator.replace("\\t", "\t");
}
topProcessor=processor;
}
public void setMenuMode(boolean menuMode){
this.menuMode=menuMode;
......@@ -73,6 +78,7 @@ public abstract class AbstractGenerator {
public void setTool(Tool tool){
this.tool0=tool;
}
protected FormatProcessor getTopProcessor(){return topProcessor;}
public abstract String getName();
......
......@@ -26,6 +26,11 @@ public class BuildStampGenerator extends AbstractGenerator {
return NAME;
}
public BuildStampGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() {
// if ( return new String[] {(tool0!=null)?tool0.getStateFile(): ""};
// System.out.println("#### BuildStampGenerator(): tool0="+
......
......@@ -25,6 +25,10 @@ public class ChosenActionGenerator extends AbstractGenerator {
public String getName() {
return NAME;
}
public ChosenActionGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() {
int choice=SelectedResourceManager.getDefault().getChosenAction();
......
......@@ -26,6 +26,10 @@ public class CurrentFileBaseGenerator extends AbstractGenerator {
public String getName() {
return NAME;
}
public CurrentFileBaseGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() {
String name=SelectedResourceManager.getDefault().getChosenShort(); // last segment of the file name
......
......@@ -29,6 +29,11 @@ public class CurrentFileGenerator extends AbstractGenerator {
public String getName() {
return NAME;
}
public CurrentFileGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() {
IResource resource;
if (getMenuMode()) {
......
......@@ -36,7 +36,7 @@ public class FileListGenerator extends AbstractGenerator {
String suffix,
String separator)
{
super(prefix, suffix, separator);
super(prefix, suffix, separator,null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() {
......
......@@ -54,7 +54,7 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
String suffix,
String separator)
{
super(prefix, suffix, separator);
super(prefix, suffix, separator, null ); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() {
......
......@@ -30,6 +30,10 @@ public class OSNameGenerator extends AbstractGenerator {
public String getName() {
return NAME;
}
public OSNameGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() {
String osName = System.getProperty("os.name");
......
......@@ -37,6 +37,11 @@ public class ProjectNameGenerator extends AbstractGenerator {
return NAME;
}
public ProjectNameGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
protected String[] getStringValues() {
String[] value = null;
IResource resource = SelectedResourceManager.getDefault().getSelectedResource();
......
......@@ -34,6 +34,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class ProjectPathGenerator extends AbstractGenerator {
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() {
return NAME;
......
......@@ -27,6 +27,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class SelectedFileGenerator extends AbstractGenerator {
private static final String NAME = VDT.GENERATOR_ID_SELECTED_FILE;
// 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() {
return NAME;
......
......@@ -43,7 +43,7 @@ public class SourceListGenerator extends AbstractGenerator {
String suffix,
String separator)
{
super(prefix, suffix, separator);
super(prefix, suffix, separator,null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() {
......
......@@ -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 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() {
return NAME;
}
......
......@@ -21,6 +21,10 @@ import com.elphel.vdt.VDT;
public class StateDirGenerator extends AbstractGenerator {
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() {
return NAME;
}
......
......@@ -22,6 +22,11 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class StateFileGenerator extends AbstractGenerator {
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() {
return NAME;
}
......
......@@ -17,11 +17,13 @@
*******************************************************************************/
package com.elphel.vdt.core.tools.generators;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class StringsGenerator extends AbstractGenerator {
private final String[] paramStrings;
public StringsGenerator(String[] paramStrings) {
super(true);
public StringsGenerator(String[] paramStrings, FormatProcessor topProcessor) {
super(true, topProcessor);
this.paramStrings = paramStrings;
}
......
......@@ -32,6 +32,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class TopModuleNameGenerator extends AbstractGenerator {
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() {
return NAME;
......
......@@ -38,7 +38,7 @@ public class TopModulesNameGenerator extends AbstractGenerator {
String suffix,
String separator)
{
super(prefix, suffix, separator);
super(prefix, suffix, separator,null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() {
......
......@@ -21,6 +21,11 @@ import com.elphel.vdt.VDT;
public class UserNameGenerator extends AbstractGenerator {
public static final String NAME = VDT.GENERATOR_ID_USERNAME;
public UserNameGenerator()
{
super(null); // null for topFormatProcessor - this generator can not reference other parameters
}
public String getName() {
return NAME;
}
......
......@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.generators;
import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter;
public class ValueGenerator extends AbstractGenerator {
......@@ -27,9 +28,10 @@ public class ValueGenerator extends AbstractGenerator {
public ValueGenerator(Parameter param,
String prefix,
String suffix,
String separator)
String separator,
FormatProcessor topProcessor)
{
super(prefix, suffix, separator);
super(prefix, suffix, separator, topProcessor);
this.param = param;
}
......@@ -41,14 +43,22 @@ public class ValueGenerator extends AbstractGenerator {
}
protected String[] getStringValues() {
List<String> values = param.getValue();
List<String> values = param.getValue(topProcessor);
return values.toArray(new String[values.size()]);
}
public String[] generate() {
if (!param.getType().isList())
return new String[]{prefix + param.getValue().get(0) + suffix};
if (!param.getType().isList()) {
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
return super.generate();
}
......
......@@ -26,6 +26,10 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class ViewSelectedFileGenerator extends AbstractGenerator {
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() {
return NAME;
......
......@@ -44,7 +44,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
// 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 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
// 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.
......@@ -229,7 +229,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
return !destination.equals("");
}
public void update(Updateable from) throws ConfigException {
public void update(Updateable from, FormatProcessor topProcessor) throws ConfigException {
CommandLinesBlock block = (CommandLinesBlock)from;
if(name == null)
......@@ -241,6 +241,11 @@ public class CommandLinesBlock extends UpdateableStringsContainer
if(separator == null)
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 @@
package com.elphel.vdt.core.tools.params;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.params.recognizers.Recognizer;
......@@ -28,26 +29,40 @@ public class FormatProcessor {
private static final String CONTROL_SEQ = "%";
private static final int CONTROL_SEQ_LEN = CONTROL_SEQ.length();
private static List<String> expandedGenerators = new ArrayList<String>();
private static int callCount = 0;
// private static List<String> expandedGenerators = new ArrayList<String>();
// 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 multiline;
private final Recognizer[] recognizers;
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.multiline = multiline;
this.topProcessor=processor;
if (topProcessor==null){
topProcessor=this;
expandedGenerators=new ArrayList<String>();
} else {
expandedGenerators=topProcessor.expandedGenerators;
}
}
public FormatProcessor(Recognizer[] recognizers) {
this(recognizers, true);
public FormatProcessor(Recognizer[] recognizers,FormatProcessor processor) {
this(recognizers, true, processor);
}
public List<String> process(String template) throws ToolException {
if(callCount++ == 0)
if(topProcessor.callCount++ == 0)
expandedGenerators.clear();
initialTemplate = template;
......@@ -57,7 +72,7 @@ public class FormatProcessor {
try {
outputLines = processTemplate(template); // echo %SimulationTopFile %%SelectedFile ; -> null
} finally {
callCount--;
topProcessor.callCount--;
}
if(!multiline) {
......@@ -80,7 +95,7 @@ public class FormatProcessor {
if(template.startsWith(CONTROL_SEQ, pos)) {
pos += CONTROL_SEQ_LEN;
// 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) {
assert result.getNewPos() > pos;
......@@ -111,9 +126,9 @@ public class FormatProcessor {
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++) {
RecognizerResult result = recognizers[i].recognize(template, pos);
RecognizerResult result = recognizers[i].recognize(template, pos, topProcessor);
assert result != null;
......@@ -215,11 +230,19 @@ public class FormatProcessor {
"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);
}
private static void popGen() {
expandedGenerators.remove(expandedGenerators.size()-1);
// private static void popGen() {
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
}
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() {
......@@ -111,7 +111,7 @@ public class ParamGroup extends UpdateableStringsContainer
if(label == null)
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 {
}
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() {
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
// it is only proper way to resolve parameter relevantness!
public boolean isSame(String paramID) {
if(paramID.equals(id)) {
if(relevant == null || relevant.isTrue())
if(relevant == null || relevant.isTrue(null))
return true;
}
......@@ -335,24 +335,24 @@ public class Parameter implements Cloneable, Updateable {
return currentValue;
}
public List<String> getDefaultValue() {
return getDefaultValue(false);
public List<String> getDefaultValue(FormatProcessor topProcessor) {
return getDefaultValue(false,topProcessor);
}
public List<String> getDefaultValue(boolean menuMode) {
String resolvedDefaultValue = ConditionUtils.resolveContextCondition(context, defaultValue);
public List<String> getDefaultValue(boolean menuMode,FormatProcessor topProcessor) {
String resolvedDefaultValue = ConditionUtils.resolveContextCondition(context, defaultValue, topProcessor);
String errmsg = "Parameter '" + id +
"' of context '" + context.getName() +
"' - error processing default value: ";
List<String> processedDefaultValue = null;
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor(new Recognizer[] {
//new RepeaterRecognizer(),
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)
});
}, topProcessor);
try {
processedDefaultValue = processor.process(resolvedDefaultValue);
......@@ -482,19 +482,19 @@ public class Parameter implements Cloneable, Updateable {
// returns current value if it is set
// otherwise returns default value
public List<String> getValue() {
public List<String> getValue(FormatProcessor topProcessor) {
if(!currentValue.isEmpty())
return currentValue;
return getDefaultValue();
return getDefaultValue(topProcessor);
}
// returns external form of the current value unless it equals null;
// otherwise returns external form of the default value
public List<String> getExternalValueForm() {
public List<String> getExternalValueForm(FormatProcessor topProcessor) {
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());
if(elem == null)
......@@ -514,9 +514,9 @@ public class Parameter implements Cloneable, Updateable {
currentValue.clear();
}
public String[] getCommandLine() throws ToolException {
String omit = getOmitValue();
List<String> value = getValue();
public String[] getCommandLine(FormatProcessor topProcessor) throws ToolException {
String omit = getOmitValue(topProcessor);
List<String> value = getValue(topProcessor);
if(value.size() == 1) {
if(omit != null && type.equal(omit, value.get(0)))
......@@ -524,13 +524,13 @@ public class Parameter implements Cloneable, Updateable {
}
String format = syntax.getFormat();
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor(new Recognizer[] {
new ParamFormatRecognizer(this),
new ParamRepeaterRecognizer(this),
new SimpleGeneratorRecognizer(),
new RepeaterRecognizer(),
});
},topProcessor);
List<String> commandLine = processor.process(format);
......@@ -628,14 +628,14 @@ public class Parameter implements Cloneable, Updateable {
// 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[] {
new ContextParamRecognizer(context),
new ContextParamRecognizer(context, topProcessor),
new SimpleGeneratorRecognizer()
},
false);
}, false,topProcessor);
String resolvedOmitValue = ConditionUtils.resolveContextCondition(context, omitValue);
String resolvedOmitValue = ConditionUtils.resolveContextCondition(context, omitValue, topProcessor);
String result = null;
if(resolvedOmitValue != null) {
......@@ -649,8 +649,8 @@ public class Parameter implements Cloneable, Updateable {
return result;
}
private boolean resolveBooleanFieldValue(String field, String fieldName) {
String fieldValue = ConditionUtils.resolveContextCondition(context, field);
private boolean resolveBooleanFieldValue(String field, String fieldName, FormatProcessor topProcessor) {
String fieldValue = ConditionUtils.resolveContextCondition(context, field, topProcessor);
if(!field.equals(fieldValue)) {
try {
......
......@@ -19,7 +19,9 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.List;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public interface AbstractConditonValue {
public abstract String getValue();
public abstract String getValue(FormatProcessor topProcessor);
public abstract List<String> getDependencies();
}
......@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.List;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class Comparison extends Condition {
protected COMPARE_OP op;
......@@ -41,6 +43,6 @@ public abstract class Comparison extends Condition {
}
public abstract boolean equals(Object other);
public abstract boolean isTrue();
public abstract boolean isTrue(FormatProcessor topProcessor);
public abstract List<String> getDependencies();
}
......@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class Condition {
private Condition left, right;
private BOOL_OP op;
......@@ -60,8 +62,8 @@ public class Condition {
right.equals(otherCondition.right);
}
public boolean isTrue() {
return op.isTrue(left.isTrue(), right.isTrue());
public boolean isTrue(FormatProcessor topProcessor) {
return op.isTrue(left.isTrue(topProcessor), right.isTrue(topProcessor));
}
public List<String> getDependencies() {
......
......@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class ConditionString extends ConditionValue {
private String value;
......@@ -28,8 +30,8 @@ public class ConditionString extends ConditionValue {
this.value = value;
}
public String getValue() {
return condition.isTrue()? value : null;
public String getValue(FormatProcessor topProcessor) {
return condition.isTrue(topProcessor)? value : null;
}
public List<String> getDependencies() {
......
......@@ -20,6 +20,7 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*;
import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.ui.MessageUI;
public class ConditionUtils {
......@@ -33,7 +34,7 @@ public class ConditionUtils {
Condition relevant = entry.getCondition();
List<String> strings = entry.getStrings();
if(relevant == null || relevant.isTrue())
if(relevant == null || relevant.isTrue(null))
relevantStrings.addAll(strings);
}
......@@ -68,11 +69,11 @@ public class ConditionUtils {
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);
if(condValue != null)
return condValue.getValue();
return condValue.getValue(topProcessor);
return condString;
}
......
......@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.List;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class ConditionValue implements AbstractConditonValue {
protected Condition condition;
......@@ -26,6 +28,6 @@ public abstract class ConditionValue implements AbstractConditonValue {
this.condition = condition;
}
public abstract String getValue();
public abstract String getValue(FormatProcessor topProcessor);
public abstract List<String> getDependencies();
}
......@@ -19,6 +19,8 @@ package com.elphel.vdt.core.tools.params.conditions;
import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class MultiConditionValue implements AbstractConditonValue {
private List<ConditionValue> conditionValues;
private String defaultString;
......@@ -33,9 +35,9 @@ public class MultiConditionValue implements AbstractConditonValue {
this.defaultString = defaultString;
}
public String getValue() {
public String getValue(FormatProcessor topProcessor) {
for(Iterator<ConditionValue> i = conditionValues.iterator(); i.hasNext();) {
String value = ((ConditionValue)i.next()).getValue();
String value = ((ConditionValue)i.next()).getValue(topProcessor);
if(value != null)
return value;
......
......@@ -31,7 +31,9 @@ import com.elphel.vdt.ui.MessageUI;
public class StringComparison extends Comparison {
private Context context;
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) {
this(op, null, left, right);
}
......@@ -59,16 +61,17 @@ public class StringComparison extends Comparison {
right.equals(otherComparison.right);
}
public boolean isTrue() {
public boolean isTrue(FormatProcessor topProcessor) {
String actualLeft = left;
String actualRight = right;
if(context != null) {
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor =
new FormatProcessor(new Recognizer[] {
new ContextParamRecognizer(context),
new ContextParamRecognizer(context,topProcessor),
new SimpleGeneratorRecognizer()
});
},topProcessor);
try {
actualLeft = processor.process(left).get(0);
......
......@@ -22,6 +22,7 @@ import java.util.List;
import com.elphel.vdt.core.tools.Updateable;
import com.elphel.vdt.core.tools.config.ConfigException;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public abstract class UpdateableStringsContainer implements Updateable {
private final static String FIRST_MARK = "first";
......@@ -42,7 +43,7 @@ public abstract class UpdateableStringsContainer implements Updateable {
public abstract boolean matches(Updateable other);
public abstract Object clone();
public void update(Updateable from) throws ConfigException {
public void update(Updateable from, FormatProcessor topProcessor) throws ConfigException {
UpdateableStringsContainer container = (UpdateableStringsContainer)from;
ConditionalStringsList oldStrings =
......@@ -53,11 +54,11 @@ public abstract class UpdateableStringsContainer implements Updateable {
strings = oldStrings;
insertSpecifiedStrings();
insertSpecifiedStrings(topProcessor);
deleteSpecifiedStrings();
}
private void insertSpecifiedStrings() throws ConfigException {
private void insertSpecifiedStrings(FormatProcessor topProcessor) throws ConfigException {
if(insertStrings == null)
return;
......@@ -83,7 +84,7 @@ public abstract class UpdateableStringsContainer implements Updateable {
Condition cond = entry.getCondition();
if(cond != null && !cond.isTrue())
if(cond != null && !cond.isTrue(topProcessor))
continue;
// okay, entry found, and the condition is met
......
......@@ -17,6 +17,7 @@
*******************************************************************************/
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.ToolException;
import com.elphel.vdt.core.tools.contexts.Context;
......@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.generators.ValueGenerator;
public class ContextParamListRecognizer extends ParamRecognizer {
private Context context;
public ContextParamListRecognizer(Context context) {
public ContextParamListRecognizer(Context context,FormatProcessor topProcessor) {
this.context = context;
this.topProcessor=topProcessor;
}
protected Parameter findParam(String paramID) {
......@@ -36,6 +38,6 @@ public class ContextParamListRecognizer extends ParamRecognizer {
}
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 @@
*******************************************************************************/
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.ToolException;
import com.elphel.vdt.core.tools.contexts.Context;
......@@ -27,8 +28,9 @@ import com.elphel.vdt.core.tools.generators.ValueGenerator;
public class ContextParamRecognizer extends ParamRecognizer {
private Context context;
public ContextParamRecognizer(Context context) {
public ContextParamRecognizer(Context context, FormatProcessor topProcessor) {
this.context = context;
this.topProcessor=topProcessor;
}
protected Parameter findParam(String paramID) {
......@@ -36,6 +38,6 @@ public class ContextParamRecognizer extends ParamRecognizer {
}
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;
import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.generators.ValueGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter;
......@@ -33,12 +34,13 @@ public class ContextParamRepeaterRecognizer extends RepeaterRecognizer {
protected AbstractGenerator findGenerator(String paramID,
String repPrefix,
String repSuffix,
String separator)
String separator,
FormatProcessor topProcessor)
{
Parameter param = context.findParam(paramID);
if(param != null)
return new ValueGenerator(param, repPrefix, repSuffix, separator);
return new ValueGenerator(param, repPrefix, repSuffix, separator,topProcessor);
return null;
}
......
......@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.params.recognizers;
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.generators.AbstractGenerator;
......@@ -40,7 +41,7 @@ public class ParamFormatRecognizer implements Recognizer {
this.param = param;
}
public RecognizerResult recognize(String template, int startPos) {
public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor) {
RecognizerResult result = new RecognizerResult();
String genName;
int newPos = -1;
......@@ -67,7 +68,7 @@ public class ParamFormatRecognizer implements Recognizer {
assert newPos >= 0;
if(genName.equals(FORMAT_PARAM_NAME_MARK)) {
result.set(new AbstractGenerator() {
result.set(new AbstractGenerator(topProcessor) {
public String getName() {
return "ParamName (parameter '" + param.getID() +
"' of context '" + param.getContext().getName() +
......@@ -79,9 +80,9 @@ public class ParamFormatRecognizer implements Recognizer {
}
},
newPos);
newPos, topProcessor);
} else if(genName.equals(FORMAT_PARAM_VALUE_MARK)) {
result.set(new AbstractGenerator() {
result.set(new AbstractGenerator(topProcessor) {
public String getName() {
return "ParamValue (parameter '" + param.getID() +
"' of context '" + param.getContext().getName() +
......@@ -89,11 +90,11 @@ public class ParamFormatRecognizer implements Recognizer {
}
protected String[] getStringValues() {
return new String[]{param.getExternalValueForm().get(0)};
return new String[]{param.getExternalValueForm(topProcessor).get(0)};
}
},
newPos);
newPos, topProcessor);
}
return result;
......
......@@ -19,12 +19,15 @@ package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.Utils;
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.ToolException;
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();
int newPos = Utils.findBoundary(template, startPos);
......@@ -33,7 +36,8 @@ public abstract class ParamRecognizer implements Recognizer {
Parameter param = findParam(paramID);
if(param != null)
result.set(getGenerator(param), newPos);
result.set(getGenerator(param), newPos,topProcessor);
this.topProcessor=topProcessor;
return result;
}
......
......@@ -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.TopModulesNameGenerator;
import com.elphel.vdt.core.tools.generators.ValueGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter;
......@@ -36,7 +37,8 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer {
protected AbstractGenerator findGenerator(String genName,
String repPrefix,
String repSuffix,
String separator)
String separator,
FormatProcessor topProcessor)
{
// TODO make repetitor to accept several pattern generators with only one generating a list
/*
......@@ -55,7 +57,7 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer {
}
*/
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 */
if(genName.equals(FilteredSourceListGenerator.NAME))
return new FilteredSourceListGenerator(repPrefix, repSuffix, separator);
......
......@@ -17,9 +17,10 @@
*******************************************************************************/
package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.ToolException;
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 @@
package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.tools.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
public class RecognizerResult {
private AbstractGenerator generator = null;
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.newPos = newPos;
this.topProcessor=topProcessor;
}
public AbstractGenerator getGenerator() {
......@@ -38,4 +41,5 @@ public class RecognizerResult {
return newPos;
}
public FormatProcessor getTopProcessor() {return topProcessor;}
}
......@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.params.recognizers;
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.generators.AbstractGenerator;
import com.elphel.vdt.core.tools.generators.FileListGenerator;
......@@ -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_CLOSE_LEN = FORMAT_REPEATER_CLOSE.length();
public RecognizerResult recognize(String template, int startPos)
public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor)
throws ToolException
{
RecognizerResult result = new RecognizerResult();
......@@ -88,8 +89,8 @@ public class RepeaterRecognizer implements Recognizer {
// "', sepBody: '" + sepBody +
// "'");
result.set(findGenerator(genName, repPrefix, repSuffix, sepBody), /* Why did it miss FileListGenerator here? */
closePos + FORMAT_REPEATER_CLOSE_LEN);
result.set(findGenerator(genName, repPrefix, repSuffix, sepBody, topProcessor), /* Why did it miss FileListGenerator here? */
closePos + FORMAT_REPEATER_CLOSE_LEN, topProcessor);
if(result.getGenerator() == null)
throw new ToolException("Unknown generator '" + genName + "'");
......@@ -100,7 +101,8 @@ public class RepeaterRecognizer implements Recognizer {
protected AbstractGenerator findGenerator(String genName,
String repPrefix,
String repSuffix,
String separator)
String separator,
FormatProcessor topProcessor)
{
System.out.println("Ever get here? RepeaterRecognizer.java:findGenerator()"); // yes, sure
AbstractGenerator gen=new FilteredSourceListGenerator(repPrefix, repSuffix, separator);
......
......@@ -19,6 +19,7 @@ package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.Utils;
import com.elphel.vdt.core.tools.generators.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Tool;
......@@ -66,7 +67,7 @@ public class SimpleGeneratorRecognizer implements Recognizer {
generators[i].setTool(tool);
}
}
public RecognizerResult recognize(String template, int startPos) {
public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor) {
RecognizerResult result = new RecognizerResult();
// first see if there is the control sequence
......@@ -78,7 +79,7 @@ public class SimpleGeneratorRecognizer implements Recognizer {
String genName = template.substring(startPos, newPos);
result.set(findGenerator(genName), newPos);
result.set(findGenerator(genName), newPos, topProcessor);
}
return result;
......
......@@ -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.StringsGenerator;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Tool;
import com.elphel.vdt.core.tools.params.Parameter;
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 {
private Tool tool;
public ToolParamRecognizer(Tool tool) {
public ToolParamRecognizer(Tool tool, FormatProcessor topProcessor) {
this.tool = tool;
this.topProcessor=topProcessor;
}
protected Parameter findParam(String paramID) {
......@@ -36,7 +38,7 @@ public class ToolParamRecognizer extends ParamRecognizer {
}
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();
public String getName() {
return "Param '" + param +
......
......@@ -84,7 +84,7 @@ public class ComboComponent extends GeneralComponent {
public void setSelection(String value) {
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)
pos = 0;
......@@ -96,7 +96,7 @@ public class ComboComponent extends GeneralComponent {
String item = comboField.getText();
if (item.length() == 0)
item = param.getDefaultValue().get(0);
item = param.getDefaultValue(null).get(0); // null for topFormatProcessor
ParamTypeEnum type = (ParamTypeEnum)param.getType();
int pos = type.getLabelIndex(item);
......
......@@ -62,7 +62,7 @@ public abstract class GeneralComponent extends Component {
value = null;
} else if (isDefault) {
option.doClear();
value = param.getDefaultValue().get(0);
value = param.getDefaultValue(null).get(0); // null for topFormatProcessor
} else {
value = getSelection();
option.doStore(value);
......@@ -84,7 +84,7 @@ public abstract class GeneralComponent extends Component {
super.setDefault(defaulted);
if (defaulted) {
param.setToDefault();
setSelection(param.getDefaultValue().get(0));
setSelection(param.getDefaultValue(null).get(0)); // null for topFormatProcessor
}
// switchState(defaulted);
addListeners();
......
......@@ -107,7 +107,7 @@ public abstract class ListComponent extends Component {
super.setDefault(defaulted);
if (defaulted) {
param.setToDefault();
promptField.setList(param.getDefaultValue());
promptField.setList(param.getDefaultValue(null)); // null for topFormatProcessor
}
// switchState(defaulted);
addListeners();
......
......@@ -83,7 +83,7 @@ public abstract class AbstractTabComponent implements ITabComponent {
* component.
*/
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 {
} else {
toggleLinkedTools.setImageDescriptor(VDTPluginImages.DESC_TOOLS_LINKED);
}
toolSequence.setToolsDirtyFlag(false); //boolean update) - recalculate dirty flags
}
};
toggleLinkedTools.setToolTipText("Toggle tool dependency");
......
......@@ -84,6 +84,9 @@
<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="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"
......@@ -206,9 +209,19 @@
visible="false" type="Boolean" format="None"/>
<parameter id="condConstraintsFiles" default="?%%ChosenActionIndex=0 : %ConstraintsFiles, "
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>
<group name="General">
<!--"blabla1"
"blabla2" -->
"ConstraintsFiles"
"SkipSnapshotSynth"
"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