Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vdt-plugin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
vdt-plugin
Commits
743b1642
Commit
743b1642
authored
Jan 28, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on communicating with remote program, capturing stderr/stdout to
separate external program
parent
ad2afc3e
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
571 additions
and
364 deletions
+571
-364
.gitignore
bin/.gitignore
+0
-1
VDT.java
src/com/elphel/vdt/VDT.java
+2
-0
LaunchCore.java
src/com/elphel/vdt/core/launching/LaunchCore.java
+4
-1
VDTLaunchConfigurationDelegate.java
...el/vdt/core/launching/VDTLaunchConfigurationDelegate.java
+3
-2
VDTRunner.java
src/com/elphel/vdt/core/launching/VDTRunner.java
+145
-22
VDTRunnerConfiguration.java
...com/elphel/vdt/core/launching/VDTRunnerConfiguration.java
+9
-0
CommandLinesNodeReader.java
...hel/vdt/core/tools/config/xml/CommandLinesNodeReader.java
+20
-7
XMLConfig.java
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
+13
-5
BuildParamsItem.java
src/com/elphel/vdt/core/tools/contexts/BuildParamsItem.java
+80
-13
Context.java
src/com/elphel/vdt/core/tools/contexts/Context.java
+85
-31
ChosenActionGenerator.java
...phel/vdt/core/tools/generators/ChosenActionGenerator.java
+11
-11
CurrentFileBaseGenerator.java
...l/vdt/core/tools/generators/CurrentFileBaseGenerator.java
+11
-18
CurrentFileGenerator.java
...lphel/vdt/core/tools/generators/CurrentFileGenerator.java
+11
-24
CommandLinesBlock.java
src/com/elphel/vdt/core/tools/params/CommandLinesBlock.java
+51
-29
FormatProcessor.java
src/com/elphel/vdt/core/tools/params/FormatProcessor.java
+3
-3
Parameter.java
src/com/elphel/vdt/core/tools/params/Parameter.java
+0
-45
SimpleGeneratorRecognizer.java
...e/tools/params/recognizers/SimpleGeneratorRecognizer.java
+3
-1
Remote.xml
tools/SimpleSamples/Remote.xml
+120
-151
No files found.
bin/.gitignore
View file @
743b1642
/com
/com
/BuildParamsItem.class
src/com/elphel/vdt/VDT.java
View file @
743b1642
...
@@ -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
src/com/elphel/vdt/core/launching/LaunchCore.java
View file @
743b1642
...
@@ -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()
...
...
src/com/elphel/vdt/core/launching/VDTLaunchConfigurationDelegate.java
View file @
743b1642
...
@@ -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
));
...
...
src/com/elphel/vdt/core/launching/VDTRunner.java
View file @
743b1642
...
@@ -39,6 +39,7 @@ import org.eclipse.core.runtime.SubProgressMonitor;
...
@@ -39,6 +39,7 @@ import org.eclipse.core.runtime.SubProgressMonitor;
import
org.eclipse.debug.core.DebugPlugin
;
import
org.eclipse.debug.core.DebugPlugin
;
import
org.eclipse.debug.core.ILaunch
;
import
org.eclipse.debug.core.ILaunch
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.debug.core.ILaunchConfiguration
;
import
org.eclipse.debug.core.IStreamListener
;
//import org.eclipse.debug.core.ILaunchConfiguration;
//import org.eclipse.debug.core.ILaunchConfiguration;
import
org.eclipse.debug.core.model.IProcess
;
import
org.eclipse.debug.core.model.IProcess
;
//import org.eclipse.debug.ui.DebugUITools;
//import org.eclipse.debug.ui.DebugUITools;
...
@@ -47,10 +48,12 @@ import org.eclipse.debug.core.model.IProcess;
...
@@ -47,10 +48,12 @@ import org.eclipse.debug.core.model.IProcess;
//import org.eclipse.ui.console.IPatternMatchListener;
//import org.eclipse.ui.console.IPatternMatchListener;
//import org.eclipse.ui.console.MessageConsole;
//import org.eclipse.ui.console.MessageConsole;
import
org.eclipse.debug.core.model.IStreamMonitor
;
import
org.eclipse.debug.core.model.IStreamsProxy
;
import
org.eclipse.debug.core.model.IStreamsProxy
;
import
org.eclipse.debug.ui.DebugUITools
;
import
org.eclipse.debug.ui.DebugUITools
;
import
org.eclipse.jface.util.IPropertyChangeListener
;
import
org.eclipse.jface.util.IPropertyChangeListener
;
import
org.eclipse.jface.util.PropertyChangeEvent
;
import
org.eclipse.jface.util.PropertyChangeEvent
;
import
org.eclipse.swt.graphics.Color
;
import
org.eclipse.ui.console.IConsole
;
import
org.eclipse.ui.console.IConsole
;
//import org.eclipse.debug.ui.console.IConsole;
//import org.eclipse.debug.ui.console.IConsole;
import
org.eclipse.ui.console.ConsolePlugin
;
import
org.eclipse.ui.console.ConsolePlugin
;
...
@@ -71,12 +74,6 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings;
...
@@ -71,12 +74,6 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings;
//import com.elphel.vdt.core.Utils;
//import com.elphel.vdt.core.Utils;
import
org.eclipse.ui.console.IConsoleListener
;
import
org.eclipse.ui.console.IConsoleListener
;
...
@@ -102,14 +99,12 @@ public class VDTRunner {
...
@@ -102,14 +99,12 @@ public class VDTRunner {
System
.
out
.
println
(
"***Addded console listeners"
);
System
.
out
.
println
(
"***Addded console listeners"
);
manager
.
addConsoleListener
(
new
IConsoleListener
(){
manager
.
addConsoleListener
(
new
IConsoleListener
(){
public
void
consolesAdded
(
IConsole
[]
consoles
){
public
void
consolesAdded
(
IConsole
[]
consoles
){
VDTRunner
runner
=
VDTLaunchUtil
.
getRunner
();
for
(
int
i
=
0
;
i
<
consoles
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
consoles
.
length
;
i
++){
System
.
out
.
println
(
"+++ Added: "
+
consoles
[
i
].
getName
());
System
.
out
.
println
(
"+++ Added: "
+
consoles
[
i
].
getName
());
// Only shows added consoles
// Only shows added consoles
}
}
}
}
public
void
consolesRemoved
(
IConsole
[]
consoles
){
public
void
consolesRemoved
(
IConsole
[]
consoles
){
VDTRunner
runner
=
VDTLaunchUtil
.
getRunner
();
for
(
int
i
=
0
;
i
<
consoles
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
consoles
.
length
;
i
++){
System
.
out
.
println
(
"--- Removed: "
+
consoles
[
i
].
getName
());
System
.
out
.
println
(
"--- Removed: "
+
consoles
[
i
].
getName
());
...
@@ -146,14 +141,16 @@ public class VDTRunner {
...
@@ -146,14 +141,16 @@ public class VDTRunner {
System
.
out
.
println
(
"Turned out nothing to do. Probably a bug"
);
System
.
out
.
println
(
"Turned out nothing to do. Probably a bug"
);
return
;
return
;
}
}
ILaunchConfiguration
configuration
=
runConfig
.
getConfiguration
();
// ILaunchConfiguration configuration=runConfig.getConfiguration();
BuildParamsItem
[]
argumentsItemsArray
=
VDTLaunchUtil
.
getArguments
(
configuration
);
// BuildParamsItem[] argumentsItemsArray = VDTLaunchUtil.getArguments(configuration); // calculates all parameters
BuildParamsItem
[]
argumentsItemsArray
=
runConfig
.
getArgumentsItemsArray
();
// uses already calculated
int
numItem
=
runConfig
.
getBuildStep
();
int
numItem
=
runConfig
.
getBuildStep
();
System
.
out
.
println
(
"--------- resuming "
+
consoleName
+
", numItem="
+
numItem
+
" ------------"
);
System
.
out
.
println
(
"--------- resuming "
+
consoleName
+
", numItem="
+
numItem
+
" ------------"
);
ILaunch
launch
=
runConfig
.
getLaunch
();
ILaunch
launch
=
runConfig
.
getLaunch
();
IProgressMonitor
monitor
=
runConfig
.
getMonitor
();
IProgressMonitor
monitor
=
runConfig
.
getMonitor
();
for
(;
numItem
<
argumentsItemsArray
.
length
;
numItem
++){
for
(;
numItem
<
argumentsItemsArray
.
length
;
numItem
++){
runConfig
.
setBuildStep
(
numItem
);
// was not updated if was not sleeping
List
<
String
>
toolArguments
=
new
ArrayList
<
String
>();
List
<
String
>
toolArguments
=
new
ArrayList
<
String
>();
List
<
String
>
arguments
=
argumentsItemsArray
[
numItem
].
getParamsAsList
();
List
<
String
>
arguments
=
argumentsItemsArray
[
numItem
].
getParamsAsList
();
if
(
arguments
!=
null
)
if
(
arguments
!=
null
)
...
@@ -165,10 +162,19 @@ public class VDTRunner {
...
@@ -165,10 +162,19 @@ public class VDTRunner {
runConsole
(
argumentsItemsArray
[
numItem
].
getConsoleName
(),
runConfig
,
launch
,
monitor
);
runConsole
(
argumentsItemsArray
[
numItem
].
getConsoleName
(),
runConfig
,
launch
,
monitor
);
continue
;
continue
;
}
}
if
(
argumentsItemsArray
[
numItem
].
getNameAsParser
()!=
null
){
// parsers should be launched by the console scripts, in parallel to them
System
.
out
.
println
(
"Skipping parser "
+
argumentsItemsArray
[
numItem
].
getNameAsParser
());
continue
;
}
// Launch the configuration - 1 unit of work
// Launch the configuration - 1 unit of work
// VDTRunner runner = VDTLaunchUtil.getRunner();
// VDTRunner runner = VDTLaunchUtil.getRunner();
IProcess
process
=
run
(
runConfig
,
launch
,
monitor
);
IProcess
process
=
run
(
runConfig
,
renderProcessLabel
(
runConfig
.
getToolName
()),
// toolname + (date)
launch
,
monitor
);
//Andrey: if there is a single item - launch asynchronously, if more - verify queue is empty
//Andrey: if there is a single item - launch asynchronously, if more - verify queue is empty
// will not change
// will not change
...
@@ -229,12 +235,25 @@ public class VDTRunner {
...
@@ -229,12 +235,25 @@ public class VDTRunner {
monitor
.
done
();
monitor
.
done
();
}
}
private
BuildParamsItem
getParser
(
VDTRunnerConfiguration
configuration
,
String
parserName
){
if
(
parserName
==
null
)
return
null
;
BuildParamsItem
[]
buildParamsItems
=
configuration
.
getArgumentsItemsArray
();
// uses already calculated
if
(
buildParamsItems
==
null
)
return
null
;
for
(
int
i
=
0
;
i
<
buildParamsItems
.
length
;
i
++){
if
(
parserName
.
equals
(
buildParamsItems
[
i
].
getNameAsParser
()))
return
buildParamsItems
[
i
];
}
return
null
;
}
public
IOConsole
runConsole
(
String
consolePrefix
public
IOConsole
runConsole
(
String
consolePrefix
,
VDTRunnerConfiguration
configuration
,
VDTRunnerConfiguration
configuration
,
ILaunch
launch
,
ILaunch
launch
,
IProgressMonitor
monitor
,
IProgressMonitor
monitor
)
throws
CoreException
{
)
throws
CoreException
{
int
numItem
=
configuration
.
getBuildStep
();
// BuildParamsItem buildParamsItem= VDTLaunchUtil.getArguments(configuration.getConfiguration())[numItem];
BuildParamsItem
buildParamsItem
=
configuration
.
getArgumentsItemsArray
()[
numItem
];
// uses already calculated
//TODO: Handle monitor
//TODO: Handle monitor
// Find console with name starting with consolePrefix
// Find console with name starting with consolePrefix
IConsoleManager
man
=
ConsolePlugin
.
getDefault
().
getConsoleManager
();
// debugging
IConsoleManager
man
=
ConsolePlugin
.
getDefault
().
getConsoleManager
();
// debugging
...
@@ -253,26 +272,114 @@ public class VDTRunner {
...
@@ -253,26 +272,114 @@ public class VDTRunner {
// try to send
// try to send
String
[]
arguments
=
configuration
.
getToolArguments
();
String
[]
arguments
=
configuration
.
getToolArguments
();
if
(
arguments
==
null
)
arguments
=
new
String
[
0
];
if
(
arguments
==
null
)
arguments
=
new
String
[
0
];
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_LAUNCHING
))
{
// System.out.println("patternErrors= \""+ configuration.getPatternErrors()+"\"");
// System.out.println("patternWarnings= \""+configuration.getPatternWarnings()+"\"");
// System.out.println("patternInfo= \"" +configuration.getPatternInfo()+"\"");
if
(
arguments
!=
null
){
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++){
System
.
out
.
println
(
"Console line "
+
i
+
" = \""
+
arguments
[
i
]+
"\""
);
}
}
}
log
(
"Writing to console "
+
iCons
.
getName
()+
":"
,
arguments
,
null
,
false
,
true
);
/* Appears in the console of the target Eclipse (immediately erased) */
log
(
"Writing to console "
+
iCons
.
getName
()+
":"
,
arguments
,
null
,
false
,
true
);
/* Appears in the console of the target Eclipse (immediately erased) */
log
(
"Writing to console "
+
iCons
.
getName
()+
":"
,
arguments
,
null
,
false
,
false
);
/* Appears in the console of the parent Eclipse */
log
(
"Writing to console "
+
iCons
.
getName
()+
":"
,
arguments
,
null
,
false
,
false
);
/* Appears in the console of the parent Eclipse */
// IOConsoleInputStream inStream= iCons.getInputStream();
// IOConsoleInputStream inStream= iCons.getInputStream();
IOConsoleOutputStream
outStream
=
iCons
.
newOutputStream
();
IOConsoleOutputStream
outStream
=
iCons
.
newOutputStream
();
IProcess
process
=((
ProcessConsole
)
iCons
).
getProcess
();
IProcess
process
=((
ProcessConsole
)
iCons
).
getProcess
();
IStreamsProxy
iStreamProxy
=
process
.
getStreamsProxy
();
IStreamsProxy
consoleInStreamProxy
=
process
.
getStreamsProxy
();
BuildParamsItem
stderrParser
=
getParser
(
configuration
,
buildParamsItem
.
getStderr
());
// re-parses all - why?
BuildParamsItem
stdoutParser
=
getParser
(
configuration
,
buildParamsItem
.
getStdout
());
System
.
out
.
println
(
"Using parser for stderr: "
+((
stderrParser
!=
null
)?
stderrParser
.
getNameAsParser
():
"none"
));
// actually may be the same as stdout
System
.
out
.
println
(
"Using parser for stdout: "
+((
stdoutParser
!=
null
)?
stdoutParser
.
getNameAsParser
():
"none"
));
// basically use
// IProcess process=run(configuration, launch, monitor);
// renderProcessLabel(configuration.getToolName()+":out")
IProcess
processErr
=
null
;
IProcess
processOut
=
null
;
IStreamsProxy
stdoutStreamProxy
=
null
;
IStreamsProxy
stderrStreamProxy
=
null
;
if
(
stdoutParser
!=
null
){
List
<
String
>
toolArgumentsStdout
=
new
ArrayList
<
String
>();
List
<
String
>
stdoutArguments
=
stdoutParser
.
getParamsAsList
();
if
(
stdoutArguments
!=
null
)
toolArgumentsStdout
.
addAll
(
stdoutArguments
);
// overwriting configuration, but this is done sequentially, so OK
configuration
.
setToolArguments
((
String
[])
toolArgumentsStdout
.
toArray
(
new
String
[
toolArgumentsStdout
.
size
()]));
processOut
=
run
(
configuration
,
renderProcessLabel
(
configuration
.
getToolName
()+
":out"
),
launch
,
null
);
//monitor);
stdoutStreamProxy
=
processOut
.
getStreamsProxy
();
//TODO: Add error parsers
}
if
(
stderrParser
!=
null
){
List
<
String
>
toolArgumentsStderr
=
new
ArrayList
<
String
>();
List
<
String
>
stderrArguments
=
stderrParser
.
getParamsAsList
();
if
(
stderrArguments
!=
null
)
toolArgumentsStderr
.
addAll
(
stderrArguments
);
// overwriting configuration, but this is done sequentially, so OK
configuration
.
setToolArguments
((
String
[])
toolArgumentsStderr
.
toArray
(
new
String
[
toolArgumentsStderr
.
size
()]));
processErr
=
run
(
configuration
,
renderProcessLabel
(
configuration
.
getToolName
()+
":err"
),
launch
,
null
);
//monitor);
stderrStreamProxy
=
processErr
.
getStreamsProxy
();
//TODO: Add error parsers
}
final
IStreamsProxy
fSendErrorsToStreamProxy
=(
stderrStreamProxy
!=
null
)?
stderrStreamProxy:
stdoutStreamProxy
;
final
IStreamsProxy
fSendOutputToStreamProxy
=
stdoutStreamProxy
;
// connect input streams of the parsers to the out from the console process
IStreamMonitor
consoleOutStreamMonitor
=
null
;
IStreamMonitor
consoleErrStreamMonitor
=
null
;
if
(
fSendErrorsToStreamProxy
!=
null
){
consoleErrStreamMonitor
=
consoleInStreamProxy
.
getErrorStreamMonitor
();
consoleErrStreamMonitor
.
addListener
(
new
IStreamListener
(){
public
void
streamAppended
(
String
text
,
IStreamMonitor
monitor
){
System
.
out
.
println
(
"Err:'"
+
text
+
"'"
);
try
{
fSendErrorsToStreamProxy
.
write
(
text
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"Can not write errors"
);
}
}
});
}
if
(
fSendOutputToStreamProxy
!=
null
){
consoleOutStreamMonitor
=
consoleInStreamProxy
.
getOutputStreamMonitor
();
consoleOutStreamMonitor
.
addListener
(
new
IStreamListener
(){
public
void
streamAppended
(
String
text
,
IStreamMonitor
monitor
){
System
.
out
.
println
(
"Out:'"
+
text
+
"'"
);
try
{
fSendOutputToStreamProxy
.
write
(
text
);
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"Can not write output"
);
}
}
});
}
try
{
try
{
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++){
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
LOCAL_ECHO
))
{
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
LOCAL_ECHO
))
{
outStream
.
setColor
(
new
Color
(
null
,
128
,
128
,
255
));
outStream
.
write
(
arguments
[
i
]+
"\n"
);
// writes to console itself
outStream
.
write
(
arguments
[
i
]+
"\n"
);
// writes to console itself
outStream
.
setColor
(
null
);
}
}
i
StreamProxy
.
write
(
arguments
[
i
]+
"\n"
);
consoleIn
StreamProxy
.
write
(
arguments
[
i
]+
"\n"
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"Can not write to outStream of console "
+
iCons
.
getName
());
System
.
out
.
println
(
"Can not write to outStream of console "
+
iCons
.
getName
());
}
}
return
iCons
;
return
iCons
;
}
}
...
@@ -317,6 +424,12 @@ public class VDTRunner {
...
@@ -317,6 +424,12 @@ public class VDTRunner {
return
DebugPlugin
.
exec
(
cmdLine
,
workingDirectory
,
envp
);
return
DebugPlugin
.
exec
(
cmdLine
,
workingDirectory
,
envp
);
}
}
private
String
combinePatterns
(
String
thisPattern
,
String
toolPattern
){
String
pattern
=
thisPattern
;
if
(
pattern
==
null
)
pattern
=
toolPattern
;
if
((
pattern
!=
null
)
&&
(
pattern
.
length
()==
0
))
pattern
=
null
;
return
pattern
;
}
/**
/**
* Launches a Verilog development tool as specified in the given
* Launches a Verilog development tool as specified in the given
* configuration, contributing results (processes), to the given
* configuration, contributing results (processes), to the given
...
@@ -328,6 +441,7 @@ public class VDTRunner {
...
@@ -328,6 +441,7 @@ public class VDTRunner {
* @exception CoreException if an exception occurs while launching
* @exception CoreException if an exception occurs while launching
*/
*/
public
IProcess
run
(
VDTRunnerConfiguration
configuration
public
IProcess
run
(
VDTRunnerConfiguration
configuration
,
String
consoleLabel
,
ILaunch
launch
,
ILaunch
launch
,
IProgressMonitor
monitor
,
IProgressMonitor
monitor
)
throws
CoreException
)
throws
CoreException
...
@@ -335,6 +449,12 @@ public class VDTRunner {
...
@@ -335,6 +449,12 @@ public class VDTRunner {
if
(
monitor
==
null
)
{
if
(
monitor
==
null
)
{
monitor
=
new
NullProgressMonitor
();
monitor
=
new
NullProgressMonitor
();
}
}
int
numItem
=
configuration
.
getBuildStep
();
// BuildParamsItem buildParamsItem= VDTLaunchUtil.getArguments(configuration.getConfiguration())[numItem];
BuildParamsItem
buildParamsItem
=
configuration
.
getArgumentsItemsArray
()[
numItem
];
// uses already calculated
String
patternErrors
=
combinePatterns
(
buildParamsItem
.
getErrors
(),
configuration
.
getPatternErrors
())
;
String
patternWarnings
=
combinePatterns
(
buildParamsItem
.
getWarnings
(),
configuration
.
getPatternWarnings
())
;
String
patternInfo
=
combinePatterns
(
buildParamsItem
.
getInfo
(),
configuration
.
getPatternInfo
())
;
IProgressMonitor
subMonitor
=
new
SubProgressMonitor
(
monitor
,
1
);
IProgressMonitor
subMonitor
=
new
SubProgressMonitor
(
monitor
,
1
);
subMonitor
.
beginTask
(
Txt
.
s
(
"Launch.Message.Launching"
),
2
);
subMonitor
.
beginTask
(
Txt
.
s
(
"Launch.Message.Launching"
),
2
);
...
@@ -344,9 +464,9 @@ public class VDTRunner {
...
@@ -344,9 +464,9 @@ public class VDTRunner {
String
[]
arguments
=
configuration
.
getToolArguments
();
String
[]
arguments
=
configuration
.
getToolArguments
();
boolean
isShell
=
configuration
.
getIsShell
();
boolean
isShell
=
configuration
.
getIsShell
();
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_LAUNCHING
))
{
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_LAUNCHING
))
{
System
.
out
.
println
(
"patternErrors= \""
+
configuration
.
getPatternErrors
()
+
"\""
);
System
.
out
.
println
(
"patternErrors= \""
+
patternErrors
+
"\""
);
System
.
out
.
println
(
"patternWarnings= \""
+
configuration
.
getPatternWarnings
()
+
"\""
);
System
.
out
.
println
(
"patternWarnings= \""
+
patternWarnings
+
"\""
);
System
.
out
.
println
(
"patternInfo= \""
+
configuration
.
getPatternInfo
()
+
"\""
);
System
.
out
.
println
(
"patternInfo= \""
+
patternInfo
+
"\""
);
System
.
out
.
println
((
isShell
?
"Shell"
:
"Tool"
)+
" to launch=\""
+
toolTolaunch
+
"\""
);
System
.
out
.
println
((
isShell
?
"Shell"
:
"Tool"
)+
" to launch=\""
+
toolTolaunch
+
"\""
);
if
(
arguments
!=
null
){
if
(
arguments
!=
null
){
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++){
...
@@ -420,11 +540,14 @@ public class VDTRunner {
...
@@ -420,11 +540,14 @@ public class VDTRunner {
IProcess
process
=
newProcess
(
launch
IProcess
process
=
newProcess
(
launch
,
p
,
p
// , renderProcessLabel(cmdLine)
// , renderProcessLabel(cmdLine)
,
renderProcessLabel
(
configuration
.
getToolName
())
,
consoleLabel
//
renderProcessLabel(configuration.getToolName())
,
getDefaultProcessAttrMap
(
configuration
));
,
getDefaultProcessAttrMap
(
configuration
));
parser
.
parserSetup
(
parser
.
parserSetup
(
configuration
,
configuration
,
process
process
,
patternErrors
,
patternWarnings
,
patternInfo
);
);
subMonitor
.
worked
(
1
);
subMonitor
.
worked
(
1
);
...
@@ -500,7 +623,7 @@ public class VDTRunner {
...
@@ -500,7 +623,7 @@ public class VDTRunner {
*
*
* @return default process attribute map for Java processes
* @return default process attribute map for Java processes
*/
*/
protected
Map
getDefaultProcessAttrMap
(
VDTRunnerConfiguration
config
)
{
protected
Map
<
String
,
String
>
getDefaultProcessAttrMap
(
VDTRunnerConfiguration
config
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
// map.put(IProcess.ATTR_PROCESS_TYPE, Utils.getPureFileName(config.getToolToLaunch()));
// map.put(IProcess.ATTR_PROCESS_TYPE, Utils.getPureFileName(config.getToolToLaunch()));
map
.
put
(
IProcess
.
ATTR_PROCESS_TYPE
,
config
.
getToolName
());
map
.
put
(
IProcess
.
ATTR_PROCESS_TYPE
,
config
.
getToolName
());
...
...
src/com/elphel/vdt/core/launching/VDTRunnerConfiguration.java
View file @
743b1642
...
@@ -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
];
...
...
src/com/elphel/vdt/core/tools/config/xml/CommandLinesNodeReader.java
View file @
743b1642
...
@@ -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
);
}
}
}
}
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
View file @
743b1642
...
@@ -127,6 +127,14 @@ public class XMLConfig extends Config {
...
@@ -127,6 +127,14 @@ public class XMLConfig extends Config {
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"
;
...
...
src/com/elphel/vdt/core/tools/contexts/BuildParamsItem.java
View file @
743b1642
...
@@ -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
;
}
}
}
src/com/elphel/vdt/core/tools/contexts/Context.java
View file @
743b1642
...
@@ -204,62 +204,94 @@ public abstract class Context {
...
@@ -204,62 +204,94 @@ public abstract class Context {
if
(!
commandLinesBlock
.
isEnabled
())
if
(!
commandLinesBlock
.
isEnabled
())
continue
;
continue
;
String
destName
=
commandLinesBlock
.
getDestination
();
String
paramName
=
commandLinesBlock
.
getDestination
();
// Andrey debugging: null?
boolean
isConsoleName
=
commandLinesBlock
.
isConsoleKind
();
boolean
isConsoleName
=
commandLinesBlock
.
isConsoleKind
();
String
sep
=
commandLinesBlock
.
getSeparator
();
String
sep
=
commandLinesBlock
.
getSeparator
();
String
name
=
commandLinesBlock
.
getName
();
String
mark
=
commandLinesBlock
.
getMark
();
String
toolErrors
=
commandLinesBlock
.
getErrors
();
String
toolWarnings
=
commandLinesBlock
.
getWarnings
();
String
toolInfo
=
commandLinesBlock
.
getInfo
();
String
stderr
=
commandLinesBlock
.
getStderr
();
String
stdout
=
commandLinesBlock
.
getStdout
();
String
prompt
=
buildSimpleString
(
commandLinesBlock
.
getPrompt
());
if
((
prompt
!=
null
)
&&
(
mark
!=
null
))
prompt
=
prompt
.
replace
(
mark
,
""
);
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
<
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
();)
{
String
line
=
(
String
)
lineIter
.
next
();
String
line
=
(
String
)
lineIter
.
next
();
commandSequence
.
add
(
buildCommandString
(
line
));
// TODO: parses them here? VERIFY
commandSequence
.
add
(
buildCommandString
(
line
));
}
}
// parse prompt?
// Here - already resolved to empty
// Here - already resolved to empty
List
<
String
>
commandLineParams
=
new
ArrayList
<
String
>();
List
<
String
>
commandLineParams
=
new
ArrayList
<
String
>();
if
(
param
Name
!=
null
)
{
if
(
dest
Name
!=
null
)
{
Parameter
commandFileParam
=
findParam
(
paramName
);
Parameter
parName
=
findParam
(
destName
);
// command file or console name
String
controlFileName
=
commandFileParam
!=
null
?
String
controlFileName
=
parName
!=
null
?
commandFileParam
.
getValue
().
get
(
0
).
trim
()
:
null
;
parName
.
getValue
().
get
(
0
).
trim
()
:
null
;
if
(
isConsoleName
)
{
if
(
isConsoleName
)
{
// System.out.println("TODO: Enable console command generation here");
// System.out.println("TODO: Enable console command generation here");
printStringsToConsoleLine
(
commandLineParams
,
commandSequence
);
printStringsToConsoleLine
(
commandLineParams
,
commandSequence
,
mark
);
buildParamItems
.
add
(
buildParamItems
.
add
(
new
BuildParamsItem
(
new
BuildParamsItem
(
(
String
[])
commandLineParams
.
toArray
(
new
String
[
commandLineParams
.
size
()]),
(
String
[])
commandLineParams
.
toArray
(
new
String
[
commandLineParams
.
size
()]),
controlFileName
)
// find console beginning with this name, send commands there
controlFileName
,
// find console beginning with this name, send commands there
name
,
//nameAsParser
// mark,
toolErrors
,
toolWarnings
,
toolInfo
,
prompt
,
stderr
,
stdout
)
);
);
}
else
{
}
else
{
// processing command file
if
(
workingDirectory
!=
null
)
if
(
workingDirectory
!=
null
)
controlFileName
=
workingDirectory
+
File
.
separator
+
controlFileName
;
controlFileName
=
workingDirectory
+
File
.
separator
+
controlFileName
;
// check param type first
// check param type first
if
(!(
commandFileParam
.
getType
()
instanceof
ParamTypeString
))
if
(!(
parName
.
getType
()
instanceof
ParamTypeString
))
throw
new
ToolException
(
"Parameter '"
+
commandFileParam
.
getID
()
+
throw
new
ToolException
(
"Parameter '"
+
parName
.
getID
()
+
"' specified in the description of context '"
+
n
ame
+
"' specified in the description of context '"
+
parN
ame
+
"' must be of type '"
+
ParamTypeString
.
NAME
+
"'"
);
"' must be of type '"
+
ParamTypeString
.
NAME
+
"'"
);
// write strings to control file
// write strings to control file
boolean
controlFileExists
=
controlFileExists
(
controlFileName
);
boolean
controlFileExists
=
controlFileExists
(
controlFileName
);
printStringsToFile
(
controlFileName
,
controlFileExists
,
commandSequence
,
sep
);
printStringsToFile
(
controlFileName
,
controlFileExists
,
commandSequence
,
sep
,
mark
);
if
(!
controlFileExists
)
if
(!
controlFileExists
)
createdControlFiles
.
add
(
controlFileName
);
createdControlFiles
.
add
(
controlFileName
);
}
}
}
else
{
}
else
{
// processing command line
// TODO: will need multiple command lines // Andrey
printStringsToCommandLine
(
commandLineParams
,
commandSequence
,
mark
);
printStringsToCommandLine
(
commandLineParams
,
commandSequence
);
buildParamItems
.
add
(
buildParamItems
.
add
(
new
BuildParamsItem
(
new
BuildParamsItem
(
(
String
[])
commandLineParams
.
toArray
(
new
String
[
commandLineParams
.
size
()]),
(
String
[])
commandLineParams
.
toArray
(
new
String
[
commandLineParams
.
size
()]),
null
)
// external tool in a new console
null
,
// external tool in a new console
name
,
//nameAsParser
// mark,
toolErrors
,
toolWarnings
,
toolInfo
,
prompt
,
stderr
,
stdout
)
);
);
}
}
}
}
// return (String[])commandLineParams.toArray(new String[commandLineParams.size()]);
// keep names only for commands that are referenced in console scripts, others make null
Iterator
<
BuildParamsItem
>
buildParamItemsIter
=
buildParamItems
.
iterator
();
// command lines block is empty (yes, there is nothing in project output)
while
(
buildParamItemsIter
.
hasNext
())
{
BuildParamsItem
buildParamsItem
=
(
BuildParamsItem
)
buildParamItemsIter
.
next
();
buildParamsItem
.
removeNonParser
(
buildParamItems
);
}
return
(
BuildParamsItem
[])
buildParamItems
.
toArray
(
new
BuildParamsItem
[
buildParamItems
.
size
()]);
return
(
BuildParamsItem
[])
buildParamItems
.
toArray
(
new
BuildParamsItem
[
buildParamItems
.
size
()]);
}
}
...
@@ -276,6 +308,24 @@ public abstract class Context {
...
@@ -276,6 +308,24 @@ public abstract class Context {
return
processor
.
process
(
paramStringTemplate
);
return
processor
.
process
(
paramStringTemplate
);
}
}
protected
String
buildSimpleString
(
String
stringTemplate
)
throws
ToolException
{
if
(
stringTemplate
==
null
)
return
null
;
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
SimpleGeneratorRecognizer
(),
// new RepeaterRecognizer()
// new ContextParamRecognizer(this),
// new ContextParamRepeaterRecognizer(this)
});
List
<
String
>
result
=
processor
.
process
(
stringTemplate
);
if
(
result
.
size
()==
0
)
return
""
;
return
result
.
get
(
0
);
}
protected
void
initControlInterface
()
throws
ConfigException
{
protected
void
initControlInterface
()
throws
ConfigException
{
if
(
controlInterfaceName
!=
null
)
{
if
(
controlInterfaceName
!=
null
)
{
controlInterface
=
config
.
findControlInterface
(
controlInterfaceName
);
controlInterface
=
config
.
findControlInterface
(
controlInterfaceName
);
...
@@ -364,9 +414,11 @@ public abstract class Context {
...
@@ -364,9 +414,11 @@ public abstract class Context {
private
void
printStringsToFile
(
String
controlFileName
,
private
void
printStringsToFile
(
String
controlFileName
,
boolean
append
,
boolean
append
,
List
<
List
<
String
>>
commandString
,
List
<
List
<
String
>>
commandString
,
String
separator
)
String
separator
,
String
mark
)
throws
ToolException
throws
ToolException
{
{
boolean
useMark
=(
mark
!=
null
)
&&
(
mark
.
length
()>
0
);
FileOutputStream
outputStream
=
null
;
FileOutputStream
outputStream
=
null
;
try
{
try
{
...
@@ -391,8 +443,7 @@ public abstract class Context {
...
@@ -391,8 +443,7 @@ public abstract class Context {
if
(
s
.
length
()
==
0
)
if
(
s
.
length
()
==
0
)
continue
;
continue
;
out
.
print
(
useMark
?(
s
.
replace
(
mark
,
""
)):
s
);
out
.
print
(
s
);
written
+=
s
.
length
();
written
+=
s
.
length
();
writtenNow
+=
s
.
length
();
writtenNow
+=
s
.
length
();
...
@@ -421,28 +472,31 @@ public abstract class Context {
...
@@ -421,28 +472,31 @@ public abstract class Context {
}
}
private
void
printStringsToCommandLine
(
List
<
String
>
commandLineParams
,
private
void
printStringsToCommandLine
(
List
<
String
>
commandLineParams
,
List
<
List
<
String
>>
commandSequence
)
List
<
List
<
String
>>
commandSequence
,
String
mark
)
throws
ToolException
throws
ToolException
{
{
boolean
useMark
=(
mark
!=
null
)
&&
(
mark
.
length
()>
0
);
for
(
Iterator
<
List
<
String
>>
li
=
commandSequence
.
iterator
();
li
.
hasNext
();)
{
for
(
Iterator
<
List
<
String
>>
li
=
commandSequence
.
iterator
();
li
.
hasNext
();)
{
List
<
String
>
strList
=
(
List
<
String
>)
li
.
next
();
List
<
String
>
strList
=
(
List
<
String
>)
li
.
next
();
if
(
strList
.
size
()
>
0
)
{
if
(
strList
.
size
()
>
0
)
{
for
(
Iterator
<
String
>
si
=
strList
.
iterator
();
si
.
hasNext
();)
{
for
(
Iterator
<
String
>
si
=
strList
.
iterator
();
si
.
hasNext
();)
{
String
s
=
((
String
)
si
.
next
()).
trim
();
String
s
=
((
String
)
si
.
next
()).
trim
();
if
(!
s
.
equals
(
""
))
if
(!
s
.
equals
(
""
))
commandLineParams
.
add
(
s
);
commandLineParams
.
add
(
useMark
?(
s
.
replace
(
mark
,
""
)):
s
);
}
}
}
}
}
}
}
}
// Andrey: now is the same as command line, but will change to allow last element be prompt
// Andrey: now is the same as command line, but will change to allow last element be prompt
private
void
printStringsToConsoleLine
(
List
<
String
>
commandLineParams
,
private
void
printStringsToConsoleLine
(
List
<
List
<
String
>>
commandSequence
)
List
<
String
>
commandLineParams
,
throws
ToolException
List
<
List
<
String
>>
commandSequence
,
String
mark
)
throws
ToolException
{
{
boolean
useMark
=(
mark
!=
null
)
&&
(
mark
.
length
()>
0
);
for
(
Iterator
<
List
<
String
>>
li
=
commandSequence
.
iterator
();
li
.
hasNext
();)
{
for
(
Iterator
<
List
<
String
>>
li
=
commandSequence
.
iterator
();
li
.
hasNext
();)
{
List
<
String
>
strList
=
(
List
<
String
>)
li
.
next
();
List
<
String
>
strList
=
(
List
<
String
>)
li
.
next
();
...
@@ -451,7 +505,7 @@ public abstract class Context {
...
@@ -451,7 +505,7 @@ public abstract class Context {
String
s
=
((
String
)
si
.
next
()).
trim
();
String
s
=
((
String
)
si
.
next
()).
trim
();
if
(!
s
.
equals
(
""
))
if
(!
s
.
equals
(
""
))
commandLineParams
.
add
(
s
);
commandLineParams
.
add
(
useMark
?(
s
.
replace
(
mark
,
""
)):
s
);
}
}
}
}
}
}
...
...
src/com/elphel/vdt/core/tools/generators/ChosenActionGenerator.java
View file @
743b1642
/*******************************************************************************
/*******************************************************************************
* Copyright (c) 20
06 Elphel, Inc and Excelsior, LLC
.
* Copyright (c) 20
14 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
;
...
...
src/com/elphel/vdt/core/tools/generators/CurrentFileBaseGenerator.java
View file @
743b1642
/*******************************************************************************
/*******************************************************************************
* Copyright (c) 20
06 Elphel, Inc and Excelsior, LLC
.
* Copyright (c) 20
14 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
(
'.'
);
...
...
src/com/elphel/vdt/core/tools/generators/CurrentFileGenerator.java
View file @
743b1642
/*******************************************************************************
/*******************************************************************************
* Copyright (c) 20
06 Elphel, Inc and Excelsior, LLC
.
* Copyright (c) 20
14 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
())
{
...
...
src/com/elphel/vdt/core/tools/params/CommandLinesBlock.java
View file @
743b1642
...
@@ -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
String
getStderr
()
{
return
stderr
;
}
public
String
getStdout
()
{
return
stdout
;
}
public
boolean
isConsoleKind
()
{
return
kind
==
ParamTypeString
.
KIND
.
TEXT
;
}
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
(
""
);
}
}
...
...
src/com/elphel/vdt/core/tools/params/FormatProcessor.java
View file @
743b1642
...
@@ -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
);
}
}
}
}
...
...
src/com/elphel/vdt/core/tools/params/Parameter.java
View file @
743b1642
...
@@ -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
,
...
...
src/com/elphel/vdt/core/tools/params/recognizers/SimpleGeneratorRecognizer.java
View file @
743b1642
...
@@ -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
(){
...
...
tools/SimpleSamples/Remote.xml
View file @
743b1642
...
@@ -4,81 +4,42 @@
...
@@ -4,81 +4,42 @@
<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"
description =
"Launching remote Python in console"
errors =
"(.*):([0-9]+): [a-z ]*error: (.*)"
warnings =
"(.*):([0-9]+): warning: (.*)"
info =
"(.*):([0-9]+): info: (.*)"
>
<!--does not actually exist -->
<extensions-list>
<extensions-list>
<extension
mask=
"v"
/>
<extension
mask=
"v"
/>
<extension
mask=
"tf"
/>
<extension
mask=
"tf"
/>
</extensions-list>
</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"
/>
<parameter
id =
"ShellSwitches"
label =
"Shell switches"
type =
"String"
format =
"CopyValue"
default =
"-c"
readonly =
"false"
visible =
"true"
/>
<parameter
id =
"SSHSwitches"
label =
"Remote ssh switches"
type =
"String"
format =
"CopyValue"
default =
""
readonly =
"false"
visible =
"true"
/>
<parameter
id =
"RemoteCommand"
label =
"Remote ssh command"
type =
"String"
format =
"CopyValue"
default =
"python -i -u"
readonly =
"false"
visible =
"true"
/>
<parameter
id =
"SSHExtra"
label =
"ssh extra parameters"
type =
"String"
format =
"CopyValue"
default =
""
readonly =
"false"
visible =
"true"
/>
<input>
<input>
<group
name=
"General"
>
<group
name=
"General"
>
...
@@ -108,31 +69,22 @@
...
@@ -108,31 +69,22 @@
</line>
</line>
</output>
</output>
</tool>
</tool>
<tool
name =
"RemotePythonCommand"
<tool
name=
"RemotePythonCommand"
project=
"FPGA_project"
label=
"RemotePythonCommand"
project =
"FPGA_project"
shell=
"/bin/bash"
interface=
"RemoteInterface"
label =
"RemotePythonCommand"
description=
"Sending command to a ermote Python session"
errors=
"(.*):([0-9]+): [a-z ]*error: (.*)"
shell =
"/bin/bash"
warnings=
"(.*):([0-9]+): warning: (.*)"
info=
"(.*):([0-9]+): info: (.*)"
>
<!--does not actually exist -->
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>
<extensions-list>
<extension
mask=
"v"
/>
<extension
mask=
"v"
/>
<extension
mask=
"tf"
/>
<extension
mask=
"tf"
/>
</extensions-list>
</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 "Hello, World!, 2*2=",2*2"
type =
"Stringlist"
readonly=
"false"
visible=
"true"
/>
format =
"ProgramSyntax"
default =
"print "Hello, World!, 2*2=",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"
/>
...
@@ -144,21 +96,38 @@
...
@@ -144,21 +96,38 @@
</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 -->
<!-- stdout - both with stderr, stderr only ..., both to the same - to separate console instances -->
<line
name=
"console_line_01"
dest=
"python_console_name"
mark=
"``"
sep=
"\n"
prompt=
">>>"
stdout=
"parser_001"
>
"%RemoteCommand"
"%RemoteCommand"
"``"
<!-- two new lines should generate a pair of prompts from the remote -->
</line>
</line>
<line
name=
"command_line
"
>
<line
name=
"command_line_02
"
>
"-c"
"-c"
"echo 'Nothing to do second time, sleeping 10' ;"
"echo 'Nothing to do second time, sleeping 10' ;"
"sleep 10 ;"
"sleep 10 ;"
"echo 'Nothing to do again, awakening after sleep 10' ;"
"echo 'Nothing to do again, awakening after sleep 10' ;"
</line>
</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>
</output>
</tool>
</tool>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment