X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=mjc2wsl.git;a=blobdiff_plain;f=src%2Fmjc2wsl.java;h=14cc9e415809c6cc591e4b4bc8e187e72d1e282e;hp=d52dcfeea0f4a9274d739ef3b0caabe29b37fe1d;hb=c71486b667051ba56ee13c49f887822b61572748;hpb=877ef369343b37d3d8ac7d60339ac922407c63fc;ds=sidebyside diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java index d52dcfe..14cc9e4 100644 --- a/src/mjc2wsl.java +++ b/src/mjc2wsl.java @@ -694,7 +694,7 @@ public class mjc2wsl{ prl(createTopTwoEStack()); if (genInlinePrint){ prl(createComment("print spacing and transformation",C_SPEC)); - prl("PRINFLUSH(SUBSTR(\" \", 0, MIN(10, tempa - 1)), @List_To_String(< tempb >));"); + prl("PRINFLUSH(SUBSTR(\" \", 0, MIN(10, MAX(0,tempa-1))), @List_To_String(< tempb >));"); } else prl("Print_MJ_CHAR(tempb,tempa);"); prl(createEndVar()); @@ -707,7 +707,7 @@ public class mjc2wsl{ prl(createTopTwoEStack()); if (genInlinePrint){ prl(createComment("print spacing",C_SPEC)); - prl("PRINFLUSH(SUBSTR(\" \", 0, MIN(10, tempa - 1)), tempb);"); + prl("PRINFLUSH(SUBSTR(\" \", 0, MIN(10, MAX(0, tempa-1))), tempb);"); } else prl("Print_MJ(tempb,tempa);"); @@ -787,6 +787,10 @@ public class mjc2wsl{ public void printHelpDirectives(){ System.out.println("Alternatives for code generation:"); System.out.println(" --genPopPush generate POP/PUSH instead of TAIL/HEAD"); + System.out.println(" --genHeadTail generate TAIL/HEAD instead of POP/PUSH "); + System.out.println(); + System.out.println(" --genInlinePrint generate prints directly instead of procedure calls"); + System.out.println(" --genProcedurePrint generate prints as custom procedure calls"); } public void printHelpHelp() { @@ -861,6 +865,10 @@ public class mjc2wsl{ genPopPush = true; } else if (args[i].compareToIgnoreCase("--genInlinePrint") == 0) { genInlinePrint = true; + } else if (args[i].compareToIgnoreCase("--genHeadTail") == 0) { + genPopPush = false; + } else if (args[i].compareToIgnoreCase("--genProcedurePrint") == 0) { + genInlinePrint = false; } i++; }