Moved esc below to nether to embed dark data with type header
This commit is contained in:
parent
591cae0b86
commit
9187f82e4c
|
@ -187,15 +187,13 @@ public enum FourCornerDotCake {
|
||||||
__RESERVED_CLKSP(1 + FC_CLK1K_AMP.getStop(), 0x37000 - FC_CLK1K_AMP.getStop() - 1),
|
__RESERVED_CLKSP(1 + FC_CLK1K_AMP.getStop(), 0x37000 - FC_CLK1K_AMP.getStop() - 1),
|
||||||
|
|
||||||
/// Support lower 11 bit of unicode to be encoded with one cake point.
|
/// Support lower 11 bit of unicode to be encoded with one cake point.
|
||||||
__RESERVED_UNI1102_1C(1 + __RESERVED_CLKSP.getStop(), 2048),
|
FC_UNI1102_1C(1 + __RESERVED_CLKSP.getStop(), 2048),
|
||||||
/// Prefix "1C" cake with big indian 11 bit half words to get full 21 bit unicode-one point.
|
/// Prefix "1C" cake with big indian 11 bit half words to get full 21 bit unicode-one point.
|
||||||
__RESERVED_UNI1102_2C(1 + __RESERVED_UNI1102_1C.getStop(), 2048),
|
FC_UNI1102_2C(1 + FC_UNI1102_1C.getStop(), 2048),
|
||||||
|
|
||||||
/// Big indian 9 bit parts of 72 bit Unicode-4, which stroke drawing without color.
|
/// MUST Prefix with __ESC18_NETHER, than pack big indian octals per 5, which is 15 bit data in one 18 bit cake point.
|
||||||
/// and can contain the 21 bit unicode1 codePoint data within.
|
/// This can encode dark text data like icons, bitmap images or vector images and unicode4D/etc.
|
||||||
__RESERVED_UNI4072_4D(1 + __RESERVED_UNI1102_2C.getStop(), 512),
|
FC_NETHER(1 + FC_UNI1102_2C.getStop(), 262144 - FC_UNI1102_2C.getStop() - 1),
|
||||||
|
|
||||||
__RESERVED_TAIL(1 + __RESERVED_UNI4072_4D.getStop(), 262144 - __RESERVED_UNI4072_4D.getStop() - 1),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final int start;
|
private final int start;
|
||||||
|
|
|
@ -344,23 +344,12 @@ public class FourCornerUnicodeDisplay {
|
||||||
if (FCDotDEC1604DashP7.__ESC68_FC18.equals(decCode)) {
|
if (FCDotDEC1604DashP7.__ESC68_FC18.equals(decCode)) {
|
||||||
return decCode.ordinal(); // todo handle
|
return decCode.ordinal(); // todo handle
|
||||||
}
|
}
|
||||||
if (FCDotDEC1604DashP7.__ESC_BELOW.equals(decCode)) {
|
if (FCDotDEC1604DashP7.__ESC18_NETHER.equals(decCode)) {
|
||||||
if (!cdc.hasNext()) {
|
if (!cdc.hasNext()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int checkChr = cdc.next();
|
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));// TODO: add new symbol
|
||||||
int idx = checkChr - FCDotCDC1604DashP6.NX01_A.ordinal();
|
// TODO: eat header and eat data, as we can't display it
|
||||||
if (idx > 26 || idx < 0) {
|
|
||||||
return checkChr; // can't handle this
|
|
||||||
}
|
|
||||||
if (!renderHiddenControls) {
|
|
||||||
buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));
|
|
||||||
}
|
|
||||||
if (!renderLookup) {
|
|
||||||
return checkChr;
|
|
||||||
}
|
|
||||||
FCDotPIE9CDash26 lowCode = FCDotPIE9CDash26.values()[idx];
|
|
||||||
Arrays.stream(lowCode.codePoints()).forEach(v -> buf.appendCodePoint(v));
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!renderHiddenControls) {
|
if (!renderHiddenControls) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.List;
|
||||||
import java.util.PrimitiveIterator;
|
import java.util.PrimitiveIterator;
|
||||||
|
|
||||||
import org.x4o.o2o.fc18.FourCornerDotCake;
|
import org.x4o.o2o.fc18.FourCornerDotCake;
|
||||||
|
import org.x4o.o2o.fc18.FourCornerX00PetitVidePoints;
|
||||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||||
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
|
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
|
||||||
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
||||||
|
@ -78,14 +79,27 @@ public enum FCDotPIE9CDash10 implements FourCornerX06BaklavaPoints, FourCornerX0
|
||||||
return codePoints;
|
return codePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public List<FCDotPIE9CDash10> toDecimals(int value) {
|
static public List<FourCornerX06BaklavaPoints> toDecimalsX06(int value) {
|
||||||
List<FCDotPIE9CDash10> result = new ArrayList<>();
|
return toDecimalsX00(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static public List<FourCornerX18CakePoints> toDecimalsX18(int value) {
|
||||||
|
return toDecimalsX00(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
static private <T extends FourCornerX00PetitVidePoints> List<T> toDecimalsX00(int value) {
|
||||||
|
List<T> result = new ArrayList<>();
|
||||||
String valueStr = Integer.toString(value);
|
String valueStr = Integer.toString(value);
|
||||||
PrimitiveIterator.OfInt i = valueStr.codePoints().iterator();
|
PrimitiveIterator.OfInt i = valueStr.codePoints().iterator();
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
int chr = i.nextInt();
|
int chr = i.nextInt();
|
||||||
int num = chr - '0';
|
int num = chr - '0';
|
||||||
result.add(values()[num]);
|
if (result.isEmpty()) {
|
||||||
|
result.add((T) values()[num]); // Add escaping only once
|
||||||
|
} else {
|
||||||
|
result.add((T) FCDotCDC1604DashP6.indexOf(FCDotCDC1604DashP6.NX01_A.ordinal() + num));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
||||||
*
|
*
|
||||||
* A 8 or 18 or 144 bit computer uses this direct as the second 64 part page. (thus number 64 to 127)
|
* A 8 or 18 or 144 bit computer uses this direct as the second 64 part page. (thus number 64 to 127)
|
||||||
*
|
*
|
||||||
* NOTE: Old MSX is VT-52 see https://www.msx.org/wiki/MSX_Characters_and_Control_Codes#Escape_codes new MSX4 is VT-NX01
|
* Defines VT-NX01 which are terminal escape sequences for text based applications.
|
||||||
*
|
*
|
||||||
* @author Willem Cazander
|
* @author Willem Cazander
|
||||||
* @version 1.0 Dec 24, 2024
|
* @version 1.0 Dec 24, 2024
|
||||||
|
@ -50,17 +50,28 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner
|
||||||
/// Duel escape stops the escaped PIE or PIN escape sequence data mode.
|
/// Duel escape stops the escaped PIE or PIN escape sequence data mode.
|
||||||
/// VT-100 Manual: "ESC also cancels any escape sequence".
|
/// VT-100 Manual: "ESC also cancels any escape sequence".
|
||||||
__ESC_STOP,
|
__ESC_STOP,
|
||||||
/// On 6/8 bit escape to 18 bit four corner.
|
/// On 6/8 bit escape to 18 bit four corner cake points.
|
||||||
/// Stream six octals as CDC chars in NX01_A to NX08_H, until any out of range P6.
|
/// Stream per six octals as CDC chars in NX01_A to NX08_H, until any out of range P6.
|
||||||
__ESC68_FC18,
|
__ESC68_FC18,
|
||||||
/// Escape below for VT-52 lower case escape code, the one next char is NX01_A to NX06_Z for all systems.
|
/// To escape the question of undefined behavior, we define it as dark nether space, so we can see it in C++
|
||||||
/// NOTE: Other lower case chars in escape sequence needs to be encoded normally via __PIE68 and NX26_Z chars.
|
/// Using dark mode nether requires 18 bit cake points as we embed 15 bit data point in the cake;
|
||||||
__ESC_BELOW,
|
///
|
||||||
|
/// __ESC18_NETHER
|
||||||
|
/// + ?VT_NX01_NEXT + ?slug (None or 72 to 576 bit Número2 Lingua tree key per 72 bit slug)
|
||||||
|
/// + ?VT_NX01_NEXT + ?slug (Up to 8 slug arguments to have max key)
|
||||||
|
/// + VT_NX01_EXECUTE + data-block as FC_NETHER in 15 bit embedded octals
|
||||||
|
///
|
||||||
|
/// NOTE: key slug format is <6><6><6><9><6><6><6><6><6><6><9> encoded in FC_OCE0808_H6 and FC_OCE0808_H9
|
||||||
|
///
|
||||||
|
/// With dark nether space you can add unnamed and real dark(key is optional) undefined data segments in text.
|
||||||
|
/// With an nether DB enabled text editor, it can render for example vector graphics in source like HolyC of TempleOS.
|
||||||
|
/// The Número2 Lingua key is a sort of mime-type lookup, and later gets also definition structure and step code for type.
|
||||||
|
__ESC18_NETHER,
|
||||||
|
|
||||||
/// VT-NX01 = __ESC6 ? = Next argument separator
|
/// VT-NX01 = __ESC6 ? = Next argument separator
|
||||||
VT_NX01_NEXT,
|
VT_NX01_NEXT,
|
||||||
/// VT-NX01 = __ESC6 ! = End of P7 sequence started from NX01_A2Amp to execute the VT command.
|
/// VT-NX01 = __ESC6 ! = End of P7 sequence started from NX01_A2Amp to execute the VT command.
|
||||||
/// NOTE: Escape sequences below A have no end of sequence behavior defined.
|
/// NOTE: Designed to only be used in escape sequences in the letter range A to AMP.
|
||||||
VT_NX01_EXECUTE,
|
VT_NX01_EXECUTE,
|
||||||
|
|
||||||
UNDEFINED__TAG_CURLY_LEFT,
|
UNDEFINED__TAG_CURLY_LEFT,
|
||||||
|
@ -139,7 +150,7 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner
|
||||||
/// VT-NX01 = __ESC6 & + ?num/s + VT_NX01_EXECUTE = Ring the bells per second, one is one ring and two is two rings in one time unit
|
/// VT-NX01 = __ESC6 & + ?num/s + VT_NX01_EXECUTE = Ring the bells per second, one is one ring and two is two rings in one time unit
|
||||||
NX_BELL,
|
NX_BELL,
|
||||||
|
|
||||||
// MSX is simple VT-52 for reference;
|
// MSX is simple VT-52 for reference see https://www.msx.org/wiki/MSX_Characters_and_Control_Codes#Escape_codes
|
||||||
//
|
//
|
||||||
// ANSI CSI has dynamic termination;
|
// ANSI CSI has dynamic termination;
|
||||||
// - ESC [
|
// - ESC [
|
||||||
|
|
|
@ -35,10 +35,13 @@ public class FourCornerDotCakeTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValues() throws Exception {
|
public void testValues() throws Exception {
|
||||||
|
int sizeTotal = 0;
|
||||||
for (FourCornerDotCake v : FourCornerDotCake.values()) {
|
for (FourCornerDotCake v : FourCornerDotCake.values()) {
|
||||||
Assertions.assertNotNull(v);
|
Assertions.assertNotNull(v);
|
||||||
Assertions.assertTrue(v.getStart() <= v.getStop(), "Start is larger than stop in: " + v.name());
|
Assertions.assertTrue(v.getStart() <= v.getStop(), "Start is larger than stop in: " + v.name());
|
||||||
|
sizeTotal += v.getLength();
|
||||||
System.out.println("Cake start: 0x" + Integer.toHexString(v.getStart()) + " end: 0" + Integer.toHexString(v.getStop()) + " of " + v.name() + " size: " + v.getLength());
|
System.out.println("Cake start: 0x" + Integer.toHexString(v.getStart()) + " end: 0" + Integer.toHexString(v.getStop()) + " of " + v.name() + " size: " + v.getLength());
|
||||||
}
|
}
|
||||||
|
Assertions.assertEquals(262144, sizeTotal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,9 +102,8 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
cdc.add(FCDotPIE9CDash26.LOW_B); // if used as this per letter full escaping here....
|
cdc.add(FCDotPIE9CDash26.LOW_B); // if used as this per letter full escaping here....
|
||||||
cdc.add(FCDotCDC1604DashP6._SPACE); // out of range is end lower
|
cdc.add(FCDotCDC1604DashP6._SPACE); // out of range is end lower
|
||||||
cdc.add(FCDotCDC1604DashP6.NX02_B);
|
cdc.add(FCDotCDC1604DashP6.NX02_B);
|
||||||
cdc.add(FCDotDEC1604DashP7.__ESC_BELOW); // test escape code
|
|
||||||
cdc.add(FCDotCDC1604DashP6.NX03_C);
|
cdc.add(FCDotCDC1604DashP6.NX03_C);
|
||||||
cdc.add(FCDotCDC1604DashP6.NX04_D); // thus this upper case D
|
cdc.add(FCDotCDC1604DashP6.NX04_D);
|
||||||
cdc.add(FCDotCDC1604DashP6.DOT);
|
cdc.add(FCDotCDC1604DashP6.DOT);
|
||||||
cdc.add(FCDotCDC1604DashP6.__PIE68);
|
cdc.add(FCDotCDC1604DashP6.__PIE68);
|
||||||
cdc.add(FCDotCDC1604DashP6.NX26_Z); // select lower case
|
cdc.add(FCDotCDC1604DashP6.NX26_Z); // select lower case
|
||||||
|
@ -115,8 +114,8 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
cdc.add(FCDotDEC1604DashP7.__ESC_STOP);
|
cdc.add(FCDotDEC1604DashP7.__ESC_STOP);
|
||||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||||
|
|
||||||
Assertions.assertEquals("ab B␃cD.jklmO", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
Assertions.assertEquals("ab BCD.jklmO", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||||
Assertions.assertEquals("␁ZA␁ZB B␃CD.␁ZJKLM␃␃O", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
Assertions.assertEquals("␁ZA␁ZB BCD.␁ZJKLM␃␃O", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -57,12 +57,12 @@ public class FCDotDEC1604DashP7Test {
|
||||||
public void testCusorGoto() throws Exception {
|
public void testCusorGoto() throws Exception {
|
||||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||||
cdc.add(FCDotDEC1604DashP7.NX_CURSOR_GOTO);
|
cdc.add(FCDotDEC1604DashP7.NX_CURSOR_GOTO);
|
||||||
cdc.addAll(FCDotPIE9CDash10.toDecimals(123));
|
cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(123));
|
||||||
cdc.add(FCDotDEC1604DashP7.VT_NX01_NEXT);
|
cdc.add(FCDotDEC1604DashP7.VT_NX01_NEXT);
|
||||||
cdc.addAll(FCDotPIE9CDash10.toDecimals(456));
|
cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(456));
|
||||||
cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE);
|
cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE);
|
||||||
|
|
||||||
Assertions.assertEquals("␃Y␁JB␁JC␁JD␃?␁JE␁JF␁JG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
Assertions.assertEquals("␃Y␁JBCD␃?␁JEFG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||||
Assertions.assertEquals("␃Y123␃?456␃!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
Assertions.assertEquals("␃Y123␃?456␃!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class FCDotDEC1604DashP7Test {
|
||||||
public void testClearTop5Lines() throws Exception {
|
public void testClearTop5Lines() throws Exception {
|
||||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||||
cdc.add(FCDotDEC1604DashP7.NX_CLEAR_TOP);
|
cdc.add(FCDotDEC1604DashP7.NX_CLEAR_TOP);
|
||||||
cdc.addAll(FCDotPIE9CDash10.toDecimals(5));
|
cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(5));
|
||||||
cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE);
|
cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE);
|
||||||
|
|
||||||
Assertions.assertEquals("␃E␁JF␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
Assertions.assertEquals("␃E␁JF␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||||
|
|
Loading…
Reference in a new issue