Commit f0604f81 authored by Joost Rijneveld's avatar Joost Rijneveld

Reversed strings on the stack

parent 56d9c12a
...@@ -499,9 +499,10 @@ public class Machine ...@@ -499,9 +499,10 @@ public class Machine
break; break;
case Instruction.TR_IN_CHAR_ARRAY : case Instruction.TR_IN_CHAR_ARRAY :
push(0); push(0);
for (int i : messenger.promptCharArray()) int[] chars = messenger.promptCharArray();
for (int i = chars.length - 1; i >= 0; i--)
{ {
push(i); push(chars[i]);
} }
break; break;
case Instruction.TR_FILE_OPEN_READ : case Instruction.TR_FILE_OPEN_READ :
...@@ -513,7 +514,7 @@ public class Machine ...@@ -513,7 +514,7 @@ public class Machine
filename.append((char)n); filename.append((char)n);
n = pop(); n = pop();
} }
String fname = filename.reverse().toString(); String fname = filename.toString();
try try
{ {
boolean readOnly = state.inlineOpnds[0] == Instruction.TR_FILE_OPEN_READ; boolean readOnly = state.inlineOpnds[0] == Instruction.TR_FILE_OPEN_READ;
......
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