Commit ebc4a900 authored by Joost Rijneveld's avatar Joost Rijneveld

Fixed curly brackets to adhere to file convention

parent 847d3774
......@@ -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;
......
......@@ -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;
......
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