Commit e24caf8d authored by Andrey Filippov's avatar Andrey Filippov
Browse files

ADding access to the current tool from the generators, debugging

parent c3b3f877
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -153,6 +153,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
                      , IProgressMonitor monitor
                      ) throws CoreException 
    {
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_THREAD_CONFICT))
			System.out.println("-=-=-=- launch: "+VDTLaunchUtil.getToolName(configuration)+" threadID="+Thread.currentThread().getId());
        try {
            doLaunch(configuration, mode, launch, monitor);
        } catch(Exception e) {
+8 −2
Original line number Diff line number Diff line
@@ -436,8 +436,10 @@ public abstract class Context {
    protected List<String> buildCommandString(String paramStringTemplate, FormatProcessor topProcessor)
        throws ToolException
    {
        if (topProcessor==null) topProcessor=new FormatProcessor(this); // or use "context" 
        else topProcessor.setCurrentTool(this); // or use "context"
        FormatProcessor processor = new FormatProcessor(new Recognizer[] {
                                                            new SimpleGeneratorRecognizer(),
                                                            new SimpleGeneratorRecognizer(topProcessor),
                                                            new RepeaterRecognizer()
                                                            // new ContextParamRecognizer(this),
                                                            // new ContextParamRepeaterRecognizer(this)
@@ -451,12 +453,16 @@ public abstract class Context {
            throws ToolException
        {
    	    if (stringTemplate==null) return null;
    	    
            if (topProcessor==null) topProcessor=new FormatProcessor(this); // or use "context" 
            else topProcessor.setCurrentTool(this); // or use "context"

    	    Parameter parName=findParam(stringTemplate);
    	    if (parName!=null){
    	    	return parName.getValue(topProcessor).get(0).trim(); // get parameter
    	    }
            FormatProcessor processor = new FormatProcessor(new Recognizer[] {
                                                                new SimpleGeneratorRecognizer(),
                                                                new SimpleGeneratorRecognizer(topProcessor),
                                                                new RepeaterRecognizer()
                                                                // new ContextParamRecognizer(this),
                                                                // new ContextParamRepeaterRecognizer(this)
+12 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ public abstract class AbstractGenerator {
    protected String separator;
    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 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(FormatProcessor processor) {
@@ -69,14 +69,23 @@ public abstract class AbstractGenerator {
        }
        topProcessor=processor;
    }
    public void setTopProcessor(FormatProcessor processor){
    	topProcessor=processor;
    }
    
    public void setMenuMode(boolean menuMode){
    	this.menuMode=menuMode;
    }
    public boolean getMenuMode(){
    	return menuMode;
    }
    public void setTool(Tool tool){
    	this.tool0=tool;
 //   public void setTool(Tool tool){
 //   	this.tool0=tool;
 //   }
    
    public Tool getCurrentTool(){
    	if (topProcessor==null) return null;
    	return topProcessor.getCurrentTool();
    }
    protected FormatProcessor getTopProcessor(){return topProcessor;}

+4 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
package com.elphel.vdt.core.tools.generators;

import com.elphel.vdt.VDT;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.ui.variables.SelectedResourceManager;

public class BuildStampGenerator extends AbstractGenerator {
@@ -26,16 +27,16 @@ public class BuildStampGenerator extends AbstractGenerator {
        return NAME;
    }
    
    public BuildStampGenerator() 
    public BuildStampGenerator(FormatProcessor topProcessor) 
    {
    	super(null); // null for topFormatProcessor - this generator can not reference other parameters
    	super(topProcessor); // 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="+
//((tool0!=null)?(tool0.getName()+" state="+tool0.getState()+" mode="+tool0.getMode()):"null"));
    	String stamp=(tool0!=null)?tool0.getTimeStamp(): null;
    	String stamp=(getCurrentTool()!=null)?getCurrentTool().getTimeStamp(): null;
    	if (stamp==null) stamp=SelectedResourceManager.getDefault().getBuildStamp();
    	return new String[] {stamp};
    }
+24 −3
Original line number Diff line number Diff line
@@ -31,8 +31,12 @@ import org.eclipse.core.resources.IResource;





//import com.elphel.vdt.VDT;
import com.elphel.vdt.VerilogUtils;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Tool;
import com.elphel.vdt.ui.MessageUI;
//import com.elphel.vdt.core.verilog.VerilogUtils;
import com.elphel.vdt.ui.variables.SelectedResourceManager;
@@ -52,9 +56,10 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
    
    public FilteredSourceListGenerator(String prefix, 
                               String suffix, 
                               String separator) 
                               String separator,
                               FormatProcessor topProcessor) 
    {
        super(prefix, suffix, separator, null ); // null for topFormatProcessor - this generator can not reference other parameters
        super(prefix, suffix, separator, topProcessor ); 
    }
    
    public String getName() {
@@ -62,9 +67,25 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
    }

    protected String[] getStringValues() {
        String ignoreFilter= SelectedResourceManager.getDefault().getFilter(); // old version
    	
//    	System.out.println("FilteredSourceListGenerator(), tool0="+((tool0==null)?null:(tool0.getName()+tool0.getIgnoreFilter())));
//    	System.out.print("FilteredSourceListGenerator(): ");
    	if (topProcessor!=null){
    		Tool tool=topProcessor.getCurrentTool();
//    		System.out.println(", tool="+tool+" tool name="+((tool!=null)?tool.getName():null));
    		if (tool != null) {
    			ignoreFilter=tool.getIgnoreFilter();
//        		System.out.println(" tool="+tool.getName()+", ignoreFilter="+ignoreFilter);

    		} else {
    			System.out.println("FilteredSourceListGenerator():  topProcessor.getCurrentTool() is null");
    		}
    	} else {
    		System.out.println("FilteredSourceListGenerator():  topProcessor is null");
    	}
        String[] file_names = null;
        IResource resource = SelectedResourceManager.getDefault().getChosenVerilogFile();
        String ignoreFilter= SelectedResourceManager.getDefault().getFilter();
        Pattern ignorePattern = null;
        if (ignoreFilter!=null){
        	try {
Loading