Commit 743b1642 authored by Andrey Filippov's avatar Andrey Filippov

Working on communicating with remote program, capturing stderr/stdout to

separate external program
parent ad2afc3e
/com /com
/BuildParamsItem.class
...@@ -148,4 +148,6 @@ public class VDT { ...@@ -148,4 +148,6 @@ public class VDT {
public static final String GENERATOR_ID_CURRENT_BASE = "CurrentFileBase"; public static final String GENERATOR_ID_CURRENT_BASE = "CurrentFileBase";
public static final String GENERATOR_ID_CHOSEN_ACTION = "ChosenActionIndex"; public static final String GENERATOR_ID_CHOSEN_ACTION = "ChosenActionIndex";
public static final String GENERATOR_ID_BUILD_STAMP = "BuildStamp"; public static final String GENERATOR_ID_BUILD_STAMP = "BuildStamp";
public static final String GENERATOR_ID_BLANK = "Blank";
public static final String GENERATOR_ID_NEWLINE = "NewLine";
} // class VDT } // class VDT
...@@ -328,7 +328,10 @@ public class LaunchCore { ...@@ -328,7 +328,10 @@ public class LaunchCore {
launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null); launch.setAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT, null);
DebugPlugin.getDefault().getLaunchManager().addLaunch(launch); DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
VDTRunner runner = VDTLaunchUtil.getRunner(); VDTRunner runner = VDTLaunchUtil.getRunner();
runner.run(configuration, launch, null); runner.run(configuration,
VDTRunner.renderProcessLabel(configuration.getToolName()), // toolname + (date)
launch,
null);
} // launch() } // launch()
......
...@@ -29,6 +29,7 @@ import org.eclipse.debug.core.ILaunchConfiguration; ...@@ -29,6 +29,7 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import com.elphel.vdt.Txt; import com.elphel.vdt.Txt;
import com.elphel.vdt.core.tools.contexts.BuildParamsItem;
import com.elphel.vdt.ui.MessageUI; import com.elphel.vdt.ui.MessageUI;
...@@ -95,8 +96,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg ...@@ -95,8 +96,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
// done the creating arguments phase // done the creating arguments phase
monitor.worked(3); monitor.worked(3);
// resolve arguments // resolve arguments, save them
runConfig.setArgumentsItemsArray(VDTLaunchUtil.getArguments(configuration)); // calculates all parameters
runConfig.setIsShell(VDTLaunchUtil.getIsShell(configuration)); runConfig.setIsShell(VDTLaunchUtil.getIsShell(configuration));
runConfig.setPatternErrors(VDTLaunchUtil.getPatternErrors(configuration)); runConfig.setPatternErrors(VDTLaunchUtil.getPatternErrors(configuration));
runConfig.setToolName(VDTLaunchUtil.getToolName(configuration)); runConfig.setToolName(VDTLaunchUtil.getToolName(configuration));
......
...@@ -22,6 +22,7 @@ import org.eclipse.debug.core.ILaunch; ...@@ -22,6 +22,7 @@ import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfiguration;
import com.elphel.vdt.Txt; import com.elphel.vdt.Txt;
import com.elphel.vdt.core.tools.contexts.BuildParamsItem;
/** /**
...@@ -53,8 +54,16 @@ public class VDTRunnerConfiguration { ...@@ -53,8 +54,16 @@ public class VDTRunnerConfiguration {
private ILaunchConfiguration configuration; private ILaunchConfiguration configuration;
private ILaunch launch; private ILaunch launch;
private IProgressMonitor monitor; private IProgressMonitor monitor;
private BuildParamsItem[] argumentsItemsArray; // calculate once for the launch of the sequence
public BuildParamsItem[] getArgumentsItemsArray(){
return argumentsItemsArray;
}
public void setArgumentsItemsArray(BuildParamsItem[] argumentsItemsArray){
this.argumentsItemsArray=argumentsItemsArray;
}
private static final String[] empty= new String[0]; private static final String[] empty= new String[0];
......
...@@ -28,6 +28,7 @@ import com.elphel.vdt.core.tools.params.conditions.Condition; ...@@ -28,6 +28,7 @@ import com.elphel.vdt.core.tools.params.conditions.Condition;
import com.elphel.vdt.core.tools.params.conditions.ConditionalStringsList; import com.elphel.vdt.core.tools.params.conditions.ConditionalStringsList;
import com.elphel.vdt.core.tools.params.conditions.NamedConditionalStringsList; import com.elphel.vdt.core.tools.params.conditions.NamedConditionalStringsList;
import com.elphel.vdt.core.tools.params.types.ParamTypeString; import com.elphel.vdt.core.tools.params.types.ParamTypeString;
import com.elphel.vdt.core.tools.params.types.ParamTypeString.KIND;
public class CommandLinesNodeReader extends AbstractConditionNodeReader { public class CommandLinesNodeReader extends AbstractConditionNodeReader {
List<CommandLinesBlock> commandLinesBlocks = new ArrayList<CommandLinesBlock>(); List<CommandLinesBlock> commandLinesBlocks = new ArrayList<CommandLinesBlock>();
...@@ -49,13 +50,21 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader { ...@@ -49,13 +50,21 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
} }
} }
} }
/*
*/
private CommandLinesBlock readCommandLinesBlock(Node node, Condition condition) private CommandLinesBlock readCommandLinesBlock(Node node, Condition condition)
throws ConfigException throws ConfigException
{ {
String name = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_NAME_ATTR); String name = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_NAME_ATTR);
String dest = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_DEST_ATTR); String dest = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_DEST_ATTR);
String sep = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_SEP_ATTR); String sep = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_SEP_ATTR);
String mark = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_MARK_ATTR);
String errors = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_ERRORS_ATTR);
String warnings = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_WARNINGS_ATTR);
String info = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INFO_ATTR);
String prompt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_PROMPT_ATTR);
String stderr = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDERR_ATTR);
String stdout = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDOUT_ATTR);
if(name == null) if(name == null)
throw new ConfigException("Unnamed lines block definition in context '" + throw new ConfigException("Unnamed lines block definition in context '" +
...@@ -73,11 +82,15 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader { ...@@ -73,11 +82,15 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
dest, dest,
ParamTypeString.KIND.FILE, //Andrey - doesn't know "kind" here yet - TODO: change to attr ParamTypeString.KIND.FILE, //Andrey - doesn't know "kind" here yet - TODO: change to attr
sep, sep,
mark,
errors,
warnings,
info,
prompt,
stderr,
stdout,
lines, lines,
deleteLines, deleteLines,
insertLines); insertLines);
} }
} }
...@@ -122,11 +122,19 @@ public class XMLConfig extends Config { ...@@ -122,11 +122,19 @@ public class XMLConfig extends Config {
static final String CONTEXT_LINEBLOCK_TAG = "line"; static final String CONTEXT_LINEBLOCK_TAG = "line";
static final String CONTEXT_LINEBLOCK_NAME_ATTR = "name"; static final String CONTEXT_LINEBLOCK_NAME_ATTR = "name";
static final String CONTEXT_LINEBLOCK_DEST_ATTR = "dest"; static final String CONTEXT_LINEBLOCK_DEST_ATTR = "dest";
static final String CONTEXT_LINEBLOCK_SEP_ATTR = "sep"; static final String CONTEXT_LINEBLOCK_SEP_ATTR = "sep";
static final String CONTEXT_LINEBLOCK_MARK_ATTR = "mark";
static final String CONTEXT_LINEBLOCK_ERRORS_ATTR = "errors";
static final String CONTEXT_LINEBLOCK_WARNINGS_ATTR = "warnings";
static final String CONTEXT_LINEBLOCK_INFO_ATTR = "info";
static final String CONTEXT_LINEBLOCK_PROMPT_ATTR = "prompt";
static final String CONTEXT_LINEBLOCK_STDERR_ATTR = "stderr";
static final String CONTEXT_LINEBLOCK_STDOUT_ATTR = "stdout";
static final String CONTEXT_STRINGS_DELETE_TAG = "delete"; static final String CONTEXT_STRINGS_DELETE_TAG = "delete";
static final String CONTEXT_STRINGS_INSERT_TAG = "insert"; static final String CONTEXT_STRINGS_INSERT_TAG = "insert";
static final String CONTEXT_STRINGS_INSERT_AFTER_ATTR = "after"; static final String CONTEXT_STRINGS_INSERT_AFTER_ATTR = "after";
......
...@@ -17,21 +17,63 @@ ...@@ -17,21 +17,63 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.contexts; package com.elphel.vdt.core.tools.contexts;
import java.util.Iterator;
import java.util.List; import java.util.List;
public class BuildParamsItem implements Cloneable{ public class BuildParamsItem implements Cloneable{
private String [] params; private String [] params;
private String consoleName; // null for external tools running in a new console private String consoleName; // null for external tools running in a new console
private String nameAsParser; // name as a parser, null if not used as a parser
// private String mark; // remove this sequence on the output only (to preserve white spaces) Already applied
private String toolErrors; // Eclipse pattern for pattern recognizer
private String toolWarnings; // Eclipse pattern for pattern recognizer
private String toolInfo; // Eclipse pattern for pattern recognizer
// 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 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
public BuildParamsItem ( public BuildParamsItem (
String [] params, String [] params,
String consoleName) { String consoleName,
String nameAsParser,
// String mark,
String toolErrors,
String toolWarnings,
String toolInfo,
String prompt,
String stderr,
String stdout
) {
this.consoleName=consoleName; this.consoleName=consoleName;
this.params=params; // no need to clone? this.params=params; // no need to clone?
this.nameAsParser=nameAsParser;
// this.mark=mark;
this.toolErrors=toolErrors;
this.toolWarnings=toolWarnings;
this.toolInfo=toolInfo;
this.prompt=prompt;
this.stderr=stderr;
this.stdout=stdout;
} }
public BuildParamsItem (BuildParamsItem item){ public BuildParamsItem (BuildParamsItem item){
this ( this (
item.params, item.params,
item.consoleName); item.consoleName,
item.nameAsParser,
// item.mark,
item.toolErrors,
item.toolWarnings,
item.toolInfo,
item.prompt,
item.stderr,
item.stdout
);
} }
public BuildParamsItem clone () { public BuildParamsItem clone () {
...@@ -48,19 +90,44 @@ public class BuildParamsItem implements Cloneable{ ...@@ -48,19 +90,44 @@ public class BuildParamsItem implements Cloneable{
} }
return arguments; return arguments;
} }
/*
String[] paramArray = tool.buildParams();
System.out.println("Andrey: called tool.buildParams() here (from VDTLaunchUtils.java");
List<String> arguments = new ArrayList<String>(paramArray.length);
for(int i = 0; i < paramArray.length; i++) {
arguments.add(paramArray[i]);
}
return arguments;
*/
public String getConsoleName(){ public String getConsoleName(){
return consoleName; return consoleName;
} }
/*
public void applyMark(){
if ((mark==null) || (mark.length()==0)) return;
if (params!=null) {
for (int i=0;i<params.length;i++){
params[i].replace(mark, "");
}
}
if (prompt!=null) prompt.replace(mark, "");
}
*/
public void removeNonParser(List<BuildParamsItem> items){
// if (items==null) return; should never happen as the list includes itself
if (nameAsParser==null) return;
if (consoleName==null) { // console script can not be a parser
Iterator<BuildParamsItem> itemsIter = items.iterator(); // command lines block is empty (yes, there is nothing in project output)
while(itemsIter.hasNext()) {
BuildParamsItem item = (BuildParamsItem)itemsIter.next();
if(
nameAsParser.equals(item.stderr) ||
nameAsParser.equals(item.stdout)){
return; // do nothing - keep nameAsParser
}
}
}
nameAsParser=null;
}
public String getNameAsParser(){ return nameAsParser; }
// public String getMark() { return mark; }
public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; }
public String getInfo() { return toolInfo; }
public String getPrompt() { return prompt; }
public String getStderr() { return stderr; }
public String getStdout() { return stdout; }
} }
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Elphel, Inc and Excelsior, LLC. * Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in. * This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* Free Software Foundation; either version 2 of the License, or (at your option) * the Free Software Foundation, either version 3 of the License, or
* any later version. * (at your option) any later version.
* *
* Eclipse/VDT plug-in is distributed in the hope that it will be useful, but * Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* See the GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License
* with Eclipse VDT plug-in; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.generators; package com.elphel.vdt.core.tools.generators;
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Elphel, Inc and Excelsior, LLC. * Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in. * This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* Free Software Foundation; either version 2 of the License, or (at your option) * the Free Software Foundation, either version 3 of the License, or
* any later version. * (at your option) any later version.
* *
* Eclipse/VDT plug-in is distributed in the hope that it will be useful, but * Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* See the GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License
* with Eclipse VDT plug-in; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.generators; 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 org.eclipse.core.runtime.Path;
import com.elphel.vdt.VDT; import com.elphel.vdt.VDT;
import com.elphel.vdt.ui.variables.SelectedResourceManager; import com.elphel.vdt.ui.variables.SelectedResourceManager;
...@@ -34,7 +28,6 @@ public class CurrentFileBaseGenerator extends AbstractGenerator { ...@@ -34,7 +28,6 @@ public class CurrentFileBaseGenerator extends AbstractGenerator {
} }
protected String[] getStringValues() { protected String[] getStringValues() {
// IResource resource = SelectedResourceManager.getDefault().getSelectedResource();
String name=SelectedResourceManager.getDefault().getChosenShort(); // last segment of the file name String name=SelectedResourceManager.getDefault().getChosenShort(); // last segment of the file name
if (name!=null){ if (name!=null){
int dot = name.lastIndexOf('.'); int dot = name.lastIndexOf('.');
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Elphel, Inc and Excelsior, LLC. * Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in. * This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* Free Software Foundation; either version 2 of the License, or (at your option) * the Free Software Foundation, either version 3 of the License, or
* any later version. * (at your option) any later version.
* *
* Eclipse/VDT plug-in is distributed in the hope that it will be useful, but * Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* See the GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License
* with Eclipse VDT plug-in; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.generators; package com.elphel.vdt.core.tools.generators;
...@@ -26,22 +26,9 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager; ...@@ -26,22 +26,9 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
public class CurrentFileGenerator extends AbstractGenerator { public class CurrentFileGenerator extends AbstractGenerator {
private static final String NAME = VDT.GENERATOR_ID_CURRENT_FILE; private static final String NAME = VDT.GENERATOR_ID_CURRENT_FILE;
// private boolean menuMode=false; // managing menu items, not running tool
public String getName() { public String getName() {
return NAME; return NAME;
} }
/*
public CurrentFileGenerator(boolean menuMode){
super();
this.menuMode=menuMode;
}
*/
/*
public void setMenuMode(boolean menuMode){
this.menuMode=menuMode;
}
*/
protected String[] getStringValues() { protected String[] getStringValues() {
IResource resource; IResource resource;
if (getMenuMode()) { if (getMenuMode()) {
......
...@@ -32,15 +32,36 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -32,15 +32,36 @@ public class CommandLinesBlock extends UpdateableStringsContainer
{ {
private String contextName; private String contextName;
private String name; private String name;
private String destination; private String destination; // now references either file for command file, or console name prefix to send data to
private String separator; private String separator;
private KIND kind; //command file name or console name private KIND kind; //command file name or console name
private String mark; // remove this sequence on the output only (to preserve white spaces)
private String toolErrors; // Eclipse pattern for pattern recognizer
private String toolWarnings; // Eclipse pattern for pattern recognizer
private String toolInfo; // Eclipse pattern for pattern recognizer
// 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
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.
// if only stdout - both stdout and stdin of a session will go to the same process/console
public CommandLinesBlock(String contextName, public CommandLinesBlock(String contextName,
String name, String name,
String destination, String destination,
KIND kind, KIND kind,
String sep, String sep,
String mark,
String toolErrors,
String toolWarnings,
String toolInfo,
String prompt,
String stderr,
String stdout,
ConditionalStringsList lines, ConditionalStringsList lines,
ConditionalStringsList deleteLines, ConditionalStringsList deleteLines,
List<NamedConditionalStringsList> insertLines) List<NamedConditionalStringsList> insertLines)
...@@ -52,6 +73,13 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -52,6 +73,13 @@ public class CommandLinesBlock extends UpdateableStringsContainer
this.destination = destination; this.destination = destination;
this.kind=kind; this.kind=kind;
this.separator = sep; this.separator = sep;
this.mark=mark;
this.toolErrors=toolErrors;
this.toolWarnings=toolWarnings;
this.toolInfo=toolInfo;
this.prompt=prompt;
this.stderr=stderr;
this.stdout=stdout;
if(separator != null) { if(separator != null) {
separator = separator.replace("\\n", "\n"); separator = separator.replace("\\n", "\n");
...@@ -65,6 +93,13 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -65,6 +93,13 @@ public class CommandLinesBlock extends UpdateableStringsContainer
block.destination, block.destination,
block.kind, block.kind,
block.separator, block.separator,
block.mark,
block.toolErrors,
block.toolWarnings,
block.toolInfo,
block.prompt,
block.stderr,
block.stdout,
block.strings != null? block.strings != null?
(ConditionalStringsList)block.strings.clone() : null, (ConditionalStringsList)block.strings.clone() : null,
block.deleteStrings != null? block.deleteStrings != null?
...@@ -105,7 +140,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -105,7 +140,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
"' or '" + ParamTypeString.KIND_TEXT_ID + "' or '" + ParamTypeString.KIND_TEXT_ID +
"'"); "'");
} }
System.out.println("Got string text kind for command block (for console name)"); // System.out.println("Got string text kind for command block (for console name)");
} }
} }
} }
...@@ -119,38 +154,25 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -119,38 +154,25 @@ public class CommandLinesBlock extends UpdateableStringsContainer
return name.equals(((CommandLinesBlock)other).name); return name.equals(((CommandLinesBlock)other).name);
} }
public String getDestination() { public String getDestination() { return destination; }
return destination; public KIND getKind() { return kind;}
} public boolean isFileKind() {return kind == ParamTypeString.KIND.FILE; }
public boolean isConsoleKind() { return kind == ParamTypeString.KIND.TEXT; }
public KIND getKind() { public List<String> getLines() { return ConditionUtils.resolveConditionStrings(strings); }
return kind; public String getName() { return name; }
} public String getSeparator() { return separator; }
public String getMark() { return mark; }
public boolean isFileKind() { public String getErrors() { return toolErrors; }
return kind == ParamTypeString.KIND.FILE; public String getWarnings() { return toolWarnings; }
} public String getInfo() { return toolInfo; }
public String getPrompt() { return prompt; }
public boolean isConsoleKind() { public String getStderr() { return stderr; }
return kind == ParamTypeString.KIND.TEXT; public String getStdout() { return stdout; }
}
public List<String> getLines() {
return ConditionUtils.resolveConditionStrings(strings);
}
public String getName() {
return name;
}
public String getSeparator() {
return separator;
}
public boolean isEnabled() { public boolean isEnabled() {
if(destination == null) // command line if(destination == null) // command line
return true; return true;
return !destination.equals(""); return !destination.equals("");
} }
......
...@@ -80,7 +80,7 @@ public class FormatProcessor { ...@@ -80,7 +80,7 @@ public class FormatProcessor {
if(template.startsWith(CONTROL_SEQ, pos)) { if(template.startsWith(CONTROL_SEQ, pos)) {
pos += CONTROL_SEQ_LEN; pos += CONTROL_SEQ_LEN;
RecognizerResult result = recognize(template, pos); RecognizerResult result = recognize(template, pos); // Already skipped blank lines (and spaces in each line, added separators - no, on deifferent level
if(result != null && result.getGenerator() != null) { if(result != null && result.getGenerator() != null) {
assert result.getNewPos() > pos; assert result.getNewPos() > pos;
...@@ -167,7 +167,7 @@ public class FormatProcessor { ...@@ -167,7 +167,7 @@ public class FormatProcessor {
// we need to check if 'firstLineToAdd' ends with a blank space // we need to check if 'firstLineToAdd' ends with a blank space
// in such a case we just add all the generated lines in the list // in such a case we just add all the generated lines in the list
// otherwise, we glue the line with first of additional ones // otherwise, we glue the line with first of additional ones
if(!Utils.stringEndsWithSpace(firstLineToAdd)) { if(!Utils.stringEndsWithSpace(firstLineToAdd)) { //last character is space or \n
glueToLastLine(lines, processedLines.get(0)); glueToLastLine(lines, processedLines.get(0));
addFrom = 1; addFrom = 1;
} }
...@@ -175,7 +175,7 @@ public class FormatProcessor { ...@@ -175,7 +175,7 @@ public class FormatProcessor {
for(int i = addFrom; i < processedLines.size(); i++) { for(int i = addFrom; i < processedLines.size(); i++) {
String line = processedLines.get(i); String line = processedLines.get(i);
if(!line.equals("")) if(!line.equals("")) // Why drop blank lines?
lines.add(line); lines.add(line);
} }
} }
......
...@@ -52,51 +52,6 @@ public class Parameter implements Cloneable, Updateable { ...@@ -52,51 +52,6 @@ public class Parameter implements Cloneable, Updateable {
private boolean isChild; // Andrey: trying to resolve double inheritance - at configuration time and when generating output 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 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,
String outid,
String typeName,
String syntaxName,
String defaultValue,
String label,
String omitValue,
String readonly,
String visible)
{
this(id,
outid,
typeName,
syntaxName,
defaultValue,
label,
omitValue,
readonly,
visible,
null);
}
*/
public Parameter(String id, public Parameter(String id,
String outid, String outid,
String typeName, String typeName,
......
...@@ -34,7 +34,9 @@ public class SimpleGeneratorRecognizer implements Recognizer { ...@@ -34,7 +34,9 @@ public class SimpleGeneratorRecognizer implements Recognizer {
new CurrentFileGenerator(), new CurrentFileGenerator(),
new CurrentFileBaseGenerator(), new CurrentFileBaseGenerator(),
new ChosenActionGenerator(), new ChosenActionGenerator(),
new BuildStampGenerator() new BuildStampGenerator(),
new BlankGenerator(),
new NewLineGenerator()
}; };
public SimpleGeneratorRecognizer(){ public SimpleGeneratorRecognizer(){
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<vdt-project> <vdt-project>
<interface name="RemoteInterface" extends="project_interface"> <interface name="RemoteInterface" extends="project_interface">
<syntax name="ProgramSyntax" format="%(%%ParamValue%|\n%)" /> <syntax name="ProgramSyntax" format="%(%%ParamValue%|\n%)" />
</interface> </interface>
<tool name = "RemotePython" <tool name="RemotePython" project="FPGA_project" label="RemotePython"
project = "FPGA_project" shell="/bin/bash" interface="RemoteInterface" description="Launching remote Python in console"
label = "RemotePython" errors="(.*):([0-9]+): [a-z ]*error: (.*)" warnings="(.*):([0-9]+): warning: (.*)"
shell = "/bin/bash" info="(.*):([0-9]+): info: (.*)"> <!--does not actually exist -->
interface = "RemoteInterface" <extensions-list>
description = "Launching remote Python in console" <extension mask="v" />
errors = "(.*):([0-9]+): [a-z ]*error: (.*)" <extension mask="tf" />
warnings = "(.*):([0-9]+): warning: (.*)" </extensions-list>
info = "(.*):([0-9]+): info: (.*)"> <!--does not actually exist -->
<extensions-list>
<extension mask="v"/>
<extension mask="tf"/>
</extensions-list>
<action-menu> <action-menu>
<action label="Remote Python" resource="" icon="python.png" /> <action label="Remote Python" resource="" icon="python.png" />
</action-menu> </action-menu>
<parameter id = "RemoteHost" <parameter id="RemoteHost" label="Remote Host IP" type="String"
label = "Remote Host IP" format="CopyValue" default="192.168.0.66" readonly="false" visible="true" />
type = "String"
format = "CopyValue"
default = "192.168.0.66" <parameter id="RemoteUser" label="Remote user name" type="String"
readonly = "false" format="CopyValue" default="" readonly="false" visible="true" />
visible = "true"/>
<parameter id="PreSSH" label="pre-ssh shell parameters"
type="String" format="CopyValue" default="" readonly="false" visible="true" />
<parameter id = "RemoteUser"
label = "Remote user name" <parameter id="ShellSwitches" label="Shell switches" type="String"
type = "String" format="CopyValue" default="-c" readonly="false" visible="true" />
format = "CopyValue"
default = "" <parameter id="SSHSwitches" label="Remote ssh switches"
readonly = "false" type="String" format="CopyValue" default="" readonly="false" visible="true" />
visible = "true"/>
<parameter id = "PreSSH" <parameter id="RemoteCommand" label="Remote ssh command"
label = "pre-ssh shell parameters" type="String" format="CopyValue" default="python -i -u" readonly="false"
type = "String" visible="true" />
format = "CopyValue"
default = "" <parameter id="SSHExtra" label="ssh extra parameters" type="String"
readonly = "false" format="CopyValue" default="" readonly="false" visible="true" />
visible = "true"/>
<input>
<parameter id = "ShellSwitches" <group name="General">
label = "Shell switches" "RemoteHost"
type = "String" "RemoteUser"
format = "CopyValue" "ShellSwitches"
default = "-c" "PreSSH"
readonly = "false" "SSHSwitches"
visible = "true"/> "RemoteCommand"
"SSHExtra"
<parameter id = "SSHSwitches" </group>
label = "Remote ssh switches" </input>
type = "String"
format = "CopyValue" <output>
default = "" <line name="command_line">
readonly = "false" "%ShellSwitches"
visible = "true"/> "%PreSSH"
"ssh"
"-l"
<parameter id = "RemoteCommand" "%RemoteUser"
label = "Remote ssh command" "%RemoteHost"
type = "String" "%SSHSwitches"
format = "CopyValue" "'"
default = "python -i -u" "%RemoteCommand"
readonly = "false" "'"
visible = "true"/> "%SSHExtra"
</line>
<parameter id = "SSHExtra" </output>
label = "ssh extra parameters" </tool>
type = "String" <tool name="RemotePythonCommand" project="FPGA_project" label="RemotePythonCommand"
format = "CopyValue" shell="/bin/bash" interface="RemoteInterface"
default = "" description="Sending command to a ermote Python session" errors="(.*):([0-9]+): [a-z ]*error: (.*)"
readonly = "false" warnings="(.*):([0-9]+): warning: (.*)" info="(.*):([0-9]+): info: (.*)"> <!--does not actually exist -->
visible = "true"/> <extensions-list>
<extension mask="v" />
<input> <extension mask="tf" />
<group name="General"> </extensions-list>
"RemoteHost"
"RemoteUser"
"ShellSwitches"
"PreSSH"
"SSHSwitches"
"RemoteCommand"
"SSHExtra"
</group>
</input>
<output>
<line name="command_line">
"%ShellSwitches"
"%PreSSH"
"ssh"
"-l"
"%RemoteUser"
"%RemoteHost"
"%SSHSwitches"
"'"
"%RemoteCommand"
"'"
"%SSHExtra"
</line>
</output>
</tool>
<tool name = "RemotePythonCommand"
project = "FPGA_project"
label = "RemotePythonCommand"
shell = "/bin/bash"
interface = "RemoteInterface"
description = "Sending command to a ermote Python session"
errors = "(.*):([0-9]+): [a-z ]*error: (.*)"
warnings = "(.*):([0-9]+): warning: (.*)"
info = "(.*):([0-9]+): info: (.*)"> <!--does not actually exist -->
<extensions-list>
<extension mask="v"/>
<extension mask="tf"/>
</extensions-list>
<action-menu> <action-menu>
<action label="Remote Python Command" resource="" icon="python.png" /> <action label="Remote Python Command" resource="" icon="python.png" />
</action-menu> </action-menu>
<parameter id = "RemoteCommand" <parameter id="RemoteCommand" label="Remote Command to send"
label = "Remote Command to send" type="Stringlist" format="ProgramSyntax" default="print &quot;Hello, World!, 2*2=&quot;,2*2"
type = "Stringlist" readonly="false" visible="true" />
format = "ProgramSyntax"
default = "print &quot;Hello, World!, 2*2=&quot;,2*2"
readonly = "false"
visible = "true"/>
<parameter id="python_console_name" default="RemotePython" <parameter id="python_console_name" default="RemotePython"
type="String" format="CopyValue" visible="false" /> type="String" format="CopyValue" visible="false" />
<input> <input>
<group name="General"> <group name="General">
"RemoteCommand" "RemoteCommand"
</group> </group>
</input> </input>
<output> <output>
<line name="command_line"> <line name="command_line_01">
"-c" "-c"
"echo 'Nothing to do, sleeping 5' ;" "echo 'Nothing to do, sleeping 5' ;"
"sleep 5 ;" "sleep 5 ;"
"echo 'Nothing to do, awakening' ;" "echo 'Nothing to do, awakening' ;"
</line> </line>
<line name="console_line" dest="python_console_name" sep="\n"> <!-- prompt: recognizer should trim spaces too -->
"%RemoteCommand" <!-- stdout - both with stderr, stderr only ..., both to the same - to separate console instances -->
</line> <line name="console_line_01"
<line name="command_line"> dest="python_console_name"
"-c" mark="``"
"echo 'Nothing to do second time, sleeping 10' ;" sep="\n"
"sleep 10 ;" prompt=">>>"
"echo 'Nothing to do again, awakening after sleep 10' ;" stdout="parser_001">
</line> "%RemoteCommand"
</output> "``" <!-- two new lines should generate a pair of prompts from the remote -->
</line>
</tool> <line name="command_line_02">
"-c"
"echo 'Nothing to do second time, sleeping 10' ;"
"sleep 10 ;"
"echo 'Nothing to do again, awakening after sleep 10' ;"
</line>
<!-- parser_01 being referenced should be launched in an asynchronous process/console, removed from the launch sequence -->
<line name="parser_001"
errors="(.*):([0-9]+): [a-z ]*error: (.*)"
warnings="(.*):([0-9]+): warning: (.*)"
info="(.*):([0-9]+): info: (.*)">
"-c"
"grep --line-buffered 'End'"
</line>
</output>
</tool>
</vdt-project> </vdt-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