diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash10.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash10.java index 57f940d..674724d 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash10.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash10.java @@ -22,6 +22,10 @@ */ package org.x4o.o2o.fc18.pie9c; +import java.util.ArrayList; +import java.util.List; +import java.util.PrimitiveIterator; + import org.x4o.o2o.fc18.FourCornerDotCake; import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints; import org.x4o.o2o.fc18.FourCornerX08MuffinPoints; @@ -73,4 +77,16 @@ public enum FCDotPIE9CDash10 implements FourCornerX06BaklavaPoints, FourCornerX0 public int[] codePoints() { return codePoints; } + + static public List toDecimals(int value) { + List result = new ArrayList<>(); + String valueStr = Integer.toString(value); + PrimitiveIterator.OfInt i = valueStr.codePoints().iterator(); + while (i.hasNext()) { + int chr = i.nextInt(); + int num = chr - '0'; + result.add(values()[num]); + } + return result; + } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java index f37f62e..4d19046 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7.java @@ -57,8 +57,11 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner /// NOTE: Other lower case chars in escape sequence needs to be encoded normally via __PIE68 and NX26_Z chars. __ESC_BELOW, - UNDEFINED__QUESTION, - UNDEFINED__EXCLAMATION, + /// VT-MSX4: char ? = Next argument separator + MSX4_ARGU_NEXT, + /// VT-MSX4: char ! = Argument end indicator + MSX4_ARGU_END, + UNDEFINED__TAG_CURLY_LEFT, UNDEFINED__TAG_CURLY_RIGHT, /// ANSI C1 char [ = CSI = Control Sequence Introducer @@ -126,8 +129,9 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner UNDEFINED__NX22_V, UNDEFINED__NX23_W, UNDEFINED__NX24_X, - /// VT-52 = ESC Y = Set cursor position - @Deprecated // TODO: on 6 bit this 64-32 = max 32, if normal a-& = max 27, thus redo VT encoding + /// VT-52 = ESC Y = Set cursor position + /// OLD is (char - 32) as int + /// NEW is __PIE68NXX10_J + MSX4_ARGU_NEXT + __PIE68NXX10_J + MSX4_ARGU_END MSX_CURSOR_GOTO, UNDEFINED__NX26_Z, UNDEFINED__NX27_AMPERSAND, diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java index 95c7a6a..c1dbed8 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java @@ -22,8 +22,14 @@ */ package org.x4o.o2o.fc18.zero33; +import java.util.ArrayList; +import java.util.List; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.x4o.o2o.fc18.FourCornerUnicodeDisplay; +import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints; +import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10; /** * Tests FCDotCDC1604DashP6 encoding. @@ -46,4 +52,18 @@ public class FCDotDEC1604DashP7Test { Assertions.assertEquals(FCDotCDC1604DashP6.__ESC6.ordinal(), seq[0]); Assertions.assertEquals(FCDotCDC1604DashP6.NX25_Y.ordinal(), seq[1]); } + + @Test + public void testCusorGoto() throws Exception { + List cdc = new ArrayList<>(); + cdc.add(FCDotDEC1604DashP7.MSX_CURSOR_GOTO); + cdc.addAll(FCDotPIE9CDash10.toDecimals(123)); + cdc.add(FCDotDEC1604DashP7.MSX4_ARGU_NEXT); + cdc.addAll(FCDotPIE9CDash10.toDecimals(456)); + cdc.add(FCDotDEC1604DashP7.MSX4_ARGU_END); + + Assertions.assertEquals("␃Y␁JB␁JC␁JD␃?␁JE␁JF␁JG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); + Assertions.assertEquals("␃Y123␃?456␃!", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); + } } +