Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ssm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wietze Mulder
ssm
Commits
ebc4a900
Commit
ebc4a900
authored
Jun 05, 2014
by
Joost Rijneveld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed curly brackets to adhere to file convention
parent
847d3774
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
15 deletions
+31
-15
src/nl/uu/cs/ssm/Machine.java
src/nl/uu/cs/ssm/Machine.java
+7
-3
src/nl/uu/cs/ssmui/SSMRunner.java
src/nl/uu/cs/ssmui/SSMRunner.java
+24
-12
No files found.
src/nl/uu/cs/ssm/Machine.java
View file @
ebc4a900
...
...
@@ -484,9 +484,12 @@ public class Machine
case
Instruction
.
TR_PR_CHAR
:
ByteBuffer
b
=
ByteBuffer
.
allocate
(
4
);
b
.
putInt
(
pop
());
try
{
try
{
messenger
.
println
(
""
+
new
String
(
b
.
array
(),
"UTF-32BE"
)
)
;
}
catch
(
UnsupportedEncodingException
e
)
{
}
catch
(
UnsupportedEncodingException
e
)
{
messenger
.
println
(
"Error: UTF-32 encoding missing."
);
}
break
;
...
...
@@ -498,7 +501,8 @@ public class Machine
break
;
case
Instruction
.
TR_IN_CHAR_ARRAY
:
push
(
0
);
for
(
int
i
:
messenger
.
promptCharArray
())
{
for
(
int
i
:
messenger
.
promptCharArray
())
{
push
(
i
);
}
break
;
...
...
src/nl/uu/cs/ssmui/SSMRunner.java
View file @
ebc4a900
...
...
@@ -657,44 +657,56 @@ public class SSMRunner extends JFrame
outputTextArea
.
append
(
"\n"
)
;
}
public
int
promptInt
()
{
while
(
true
)
{
try
{
public
int
promptInt
()
{
while
(
true
)
{
try
{
String
s
=
JOptionPane
.
showInputDialog
(
this
,
"Please enter an integer."
,
"Integer requested"
,
JOptionPane
.
QUESTION_MESSAGE
);
if
(
s
==
null
)
{
if
(
s
==
null
)
{
return
0
;
}
return
Integer
.
parseInt
(
s
);
}
catch
(
NumberFormatException
e
)
{
catch
(
NumberFormatException
e
)
{
continue
;
// Ask again
}
}
}
public
int
promptChar
()
{
while
(
true
)
{
public
int
promptChar
()
{
while
(
true
)
{
String
s
=
JOptionPane
.
showInputDialog
(
this
,
"Please enter a character."
,
"Character requested"
,
JOptionPane
.
QUESTION_MESSAGE
);
if
(
s
==
null
)
{
if
(
s
==
null
)
{
return
0
;
}
if
(
s
.
length
()
==
0
)
{
if
(
s
.
length
()
==
0
)
{
continue
;
}
return
s
.
codePointAt
(
0
);
}
}
public
int
[]
promptCharArray
()
{
public
int
[]
promptCharArray
()
{
String
s
=
JOptionPane
.
showInputDialog
(
this
,
"Please enter a string."
,
"String requested"
,
JOptionPane
.
QUESTION_MESSAGE
);
if
(
s
==
null
||
s
.
length
()
==
0
)
{
if
(
s
==
null
||
s
.
length
()
==
0
)
{
return
new
int
[
0
];
}
int
[]
result
=
new
int
[
s
.
length
()];
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
result
[
i
]
=
s
.
codePointAt
(
i
);
}
return
result
;
...
...
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