From 349aa12e360d3b0f056f20b7b1207e24d3aea2a4 Mon Sep 17 00:00:00 2001 From: Doni Pracner Date: Wed, 8 Jan 2014 23:10:27 +0100 Subject: [PATCH] mjc2wsl - prints and reads, using the same code blocks, support spacings, prints in the same line everything, like MJVM --- src/mjc2wsl.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index d098bd8..05a8a32 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -434,23 +434,24 @@ public class mjc2wsl{ break; } - //TODO read, print + // read, print + case bread: case read: { + //TODO make it a char for read prl("tempa := @String_To_Num(@Read_Line(Standard_Input_Port));"); prl(cmdToEStack("tempa")); break; } // the prints - case bprint: { - prl(getTopTwo()); - prl("PRINT(tempb);"); - break; - } + case bprint: case print: { - // TODO need to make it a char + // TODO need to make it a char on print + // TODO printing numbers needs different lengths of spacing prl(getTopTwo()); - prl("PRINT(tempb);"); + pr(createComment("print spacing",C_SPEC)); + prl("IF tempa>1 THEN FOR i:=2 TO tempa STEP 1 DO PRINFLUSH(\" \") OD FI;"); + prl("PRINFLUSH(tempb);"); break; } -- 2.25.1