Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
compilerconstruction
ssm
Commits
cb32ce27
Commit
cb32ce27
authored
Apr 17, 2019
by
Edoardo Putti
Committed by
Mart Lubbers
Dec 17, 2019
Browse files
clean some trash formatting in runnner
parent
1377da8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/nl/uu/cs/ssmui/Runner.java
View file @
cb32ce27
...
...
@@ -19,25 +19,22 @@ import javax.swing.UIManager;
import
nl.uu.cs.ssm.Config
;
public
class
Runner
extends
Thread
{
public
class
Runner
extends
Thread
{
protected
int
delay
=
50
;
SSMRunner
ssmRunner
;
public
Runner
(
int
delay
)
{
SSMRunner
ssmRunner
;
public
Runner
(
int
delay
)
{
this
.
delay
=
delay
;
try
{
try
{
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
());
}
catch
(
Exception
e
)
{
}
ssmRunner
=
new
SSMRunner
(
this
);
ssmRunner
.
initComponents
();
ssmRunner
.
setVisible
(
true
);
ssmRunner
.
requestFocus
()
;
try
{
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
());
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Could not set GUI appearance from system"
);
}
ssmRunner
=
new
SSMRunner
(
this
);
ssmRunner
.
initComponents
();
ssmRunner
.
setVisible
(
true
);
ssmRunner
.
requestFocus
()
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -66,13 +63,11 @@ public class Runner extends Thread
System
.
exit
(
1
);
}
public
void
run
()
{
while
(
true
)
{
public
void
run
()
{
while
(
true
)
{
int
steppingState
=
ssmRunner
.
steppingState
()
;
if
(
steppingState
!=
SSMRunner
.
STEP_BY_STEP
)
{
// handle emulation direction
if
(
steppingState
!=
SSMRunner
.
STEP_BY_STEP
)
{
if
(
ssmRunner
.
hasBreakpointAtPC
()
)
ssmRunner
.
stopContinuouslyDoingSteps
()
;
else
if
(
steppingState
==
SSMRunner
.
STEP_CONT_FORWARD
)
...
...
@@ -80,17 +75,22 @@ public class Runner extends Thread
else
if
(
steppingState
==
SSMRunner
.
STEP_CONT_BACKWARD
)
ssmRunner
.
doAStepBack
()
;
}
try
{
sleep
(
delay
)
;
}
catch
(
InterruptedException
e
)
{}
// try to wait for the delay
try
{
sleep
(
delay
);
}
catch
(
InterruptedException
e
)
{
System
.
err
.
println
(
"-- woke up too early"
);
}
}
}
// Main entry point
static
public
void
main
(
String
[]
args
)
throws
IOException
{
File
initialFile
=
null
;
long
steps
=
-
1
;
boolean
stdin
=
false
;
boolean
cli
=
false
;
int
guiDelay
=
50
;
int
guiDelay
=
50
;
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
String
key
=
args
[
i
];
switch
(
key
)
{
...
...
@@ -106,15 +106,15 @@ public class Runner extends Thread
steps
=
Long
.
parseLong
(
args
[
i
]);
break
;
case
"--stdin"
:
if
(
initialFile
!=
null
)
{
System
.
out
.
println
(
"--stdin cannot be used with --file"
);
stdin
=
true
;
if
(
initialFile
!=
null
)
{
System
.
err
.
println
(
"--stdin cannot be used with --file"
);
usage
();
}
stdin
=
true
;
break
;
case
"--file"
:
if
(
stdin
)
{
System
.
out
.
println
(
"--file cannot be used with --stdin"
);
if
(
stdin
)
{
System
.
err
.
println
(
"--file cannot be used with --stdin"
);
usage
();
}
else
{
i
++;
...
...
@@ -133,36 +133,35 @@ public class Runner extends Thread
}
}
if
(
initialFile
!=
null
&&
!
initialFile
.
exists
())
{
System
.
out
.
println
(
"
I
nput file
does not exist"
);
if
(
initialFile
!=
null
&&
!
initialFile
.
exists
())
{
System
.
err
.
println
(
"
No i
nput file
"
+
initialFile
);
usage
();
}
if
(
cli
)
{
CliRunner
cliRunner
=
new
CliRunner
(
steps
);
if
(
stdin
)
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
cliRunner
.
load
(
reader
);
reader
.
close
();
}
else
{
if
(!
stdin
&&
initialFile
==
null
)
{
System
.
out
.
println
(
"Need some input in CLI mode"
);
}
FileReader
fr
=
new
FileReader
(
initialFile
)
;
cliRunner
.
load
(
fr
);
fr
.
close
();
if
(
cli
)
{
CliRunner
cliRunner
=
new
CliRunner
(
steps
);
if
(
stdin
)
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
cliRunner
.
load
(
reader
);
reader
.
close
();
}
else
{
if
(!
stdin
&&
initialFile
==
null
)
{
System
.
err
.
println
(
"Need some input in CLI mode"
);
}
FileReader
fr
=
new
FileReader
(
initialFile
)
;
cliRunner
.
load
(
fr
);
fr
.
close
();
}
cliRunner
.
run
();
}
else
{
Runner
r
=
new
Runner
(
guiDelay
);
if
(
stdin
)
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
r
.
loadReader
(
reader
);
reader
.
close
();
}
else
if
(
initialFile
!=
null
)
{
r
.
loadFile
(
initialFile
);
}
}
}
else
{
Runner
r
=
new
Runner
(
guiDelay
);
if
(
stdin
)
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
r
.
loadReader
(
reader
);
reader
.
close
();
}
else
if
(
initialFile
!=
null
)
{
r
.
loadFile
(
initialFile
);
}
}
}
}
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