Commit 0e706765 authored by Andrey Filippov's avatar Andrey Filippov

Debugging property inheritance (it was applied twice and did not work)

parent 07259d40
...@@ -19,6 +19,8 @@ package com.elphel.vdt; ...@@ -19,6 +19,8 @@ package com.elphel.vdt;
import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.QualifiedName;
import com.elphel.vdt.veditor.HdlNature;
/** /**
* Central access point for the VDT plug-in (id <code>"com.elphel.vdt.ui"</code>). * Central access point for the VDT plug-in (id <code>"com.elphel.vdt.ui"</code>).
* *
...@@ -44,7 +46,8 @@ public class VDT { ...@@ -44,7 +46,8 @@ public class VDT {
/** The identifier for the Verilog nature */ /** The identifier for the Verilog nature */
//?????????????????????????????? //??????????????????????????????
public static final String VERILOG_NATURE_ID = ID_VDT + ".VerilogNature"; // public static final String VERILOG_NATURE_ID = ID_VDT + ".VerilogNature";
public static final String VERILOG_NATURE_ID = HdlNature.NATURE_ID; // TODO
public static final String PREFERENCE_PAGE_ID = ID_VDT + ".ui.preferences.PreferencePage"; public static final String PREFERENCE_PAGE_ID = ID_VDT + ".ui.preferences.PreferencePage";
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
...@@ -140,6 +143,7 @@ public class VDT { ...@@ -140,6 +143,7 @@ public class VDT {
public static final String GENERATOR_ID_TOP_MODULE = "TopModule"; public static final String GENERATOR_ID_TOP_MODULE = "TopModule";
public static final String GENERATOR_ID_TOP_MODULES = "TopModules"; public static final String GENERATOR_ID_TOP_MODULES = "TopModules";
public static final String GENERATOR_ID_CURRENT_FILE = "CurrentFile"; public static final String GENERATOR_ID_CURRENT_FILE = "CurrentFile";
public static final String GENERATOR_ID_SELECTED_FILE = "SelectedFile";
public static final String GENERATOR_ID_CURRENT_BASE = "CurrentFileBase"; public static final String GENERATOR_ID_CURRENT_BASE = "CurrentFileBase";
public static final String GENERATOR_ID_OS_NAME = "OS"; public static final String GENERATOR_ID_OS_NAME = "OS";
} // class VDT } // class VDT
...@@ -156,14 +156,14 @@ public class LaunchCore { ...@@ -156,14 +156,14 @@ public class LaunchCore {
packageContext.setWorkingDirectory(project.getLocation().toOSString()); /* TODO - Modify for actual directory */ packageContext.setWorkingDirectory(project.getLocation().toOSString()); /* TODO - Modify for actual directory */
packageContext.buildParams(); packageContext.buildParams();
} }
Context context = tool.getParentProject(); Context context = tool.getParentProject(); // for iverilog - "project_settings"
if (context != null) { if (context != null) {
OptionsCore.doLoadContextOptions(context, project); OptionsCore.doLoadContextOptions(context, project); // stored values
context.setWorkingDirectory(project.getLocation().toOSString()); context.setWorkingDirectory(project.getLocation().toOSString());
context.buildParams(); context.buildParams(); // correct context, but nothing got - Should it be? What the sense of the output - some control files?
} }
OptionsCore.doLoadContextOptions(tool, project); OptionsCore.doLoadContextOptions(tool, project);
OptionsCore.doLoadLocation(tool); OptionsCore.doLoadLocation(tool); // here it resolves condition with OS
} // updateContextOptions() } // updateContextOptions()
public static ILaunchConfiguration createLaunchConfiguration( Tool tool public static ILaunchConfiguration createLaunchConfiguration( Tool tool
......
...@@ -22,7 +22,7 @@ import java.util.*; ...@@ -22,7 +22,7 @@ import java.util.*;
import com.elphel.vdt.core.tools.config.ConfigException; import com.elphel.vdt.core.tools.config.ConfigException;
public class EntityUtils { public class EntityUtils {
// Updating tool context (to) from project context (from), items in to have now null context, in from - ProjectContext
public static <T extends Updateable> void update(List<T> from, List<T> to) public static <T extends Updateable> void update(List<T> from, List<T> to)
throws ConfigException throws ConfigException
{ {
...@@ -34,7 +34,7 @@ public class EntityUtils { ...@@ -34,7 +34,7 @@ public class EntityUtils {
T itemToUpdate = null; T itemToUpdate = null;
for(T toItem : to) { for(T toItem : to) {
if(baseItem.matches(toItem)) { if(baseItem.matches(toItem)) { // Did we miss redefined item here? (after I adding copying context to clone)? - no, just supposed to have no context
itemToUpdate = toItem; itemToUpdate = toItem;
break; break;
} }
......
...@@ -33,4 +33,8 @@ public abstract class AbstractConditionNodeReader { ...@@ -33,4 +33,8 @@ public abstract class AbstractConditionNodeReader {
} }
public abstract void readNode(Node node, Condition condition) throws ConfigException; public abstract void readNode(Node node, Condition condition) throws ConfigException;
public String getConfigFileName(){
return config.getConfigFileName();
}
} }
...@@ -60,10 +60,9 @@ public class ParamNodeReader extends AbstractConditionNodeReader { ...@@ -60,10 +60,9 @@ public class ParamNodeReader extends AbstractConditionNodeReader {
String label = XMLConfig.getAttributeValue(paramNode, XMLConfig.PARAMETER_LABEL_ATTR); String label = XMLConfig.getAttributeValue(paramNode, XMLConfig.PARAMETER_LABEL_ATTR);
String readOnly = XMLConfig.getAttributeValue(paramNode, XMLConfig.PARAMETER_READONLY_ATTR); String readOnly = XMLConfig.getAttributeValue(paramNode, XMLConfig.PARAMETER_READONLY_ATTR);
String visible = XMLConfig.getAttributeValue(paramNode, XMLConfig.PARAMETER_VISIBLE_ATTR); String visible = XMLConfig.getAttributeValue(paramNode, XMLConfig.PARAMETER_VISIBLE_ATTR);
if(id == null) if(id == null)
throw new ConfigException("Context '" + context.getName() + ": Parameter id is absent"); throw new ConfigException("Context '" + context.getName() + ": Parameter id is absent");
//getConfigFileName
return new Parameter(id, return new Parameter(id,
outid, outid,
typeName, typeName,
...@@ -73,6 +72,8 @@ public class ParamNodeReader extends AbstractConditionNodeReader { ...@@ -73,6 +72,8 @@ public class ParamNodeReader extends AbstractConditionNodeReader {
omitValue, omitValue,
readOnly, readOnly,
visible, visible,
condition); condition,
getConfigFileName() //.getConfigFileName()
);
} }
} }
...@@ -156,6 +156,10 @@ public class XMLConfig extends Config { ...@@ -156,6 +156,10 @@ public class XMLConfig extends Config {
} }
} }
public String getConfigFileName(){
return currentConfigFileName;
}
public void logError(Exception e) throws ConfigException { public void logError(Exception e) throws ConfigException {
if(errorCount++ < MAX_ERRORS_TO_SHOW) { if(errorCount++ < MAX_ERRORS_TO_SHOW) {
MessageUI.error("Error reading config file '" + currentConfigFileName + ". \n" + MessageUI.error("Error reading config file '" + currentConfigFileName + ". \n" +
...@@ -370,14 +374,12 @@ public class XMLConfig extends Config { ...@@ -370,14 +374,12 @@ public class XMLConfig extends Config {
SAXException, SAXException,
IOException IOException
{ {
//System.out.println("Reading file '" + configFile + "'"); System.out.println("Reading file '" + configFile + "'");
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(configFile); Document document = builder.parse(configFile);
currentConfigFileName = configFile.getAbsolutePath(); currentConfigFileName = configFile.getAbsolutePath();
findRootNode(document); findRootNode(document);
// read and tie control interface list // read and tie control interface list
...@@ -422,6 +424,8 @@ public class XMLConfig extends Config { ...@@ -422,6 +424,8 @@ public class XMLConfig extends Config {
List<DesignMenu> menuComponents = readDesignMenu(document); List<DesignMenu> menuComponents = readDesignMenu(document);
designMenuManager.addDesignMenuComponents(menuComponents); designMenuManager.addDesignMenuComponents(menuComponents);
System.out.println("Done reading file '" + configFile + "'");
} }
private void addControlInterfaceList(List<ControlInterface> controlInterfaces) private void addControlInterfaceList(List<ControlInterface> controlInterfaces)
...@@ -553,7 +557,6 @@ public class XMLConfig extends Config { ...@@ -553,7 +557,6 @@ public class XMLConfig extends Config {
String toolWarnings = getAttributeValue(contextNode, CONTEXT_TOOL_SYNTAX_WARNINGS); String toolWarnings = getAttributeValue(contextNode, CONTEXT_TOOL_SYNTAX_WARNINGS);
String toolInfo = getAttributeValue(contextNode, CONTEXT_TOOL_SYNTAX_INFO); String toolInfo = getAttributeValue(contextNode, CONTEXT_TOOL_SYNTAX_INFO);
boolean isShell=false; boolean isShell=false;
if (toolShell != null){ if (toolShell != null){
toolExe=toolShell; toolExe=toolShell;
...@@ -565,6 +568,15 @@ public class XMLConfig extends Config { ...@@ -565,6 +568,15 @@ public class XMLConfig extends Config {
List<String> toolExtensionsList = readToolExtensionsList(contextNode, contextName); List<String> toolExtensionsList = readToolExtensionsList(contextNode, contextName);
System.out.println("contextNode.getNodeValue()="+contextNode.getNodeValue());
System.out.println("toolPackage="+toolPackage);
System.out.println("toolProject="+toolProject);
System.out.println("toolExe="+toolExe);
System.out.println("toolShell="+toolShell);
List<Tool.RunFor> toolRunfor= readToolRunForList(contextNode, contextName);
context = new Tool(contextName, context = new Tool(contextName,
contextInterfaceName, contextInterfaceName,
contextLabel, contextLabel,
...@@ -579,6 +591,7 @@ public class XMLConfig extends Config { ...@@ -579,6 +591,7 @@ public class XMLConfig extends Config {
toolErrors, toolErrors,
toolWarnings, toolWarnings,
toolInfo, toolInfo,
toolRunfor,
null, null,
null, null,
null); null);
...@@ -594,11 +607,14 @@ public class XMLConfig extends Config { ...@@ -594,11 +607,14 @@ public class XMLConfig extends Config {
// creation routines really DO need to have a reference to the context // creation routines really DO need to have a reference to the context
// //
List<Parameter> contextParams = readParameters(contextNode, context); List<Parameter> contextParams = readParameters(contextNode, context);
List<CommandLinesBlock> contextCommandLinesBlocks = readCommandLinesBlocks(contextNode, context); List<CommandLinesBlock> contextCommandLinesBlocks = readCommandLinesBlocks(contextNode, context); // Correct? for "project_parameters" in /vdt/tools/Verilog/IVerilog.xml
// Each of contextParams (3 total, correct) has null context. Probably OK, same for the tool context
ContextInputDefinition contextInputDefinition = readContextInputDefinition(contextNode, context); ContextInputDefinition contextInputDefinition = readContextInputDefinition(contextNode, context);
if (contextKind==ContextKind.PROJECT){
System.out.println("processing project context");
}
context.setParams(contextParams); context.setParams(contextParams);
context.setParamGroups(contextInputDefinition.getParamGroups()); context.setParamGroups(contextInputDefinition.getParamGroups()); // "Project Properties", "General"
context.setInputDialogLabel(contextInputDefinition.getLabel()); context.setInputDialogLabel(contextInputDefinition.getLabel());
context.setCommandLinesBlocks(contextCommandLinesBlocks); context.setCommandLinesBlocks(contextCommandLinesBlocks);
...@@ -926,6 +942,14 @@ public class XMLConfig extends Config { ...@@ -926,6 +942,14 @@ public class XMLConfig extends Config {
return extList; return extList;
} }
private List<Tool.RunFor> readToolRunForList(Node toolNode, String toolName){
if (toolNode.getNodeValue()==null) return null;
System.out.println("FIXME: readToolRunForList("+toolNode.getNodeName() +", "+toolName+")"+
" rootNode="+rootNode.getNodeName()+" filename="+currentConfigFileName);
return null;
}
private List<Parameter> readParameters(Node node, Context context) private List<Parameter> readParameters(Node node, Context context)
throws ConfigException throws ConfigException
{ {
......
...@@ -54,7 +54,7 @@ public abstract class Context { ...@@ -54,7 +54,7 @@ public abstract class Context {
private boolean initialized = false; private boolean initialized = false;
private String workingDirectory; private String workingDirectory;
private String version; private String version;
private Context context=null;
protected Context(String name, protected Context(String name,
String controlInterfaceName, String controlInterfaceName,
String label, String label,
...@@ -166,7 +166,8 @@ public abstract class Context { ...@@ -166,7 +166,8 @@ public abstract class Context {
// MessageUI.error(e); // MessageUI.error(e);
// } // }
return visibleParamGroups; return visibleParamGroups; // project foriverilog: [com.elphel.vdt.core.tools.params.ParamGroup@775b1885, null, null, null, null, null, null, null, null, null]
// ... label "Project properties", name="General"
} }
public boolean isVisible() { public boolean isVisible() {
...@@ -191,7 +192,7 @@ public abstract class Context { ...@@ -191,7 +192,7 @@ public abstract class Context {
// that array is then returned // that array is then returned
public String[] buildParams() throws ToolException { public String[] buildParams() throws ToolException {
List<String> commandLineParams = new ArrayList<String>(); List<String> commandLineParams = new ArrayList<String>();
Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); // command lines block is empty (yes, there is nothing in project output)
createdControlFiles.clear(); createdControlFiles.clear();
...@@ -203,7 +204,7 @@ public abstract class Context { ...@@ -203,7 +204,7 @@ public abstract class Context {
String paramName = commandLinesBlock.getDestination(); String paramName = commandLinesBlock.getDestination();
String sep = commandLinesBlock.getSeparator(); String sep = commandLinesBlock.getSeparator();
List<String> lines = commandLinesBlock.getLines(); List<String> lines = commandLinesBlock.getLines(); // [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String]
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();) {
...@@ -211,7 +212,7 @@ public abstract class Context { ...@@ -211,7 +212,7 @@ public abstract class Context {
commandSequence.add(buildCommandString(line)); commandSequence.add(buildCommandString(line));
} }
// Here - already resolved to empty
if(paramName != null) { if(paramName != null) {
Parameter commandFileParam = findParam(paramName); Parameter commandFileParam = findParam(paramName);
String controlFileName = commandFileParam != null? String controlFileName = commandFileParam != null?
...@@ -271,9 +272,10 @@ public abstract class Context { ...@@ -271,9 +272,10 @@ public abstract class Context {
} }
protected void initParams() throws ConfigException { protected void initParams() throws ConfigException {
paramContainer.init(config, this); paramContainer.init(config, this); //??? label="iverilog project label", name="IVerilogProject", config.currentConfigFileName="/data/vdt/elphel-EclipseVDT/vdt/tools/XDS/XDS.xml"
// config.currentConfigFileName is just the last file processed for this context, OK
// do the first init to detect most errors // do the first init to detect most errors
// This time got labelname="ModelSIMProject" (empty)
initParamGroups(); initParamGroups();
} }
...@@ -281,7 +283,7 @@ public abstract class Context { ...@@ -281,7 +283,7 @@ public abstract class Context {
visibleParamGroups.clear(); visibleParamGroups.clear();
List<StringPair> foundParams = List<StringPair> foundParams =
new ArrayList<StringPair>(paramContainer.getParams().size()); new ArrayList<StringPair>(paramContainer.getParams().size()); // [null, null, null, null, null, null, null, null, null, null]
for(ParamGroup group : paramGroups) { for(ParamGroup group : paramGroups) {
List<String> paramIDs = group.getParams(); List<String> paramIDs = group.getParams();
......
...@@ -35,11 +35,11 @@ public class ProjectContext extends Context { ...@@ -35,11 +35,11 @@ public class ProjectContext extends Context {
String controlInterfaceName, String controlInterfaceName,
String label, String label,
String iconName, String iconName,
String inputDialogLabel, String inputDialogLabel, // null
String parentPackageName, String parentPackageName,
List<Parameter> params, List<Parameter> params, // null
List<ParamGroup> paramGroups, List<ParamGroup> paramGroups, // null
List<CommandLinesBlock> commandLinesBlocks, List<CommandLinesBlock> commandLinesBlocks, //null
String designMenuName) String designMenuName)
throws ConfigException throws ConfigException
{ {
...@@ -47,10 +47,10 @@ public class ProjectContext extends Context { ...@@ -47,10 +47,10 @@ public class ProjectContext extends Context {
controlInterfaceName, controlInterfaceName,
label, label,
iconName, iconName,
inputDialogLabel, inputDialogLabel, // null
params, params, // null
paramGroups, paramGroups, // null
commandLinesBlocks); commandLinesBlocks); // null
this.parentPackageName = parentPackageName; this.parentPackageName = parentPackageName;
this.designMenuName = designMenuName; this.designMenuName = designMenuName;
......
/*******************************************************************************
* Copyright (c) 2006 Elphel, Inc and Excelsior, LLC.
* This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* Eclipse/VDT plug-in is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with Eclipse VDT plug-in; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*******************************************************************************/
package com.elphel.vdt.core.tools.generators;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.ui.IPageLayout;
import com.elphel.vdt.VDT;
import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class ViewSelectedFileGenerator extends AbstractGenerator {
private static final String NAME = VDT.GENERATOR_ID_SELECTED_FILE;
public String getName() {
return NAME;
}
protected String[] getStringValues() {
IResource resource = SelectedResourceManager.getDefault().getViewSelectedResource(IPageLayout.ID_RES_NAV);
if((resource != null) && (resource.getType() == IResource.FILE))
return new String[] { ((IFile)resource).getLocation().toOSString() };
return new String[] { "" };
}
} //ViewSelectedFileGenerator
...@@ -55,7 +55,7 @@ public class FormatProcessor { ...@@ -55,7 +55,7 @@ public class FormatProcessor {
List<String> outputLines = null; List<String> outputLines = null;
try { try {
outputLines = processTemplate(template); outputLines = processTemplate(template); // echo %SimulationTopFile %%SelectedFile ; -> null
} finally { } finally {
callCount--; callCount--;
} }
......
...@@ -50,6 +50,31 @@ public class Parameter implements Cloneable, Updateable { ...@@ -50,6 +50,31 @@ public class Parameter implements Cloneable, Updateable {
private boolean hasDependentParameters; private boolean hasDependentParameters;
private boolean isChild; // Andrey: trying to resolve double inheritance - at configuration time and when generating output
private String sourceXML; // Andrey: For error reporting - individual to parameter
/*
public Parameter(String id,
String outid,
String typeName,
String syntaxName,
String defaultValue,
String label,
String omitValue,
String readonly,
String visible,
Condition relevant){
this(id,
outid,
typeName,
syntaxName,
defaultValue,
label,
omitValue,
readonly,
visible,
relevant,
null);
}
public Parameter(String id, public Parameter(String id,
String outid, String outid,
String typeName, String typeName,
...@@ -71,7 +96,7 @@ public class Parameter implements Cloneable, Updateable { ...@@ -71,7 +96,7 @@ public class Parameter implements Cloneable, Updateable {
visible, visible,
null); null);
} }
*/
public Parameter(String id, public Parameter(String id,
String outid, String outid,
String typeName, String typeName,
...@@ -81,9 +106,11 @@ public class Parameter implements Cloneable, Updateable { ...@@ -81,9 +106,11 @@ public class Parameter implements Cloneable, Updateable {
String omitValue, String omitValue,
String readonly, String readonly,
String visible, String visible,
Condition relevant) Condition relevant,
String sourceXML)
{ {
this.id = id; this.id = id;
this.isChild=false;
this.outid = outid != null? outid : id; this.outid = outid != null? outid : id;
this.typeName = typeName; this.typeName = typeName;
this.syntaxName = syntaxName; this.syntaxName = syntaxName;
...@@ -94,8 +121,8 @@ public class Parameter implements Cloneable, Updateable { ...@@ -94,8 +121,8 @@ public class Parameter implements Cloneable, Updateable {
this.visible = visible; this.visible = visible;
this.relevant = relevant; this.relevant = relevant;
this.hasDependentParameters = false; this.hasDependentParameters = false;
this.sourceXML=sourceXML;
} }
protected Parameter(Parameter param) { protected Parameter(Parameter param) {
this(param.id, this(param.id,
param.outid, param.outid,
...@@ -106,16 +133,24 @@ public class Parameter implements Cloneable, Updateable { ...@@ -106,16 +133,24 @@ public class Parameter implements Cloneable, Updateable {
param.omitValue, param.omitValue,
param.readonly, param.readonly,
param.visible, param.visible,
param.relevant); param.relevant,
param.sourceXML);
this.type = param.type; this.type = param.type;
this.syntax = param.syntax; this.syntax = param.syntax;
this.context = param.context; // Added by Andrey - may break something else? Supposed not to clone, otherwise fails in Tools.initParams()
} }
public Object clone() { public Object clone() { // did not clone context (intentionally)
return new Parameter(this); return new Parameter(this);
} }
public boolean getIsChild(){
return isChild;
}
public void setIsChild(boolean isChild){
this.isChild=isChild;
}
public boolean matches(Updateable other) { public boolean matches(Updateable other) {
Parameter otherParam = (Parameter)other; Parameter otherParam = (Parameter)other;
...@@ -124,13 +159,25 @@ public class Parameter implements Cloneable, Updateable { ...@@ -124,13 +159,25 @@ public class Parameter implements Cloneable, Updateable {
} }
public void init(Context context) throws ConfigException { public void init(Context context) throws ConfigException {
if(this.context != null) /* if(this.context != null)
throw new ConfigException("Parameter ('" + id + "') cannot be re-initialized"); throw new ConfigException("Parameter ('" + id + "') cannot be re-initialized");
this.context = context; this.context = context;
String contextInfo = "Context '" + context.getName() + "'"; */
// replacing:
if(this.context == context)
throw new ConfigException("Parameter ('" + id + "') cannot be re-initialized on the same context level"); // wrong file name, should be per-parameter
if(this.context == null) {
this.context = context;
} else {
System.out.println ("Andrey: Trying to use already defined context '"+this.context.getName()+
"' instead of the currently processed '"+context.getName()+"' for parameter '"+this.getID()+"'");
// Andrey: Not sure if initialization is still needed - it is probably done before cloning
// System.out.println("Skipping initialization - it is already done");
// return;
}
String contextInfo = "Context '" + context.getName() + "'";
if(typeName == null) if(typeName == null)
throw new ConfigException(contextInfo + ": Type name of parameter '" + id + "' is absent"); throw new ConfigException(contextInfo + ": Type name of parameter '" + id + "' is absent");
else if(syntaxName == null) else if(syntaxName == null)
...@@ -155,18 +202,22 @@ public class Parameter implements Cloneable, Updateable { ...@@ -155,18 +202,22 @@ public class Parameter implements Cloneable, Updateable {
BooleanUtils.VALUE_FALSE); BooleanUtils.VALUE_FALSE);
} }
this.type = context.getControlInterface().findParamType(typeName); // this.type = context.getControlInterface().findParamType(typeName);
this.type = this.context.getControlInterface().findParamType(typeName);
if(this.type == null) if(this.type == null)
throw new ConfigException(contextInfo + ": Parameter type '" + typeName + throw new ConfigException(contextInfo + ": Parameter type '" + typeName +
"' doesn't exist in control interface '" + context.getControlInterface().getName() + // "' doesn't exist in control interface '" + context.getControlInterface().getName() +
"' doesn't exist in control interface '" + this.context.getControlInterface().getName() +
"'"); "'");
this.syntax = context.getControlInterface().findSyntax(syntaxName); // this.syntax = context.getControlInterface().findSyntax(syntaxName);
this.syntax = this.context.getControlInterface().findSyntax(syntaxName);
if(this.syntax == null) if(this.syntax == null)
throw new ConfigException(contextInfo + ": Syntax '" + syntaxName + throw new ConfigException(contextInfo + ": Syntax '" + syntaxName +
"' doesn't exist in control interface '" + context.getControlInterface().getName() + // "' doesn't exist in control interface '" + context.getControlInterface().getName() +
"' doesn't exist in control interface '" + this.context.getControlInterface().getName() +
"'"); "'");
} }
......
...@@ -39,6 +39,9 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -39,6 +39,9 @@ public class Tool extends Context implements Cloneable, Inheritable {
private List<String> extensions; private List<String> extensions;
private List<RunFor> runfor;
private Tool baseTool; private Tool baseTool;
private PackageContext parentPackage; private PackageContext parentPackage;
private ProjectContext parentProject; private ProjectContext parentProject;
...@@ -48,7 +51,10 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -48,7 +51,10 @@ public class Tool extends Context implements Cloneable, Inheritable {
private boolean isShell = false; /* Tool is a shell, preserve first argument, merge all others */ private boolean isShell = false; /* Tool is a shell, preserve first argument, merge all others */
private String projectPath=null; private String projectPath=null;
private boolean initialized = false; private boolean initialized = false;
public class RunFor{
String prompt;
String resource;
}
public Tool(String name, public Tool(String name,
String controlInterfaceName, String controlInterfaceName,
String label, String label,
...@@ -63,6 +69,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -63,6 +69,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
String toolErrors, String toolErrors,
String toolWarnings, String toolWarnings,
String toolInfo, String toolInfo,
List<RunFor> runfor,
/* never used ??? */ /* never used ??? */
List<Parameter> params, List<Parameter> params,
List<ParamGroup> paramGroups, List<ParamGroup> paramGroups,
...@@ -76,7 +83,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -76,7 +83,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
params, params,
paramGroups, paramGroups,
commandLinesBlocks); commandLinesBlocks);
this.runfor=runfor;
this.baseToolName = baseToolName; this.baseToolName = baseToolName;
this.label = label; this.label = label;
this.parentPackageName = parentPackageName; this.parentPackageName = parentPackageName;
...@@ -107,7 +114,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -107,7 +114,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
initParentPackage(); initParentPackage();
initParentProject(); initParentProject();
initParams(); initParams(); // *Inherits and sets up contexts? Also Error with copying context to items
initOtherAttributes(); initOtherAttributes();
initCommandLines(); initCommandLines();
...@@ -227,9 +234,10 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -227,9 +234,10 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
public Parameter findParam(String paramID) { public Parameter findParam(String paramID) {
Parameter param = super.findParam(paramID); Parameter param = super.findParam(paramID); //Andrey: happily finds ProjectContext parameter, thinks it is tool context
if(param != null) // if(param != null)
if ((param != null) && !param.getIsChild())
return param; return param;
if(baseTool != null) { if(baseTool != null) {
...@@ -288,8 +296,16 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -288,8 +296,16 @@ public class Tool extends Context implements Cloneable, Inheritable {
// //
protected void initParams() throws ConfigException { protected void initParams() throws ConfigException {
/*
* Seems that inheritance is implemented twice - here and when generating output lines, and the parameters are cloned, so when say
* project parameters are modified, the changes are not propagated to the tool parameters. I'll try to disable inheritance here,
* see what happens (this intermediate inheritance may be still needed somewhere - exe name, extensions?). Another option would be to reference instead of cloning
* and skip initialization of the "alien" context parameters.
*
* Yes, exe name wants it
*/
if(parentProject != null) if(parentProject != null)
inheritParams(parentProject); inheritParams(parentProject); // Here inheriting project parameters
if(parentPackage != null) if(parentPackage != null)
inheritParams(parentPackage); inheritParams(parentPackage);
...@@ -308,9 +324,7 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -308,9 +324,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
inheritParams(baseTool); inheritParams(baseTool);
inheritParamGroups(); inheritParamGroups();
} }
paramContainer.init(config, this); // Error inside here when context is cloned in inheritance. Parameter ('SimulationTopFile') cannot be re-initialized
paramContainer.init(config, this);
initParamGroups(); initParamGroups();
} }
...@@ -390,7 +404,8 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -390,7 +404,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
private void inheritParams(Context context) throws ConfigException { private void inheritParams(Context context) throws ConfigException {
EntityUtils.update(context.getParams(), paramContainer.getParams()); // EntityUtils.update(context.getParams(), paramContainer.getParams());
EntityUtilsMarkChildren.update(context.getParams(), paramContainer.getParams());
} }
private void inheritParamGroups() throws ConfigException { private void inheritParamGroups() throws ConfigException {
......
...@@ -31,6 +31,7 @@ public class SimpleGeneratorRecognizer implements Recognizer { ...@@ -31,6 +31,7 @@ public class SimpleGeneratorRecognizer implements Recognizer {
new ProjectPathGenerator(), new ProjectPathGenerator(),
new TopModuleNameGenerator(), new TopModuleNameGenerator(),
new CurrentFileGenerator(), new CurrentFileGenerator(),
new ViewSelectedFileGenerator(),
new CurrentFileBaseGenerator() new CurrentFileBaseGenerator()
}; };
......
...@@ -87,7 +87,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -87,7 +87,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
private TreeViewer viewer; private TreeViewer viewer;
private DrillDownAdapter drillDownAdapter; private DrillDownAdapter drillDownAdapter;
private Action showLunchConfigAction; private Action showLaunchConfigAction;
private Action launchAction; private Action launchAction;
private Action showInstallationPropertiesAction; private Action showInstallationPropertiesAction;
...@@ -237,7 +237,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -237,7 +237,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
manager.add(showPackagePropertiesAction); manager.add(showPackagePropertiesAction);
manager.add(showProjectAction); manager.add(showProjectAction);
manager.add(showPropertiesAction); manager.add(showPropertiesAction);
// manager.add(showLunchConfigAction); // manager.add(showLaunchConfigAction);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
} }
...@@ -250,7 +250,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -250,7 +250,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
manager.add(showPackagePropertiesToolbarAction); manager.add(showPackagePropertiesToolbarAction);
manager.add(showProjectPropertiesToolbarAction); manager.add(showProjectPropertiesToolbarAction);
manager.add(showPropertiesAction); manager.add(showPropertiesAction);
// manager.add(showLunchConfigAction); // manager.add(showLaunchConfigAction);
} }
private void makeActions() { private void makeActions() {
...@@ -296,7 +296,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -296,7 +296,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
showProjectPropertiesToolbarAction = new LocalContextsAction("Project Parameters"); showProjectPropertiesToolbarAction = new LocalContextsAction("Project Parameters");
showProjectPropertiesToolbarAction.setText("Project Parameters"); showProjectPropertiesToolbarAction.setText("Project Parameters");
showProjectPropertiesToolbarAction.setToolTipText("Set project parameters"); showProjectPropertiesToolbarAction.setToolTipText("Set project parameters (toolbar)");
showProjectPropertiesToolbarAction.setImageDescriptor(VDTPluginImages.DESC_PROJECT_PROPERTIES); showProjectPropertiesToolbarAction.setImageDescriptor(VDTPluginImages.DESC_PROJECT_PROPERTIES);
showProjectAction = new Action() { showProjectAction = new Action() {
...@@ -307,7 +307,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -307,7 +307,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
} }
}; };
showProjectAction.setText("Project Parameters"); showProjectAction.setText("Project Parameters");
showProjectAction.setToolTipText("Set project parameters"); showProjectAction.setToolTipText("Set project parameters (context menue)");
showProjectAction.setImageDescriptor(VDTPluginImages.DESC_PROJECT_PROPERTIES); showProjectAction.setImageDescriptor(VDTPluginImages.DESC_PROJECT_PROPERTIES);
clearProjectPropertiesAction = new ClearLocalContextAction("Do you wish to delete values of projects parameters?"); clearProjectPropertiesAction = new ClearLocalContextAction("Do you wish to delete values of projects parameters?");
...@@ -341,7 +341,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -341,7 +341,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
selectDesignMenuAction.setText("Change Design Menu"); selectDesignMenuAction.setText("Change Design Menu");
selectDesignMenuAction.setImageDescriptor(VDTPluginImages.DESC_DESIGM_MENU); selectDesignMenuAction.setImageDescriptor(VDTPluginImages.DESC_DESIGM_MENU);
showLunchConfigAction = new Action() { showLaunchConfigAction = new Action() {
public void run() { public void run() {
try { try {
openToolLaunchDialog(selectedItem); openToolLaunchDialog(selectedItem);
...@@ -352,9 +352,9 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -352,9 +352,9 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
} }
} }
}; };
showLunchConfigAction.setText("Launch configuration"); showLaunchConfigAction.setText("Launch configuration");
showLunchConfigAction.setToolTipText("Open launch configuration dialog for this tool"); showLaunchConfigAction.setToolTipText("Open launch configuration dialog for this tool");
showLunchConfigAction.setImageDescriptor(VDTPluginImages.DESC_LAUNCH_CONFIG); showLaunchConfigAction.setImageDescriptor(VDTPluginImages.DESC_LAUNCH_CONFIG);
launchAction = new Action() { launchAction = new Action() {
public void run() { public void run() {
...@@ -429,14 +429,24 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -429,14 +429,24 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
showProjectPropertiesToolbarAction.setProject(project); showProjectPropertiesToolbarAction.setProject(project);
clearProjectPropertiesAction.setProject(project); clearProjectPropertiesAction.setProject(project);
boolean enabled = (selectedItem != null) boolean enabled = (selectedItem != null) // At startup null (twice went through this); Right Click - "Icarus Ver..."
&& (selectedResource != null) && (selectedResource != null) // at startup x353_1.tf; Right Click - "L/x353/x353_1.tf
&& (selectedItem.isEnabled(selectedResource)); && (selectedItem.isEnabled(selectedResource));
launchAction.setEnabled(enabled); launchAction.setEnabled(enabled);
//Just trying
if (enabled){ if (enabled){
launchAction.setText(Txt.s("Action.ToolLounch.Caption", new String[]{selectedResource.getName()})); launchAction.setText(Txt.s("Action.ToolLounch.Caption", new String[]{selectedResource.getName()}));
launchAction.setToolTipText(Txt.s("Action.ToolLounch.ToolTip", new String[]{selectedItem.getLabel(), selectedResource.getName()})); launchAction.setToolTipText(Txt.s("Action.ToolLounch.ToolTip", new String[]{selectedItem.getLabel(), selectedResource.getName()}));
Tool tool = selectedItem.getTool();
if (tool!=null){
System.out.println("Tool:"+tool.getName()); // Not yet parsed
}
} else { } else {
launchAction.setText(Txt.s("Action.ToolLounch.Caption.Default")); launchAction.setText(Txt.s("Action.ToolLounch.Caption.Default"));
launchAction.setToolTipText(Txt.s("Action.ToolLounch.ToolTip.Default")); launchAction.setToolTipText(Txt.s("Action.ToolLounch.ToolTip.Default"));
...@@ -522,22 +532,23 @@ public class DesignFlowView extends ViewPart implements ISelectionListener { ...@@ -522,22 +532,23 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
String newDesignMenuName = newDesignMenu == null ? null String newDesignMenuName = newDesignMenu == null ? null
: newDesignMenu.getName(); : newDesignMenu.getName();
if (newDesignMenuName != null) { if (newDesignMenuName != null) {
try { /* try {
Utils.addNature(VDT.VERILOG_NATURE_ID, project, null); Utils.addNature(VDT.VERILOG_NATURE_ID, project, null);
desigMenuName.setValue(newDesignMenuName); desigMenuName.setValue(newDesignMenuName);
} catch (CoreException e) { } catch (CoreException e) {
MessageUI.error( "Cannot set " + VDT.VERILOG_NATURE_ID + "nature for " + project.getName() MessageUI.error( "Cannot set " + VDT.VERILOG_NATURE_ID + "nature for " + project.getName()
, e); , e);
} }
*/
} else { } else {
try { /* try {
Utils.removeNature(VDT.VERILOG_NATURE_ID, project, null); Utils.removeNature(VDT.VERILOG_NATURE_ID, project, null);
desigMenuName.doClear(); desigMenuName.doClear();
} catch (CoreException e) { } catch (CoreException e) {
MessageUI.error( "Cannot remove " + VDT.VERILOG_NATURE_ID + "nature for " + project.getName() MessageUI.error( "Cannot remove " + VDT.VERILOG_NATURE_ID + "nature for " + project.getName()
, e); , e);
} }
} */ }
OptionsCore.doStoreOption(desigMenuName, project); OptionsCore.doStoreOption(desigMenuName, project);
doLoadDesignMenu(newDesignMenuName); doLoadDesignMenu(newDesignMenuName);
} }
......
...@@ -19,14 +19,27 @@ ...@@ -19,14 +19,27 @@
sensitivity="sensitive" sensitivity="sensitive"
textkind="dir"/> textkind="dir"/>
</typedef> </typedef>
<typedef name="FileType">
<paramtype kind="string"
maxlength="256"
sensitivity="sensitive"
textkind="file"/>
</typedef>
<syntax name="ValueSyntax" format="%%ParamValue" /> <syntax name="ValueSyntax" format="%%ParamValue" />
</interface> </interface>
<!--
<project name="project_settings" <project name="project_settings"
label="Project parameters" label="Project parameters for project_settings"
interface="project_interface"> interface="project_interface">
<parameter id = "SimulationTopFile"
label = "Project top simulation file"
type = "FileType"
default = ""
format = "ValueSyntax"
readonly= "false" />
<parameter id = "SimulationTopModule" <parameter id = "SimulationTopModule"
label = "Project top simulation module" label = "Project top simulation module"
type = "StringType" type = "StringType"
...@@ -43,6 +56,7 @@ ...@@ -43,6 +56,7 @@
<input> <input>
<group name="General" label="Project properties"> <group name="General" label="Project properties">
"SimulationTopFile"
"SimulationTopModule" "SimulationTopModule"
"BuildDir" "BuildDir"
</group> </group>
...@@ -50,5 +64,5 @@ ...@@ -50,5 +64,5 @@
<output> <output>
</output> </output>
</project> </project>
-->
</vdt-project> </vdt-project>
...@@ -150,12 +150,10 @@ ...@@ -150,12 +150,10 @@
format = "%%ParamValue"></syntax> format = "%%ParamValue"></syntax>
</interface> </interface>
<project name="SampleProject" <project name="SampleProject"
label="Sample Project" label="Sample Project"
interface="MyControlInterface"> interface="MyControlInterface">
</project> </project>
<!-- <!--
=========================================================== ===========================================================
......
...@@ -116,16 +116,56 @@ ...@@ -116,16 +116,56 @@
--> -->
</interface> </interface>
<!--
<project name="IVerilogProject" <project name="IVerilogProject"
label="iverilog project" label="iverilog project label"
interface="IVerilog"> interface="IVerilog">
</project> </project>
-->
<project name="project_settings"
label="Project parameters for project_settings"
interface="project_interface">
<parameter id = "SimulationTopFile"
label = "Project top simulation file"
type = "FileType"
default = ""
format = "ValueSyntax"
readonly= "false" />
<parameter id = "SimulationTopModule"
label = "Project top simulation module"
type = "StringType"
default = ""
format = "ValueSyntax"
readonly= "false" />
<parameter id = "BuildDir"
label = "project build directory"
type = "DirType"
default = "build"
format = "ValueSyntax"
readonly= "false" />
<input>
<group name="General" label="Project properties">
"SimulationTopFile"
"SimulationTopModule"
"BuildDir"
</group>
</input>
<output>
</output>
</project>
<tool name = "iverilog" <tool name = "iverilog"
project = "project_settings"
label = "Icarus Verilog compiler" label = "Icarus Verilog compiler"
exe="iverilog" exe = "iverilog"
shell = "bash" shell = "?%%OS: Windows=shell:, Linux=/bin/bash"
interface = "IVerilog" interface = "IVerilog"
errors = "(.*):([0-9]+): [a-z_\- ]*error: (.*)" errors = "(.*):([0-9]+): [a-z_\- ]*error: (.*)"
warnings = "(.*):([0-9]+): [a-z_\- ]*warning: (.*)" warnings = "(.*):([0-9]+): [a-z_\- ]*warning: (.*)"
...@@ -136,6 +176,12 @@ ...@@ -136,6 +176,12 @@
<extension mask="tf"/> <extension mask="tf"/>
</extensions-list> </extensions-list>
<action-menu>
<option label="Simulate" resource="%SimulationTopFile" />
<option label="Simulate" resource="%%SelectedFile" />
<option label="Just try for" resource="%%OS" />
</action-menu>
<parameter id = "Param_Shell_Options" <parameter id = "Param_Shell_Options"
label = "Param_Shell_Options" label = "Param_Shell_Options"
...@@ -245,6 +291,14 @@ ...@@ -245,6 +291,14 @@
default = "2&gt;&amp;1 | tee iverilog.log | grep --line-buffered -E 'error|warning' | grep --line-buffered -v &quot;(null):0&quot;" default = "2&gt;&amp;1 | tee iverilog.log | grep --line-buffered -E 'error|warning' | grep --line-buffered -v &quot;(null):0&quot;"
readonly = "false" readonly = "false"
visible = "true"/> visible = "true"/>
<!-- intentional error below - duplicate -->
<parameter id = "BuildDir"
label = "project build directory"
type = "DirType"
default = "build1"
format = "ValueSyntax"
readonly= "false" />
<input> <input>
<group name="files" label="Files"> <group name="files" label="Files">
...@@ -267,8 +321,12 @@ ...@@ -267,8 +321,12 @@
</input> </input>
<output> <output>
<line name = "command_line" sep = " "> <line name="command_line" sep=" ">
"%Param_Shell_Options" "%Param_Shell_Options"
"echo BuildDir=%BuildDir ;"
"echo SimulationTopFile=%SimulationTopFile ;"
"echo SimulationTopModule=%SimulationTopModule ;"
"echo BuildDir=%BuildDir ;"
"%Param_PreExe" "%Param_PreExe"
"%Param_Exe" "%Param_Exe"
"%Param_TopModule" "%Param_TopModule"
...@@ -282,14 +340,14 @@ ...@@ -282,14 +340,14 @@
<if ErrorsOnly="true"> <if ErrorsOnly="true">
"%Filter_String" "%Filter_String"
</if> </if>
<!--
"-s counter_tb"
"%SourceList" -->
</line> </line>
</output> </output>
</tool> </tool>
<!-- "echo %SimulationTopFile %%SelectedFile ;" -->
<!--
"-s counter_tb"
"%SourceList" -->
......
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