From: Doni Pracner Date: Wed, 8 Jan 2014 22:10:27 +0000 (+0100) Subject: mjc2wsl - prints and reads, using the same code blocks, support spacings, prints... X-Git-Tag: v0.1.4~31 X-Git-Url: https://svarog.pmf.uns.ac.rs/gitweb/?a=commitdiff_plain;h=349aa12e360d3b0f056f20b7b1207e24d3aea2a4;p=mjc2wsl.git mjc2wsl - prints and reads, using the same code blocks, support spacings, prints in the same line everything, like MJVM --- 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; }