From 0b7f9147ea7951ccbbd5204ef32ce4cca49ac56f Mon Sep 17 00:00:00 2001 From: Willem Date: Wed, 8 Jan 2025 15:15:28 +0100 Subject: [PATCH] Named some DEC controls --- .../o2o/fc18/FourCornerUnicodeDisplay.java | 4 +- .../o2o/fc18/zero33/FCDotDEC1604DashP7.java | 89 ++++++++++--------- ...Test.java => FCDotAPL1604DashP8LTest.java} | 2 +- ...Test.java => FCDotBYD1604DashP8HTest.java} | 22 ++++- .../fc18/zero33/FCDotDEC1604DashP7Test.java | 49 ++++++++++ 5 files changed, 121 insertions(+), 45 deletions(-) rename nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/{FCDotAPL1604DashS6Test.java => FCDotAPL1604DashP8LTest.java} (98%) rename nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/{FCDotBYD1604DashC6Test.java => FCDotBYD1604DashP8HTest.java} (74%) create mode 100644 nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java index 9f96ac0..c645799 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplay.java @@ -81,11 +81,11 @@ public class FourCornerUnicodeDisplay { mapPoints(); } - static FourCornerUnicodeDisplay text() { + static public FourCornerUnicodeDisplay text() { return text(false, true); } - static FourCornerUnicodeDisplay raw() { + static public FourCornerUnicodeDisplay raw() { return text(true, false); } 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 425e1df..6cf0936 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 @@ -53,20 +53,20 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner /// On 6/8 bit escape to 18 bit four corner. /// Stream six octals as CDC chars in NX01_A to NX08_H, until any out of range P6. __ESC68_FC18, - /// Lower case escape code for only ONE next char is NX01_A to NX06_Z for all systems. + /// Escape below for VT-52 lower case escape code, the one next char is NX01_A to NX06_Z for all systems. + /// 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, UNDEFINED__TAG_CURLY_LEFT, - /// C1 char [ = CSI = Control Sequence Introducer - UNDEFINED__TAG_SQUARE_LEFT, - UNDEFINED__TAG_ROUND_LEFT, - UNDEFINED__TAG_COMPARE_LEFT, UNDEFINED__TAG_CURLY_RIGHT, - /// C1 char ] = OSC = Operating System Command + /// ANSI C1 char [ = CSI = Control Sequence Introducer + RESERVED_ANSI_CSI, UNDEFINED__TAG_SQUARE_RIGHT, + UNDEFINED__TAG_ROUND_LEFT, UNDEFINED__TAG_ROUND_RIGHT, + UNDEFINED__TAG_COMPARE_LEFT, UNDEFINED__TAG_COMPARE_RIGHT, UNDEFINED___TILDE, UNDEFINED___PLUS, @@ -79,44 +79,44 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner UNDEFINED___APOSTROPHE, UNDEFINED___QUOTATION, UNDEFINED___BACKTICK, - /// C1 char ^ = PM = Privacy Message UNDEFINED___CARET, UNDEFINED___EQUALS, UNDEFINED___HASH, UNDEFINED___DOLLAR, UNDEFINED___PERCENT, UNDEFINED__BAR_VERTICAL, - /// C1 char _ = APC = Application Program Command UNDEFINED__BAR_UNDER, - /// C1 char \ = ST = String Terminator UNDEFINED__BAR_V_LEFT, UNDEFINED__BAR_V_RIGHT, UNDEFINED___AT, - /// MSX CURSOR UP = VT-52 - UNDEFINED__NX01_A, - UNDEFINED__NX02_B, - UNDEFINED__NX03_C, - UNDEFINED__NX04_D, - UNDEFINED__NX05_E, + + /// VT-52 = ESC A = Cursor up + MSX_CURSOR_UP, + /// VT-52 = ESC B = Cursor down + MSX_CURSOR_DOWN, + /// VT-52 = ESC C = Cursor right + MSX_CURSOR_RIGHT, + /// VT-52 = ESC D = Cursor left + MSX_CURSOR_LEFT, + /// VT-52 = ESC E = Clear screen + MSX_CLEAR_SCREEN, + UNDEFINED__NX06_F, - /// C0 char G = BEL = Bell, 0x07 UNDEFINED__NX07_G, - /// C0 char H = BS = Backspace - UNDEFINED__NX08_H, - /// C0 char I = HT = Tab - UNDEFINED__NX09_I, - /// C0 char J = LF = Line Feed - UNDEFINED__NX10_J, - UNDEFINED__NX11_K, - /// C0 char L = FF = Form Feed - UNDEFINED__NX12_L, - /// C0 char M = CR = Carriage Return - UNDEFINED__NX13_M, - /// C1 char N = SS2 = Single Shift Two + /// VT-52 = ESC H = Cursor home + MSX_CURSOR_HOME, + /// VT-52 = ESC I = Cursor up and insert + MSX_CURSOR_UPSERT, + /// VT-52 = ESC J = Clear to end of screen + MSX_CLEAR_EOS, + /// VT-52 = ESC K = Clear to end of line + MSX_CLEAR_EOL, + /// VT-52 = ESC L = Insert line + MSX_INSERT_LINE, + /// VT-52 = ESC M = Delete line + MSX_DELETE_LINE, UNDEFINED__NX14_N, - /// C1 char O = SS3 = Single Shift Three UNDEFINED__NX15_O, - /// C1 char P = DCS = Device Control String UNDEFINED__NX16_P, UNDEFINED__NX17_Q, UNDEFINED__NX18_R, @@ -125,23 +125,30 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner UNDEFINED__NX21_U, UNDEFINED__NX22_V, UNDEFINED__NX23_W, - /// C1 char X = SOS = Start Of String UNDEFINED__NX24_X, - UNDEFINED__NX25_Y, + /// VT-52 = ESC Y = Set cursor position + MSX_CURSOR_GOTO, UNDEFINED__NX26_Z, UNDEFINED__NX27_AMPERSAND, + // + // C0 char G = BEL = Bell, 0x07 FIXME: UNDEFINED__NX27_AMPERSAND + // C0 char H = BS = Backspace FIXME: UNDEFINED__NX26_Z + // C0 char I = HT = Tab + // C0 char J = LF = Line Feed + // C0 char L = FF = Form Feed + // C0 char M = CR = Carriage Return // - // Encode 18 full 18 bit FC word in 6 bit !!! - // XXX_FOUR_CORNER(), + // C1 char [ = CSI = Control Sequence Introducer + // C1 char ] = OSC = Operating System Command + // C1 char ^ = PM = Privacy Message + // C1 char _ = APC = Application Program Command + // C1 char \ = ST = String Terminator + // C1 char N = SS2 = Single Shift Two + // C1 char O = SS3 = Single Shift Three + // C1 char P = DCS = Device Control String + // C1 char X = SOS = Start Of String // - // By escaping to 18 bit full FC, all other FC encodings can be handled (with a bit overhead) - // on a real computer, a 6 bit mainframe like a CDC1604. - // - // Historical glue for ansi codes ??? - // TAG_ANSI_UPPER, - // TAG_ANSI_LOWER, - // TAG_ANSI_C0, // bell,backspace,tab etc, // // Example VT52 see https://en.wikipedia.org/wiki/ANSI_escape_code // - ESC [ diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashS6Test.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashP8LTest.java similarity index 98% rename from nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashS6Test.java rename to nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashP8LTest.java index c4cd1cc..110a008 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashS6Test.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotAPL1604DashP8LTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; * @author Willem Cazander * @version 1.0 Jan 1, 2025 */ -public class FCDotAPL1604DashS6Test { +public class FCDotAPL1604DashP8LTest { @Test public void testValues() throws Exception { diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashC6Test.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashP8HTest.java similarity index 74% rename from nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashC6Test.java rename to nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashP8HTest.java index 33c0ae7..8360707 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashC6Test.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotBYD1604DashP8HTest.java @@ -22,11 +22,15 @@ */ package org.x4o.o2o.fc18.zero33; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import org.x4o.o2o.fc18.FourCornerUnicodeDisplay; +import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints; /** * Tests FCDotBYD1604DashC6 encoding. @@ -34,7 +38,7 @@ import org.junit.jupiter.api.Test; * @author Willem Cazander * @version 1.0 Dec 30, 2024 */ -public class FCDotBYD1604DashC6Test { +public class FCDotBYD1604DashP8HTest { @Test public void testValues() throws Exception { @@ -52,4 +56,20 @@ public class FCDotBYD1604DashC6Test { Assertions.assertTrue(global.size() > 1); Assertions.assertFalse(duplicate, "Duplicate ascii core value detected"); } + + @Test + public void testDisplay() throws Exception { + List cdc = new ArrayList<>(); + cdc.add(FCDotBYD1604DashP8H.BOX2_A); + cdc.add(FCDotBYD1604DashP8H.BOX2_B); + cdc.add(FCDotBYD1604DashP8H.BOX2_B); + cdc.add(FCDotBYD1604DashP8H.BOX2_A); + cdc.add(FCDotBYD1604DashP8H.BOX1_1); + cdc.add(FCDotBYD1604DashP8H.BOX1_3); + cdc.add(FCDotBYD1604DashP8H.BOX1_3); + cdc.add(FCDotBYD1604DashP8H.BOX1_7); + + Assertions.assertEquals("═╩╩═╵└└├", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); + } } + 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 new file mode 100644 index 0000000..95c7a6a --- /dev/null +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/zero33/FCDotDEC1604DashP7Test.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2004-2014, Willem Cazander + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and + * the following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.x4o.o2o.fc18.zero33; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * Tests FCDotCDC1604DashP6 encoding. + * + * @author Willem Cazander + * @version 1.0 Jan 08, 2025 + */ +public class FCDotDEC1604DashP7Test { + + @Test + public void testValues() throws Exception { + Assertions.assertEquals(64, FCDotDEC1604DashP7.length()); + Assertions.assertEquals(FCDotCDC1604DashP6.NX12_L.ordinal(), FCDotDEC1604DashP7.MSX_INSERT_LINE.ordinal()); + } + + @Test + public void baklavaSequence() throws Exception { + int[] seq = FCDotDEC1604DashP7.MSX_CURSOR_GOTO.baklavaPoints(); + Assertions.assertEquals(2, seq.length); + Assertions.assertEquals(FCDotCDC1604DashP6.__ESC6.ordinal(), seq[0]); + Assertions.assertEquals(FCDotCDC1604DashP6.NX25_Y.ordinal(), seq[1]); + } +}