diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerDotCake.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerDotCake.java index 2465637..487c338 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerDotCake.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerDotCake.java @@ -75,7 +75,7 @@ public enum FourCornerDotCake { // =========== Allow pie terminators for symbols without escaping - FC_PIE9C_01(256 + 0, 1, FCDotPIE9CDash01.values()), + FC_PIE9C_01(256 + 0 , 1, FCDotPIE9CDash01.values()), FC_PIE9C_02(1 + FC_PIE9C_01.getStop(), 2, FCDotPIE9CDash02.values()), FC_PIE9C_03(1 + FC_PIE9C_02.getStop(), 3, FCDotPIE9CDash03.values()), FC_PIE9C_04(1 + FC_PIE9C_03.getStop(), 4, FCDotPIE9CDash04.values()), @@ -112,6 +112,21 @@ public enum FourCornerDotCake { /// Reserved for future data grams use __RESERVED_DATAGRAMS(1280, 1445-1280), + //FC_XXX0130_T2(1280, 30), + //FC_XXX0127_T1(1310, 27), + + //FC_XXX0116_S0(1337, 16), // Leave out, just the duel hex from FC_IBM1616_H8 + //FC_XXX0115_SF(1353, 15), + //FC_XXX0114_SE(1368, 14), + //FC_XXX0113_SD(1382, 13), + //FC_XXX0112_SC(1395, 12), + //FC_XXX0111_SB(1407, 11), // don't needs above 9, only 27 maybe... + + //FC_XXX0109_S9(1418, 9), + //FC_XXX0107_S7(1427, 7), + //FC_XXX0106_S6(1434, 6), + //FC_XXX0105_S5(1440, 5), + /// Direct Nuclear Air strike for quadratonic values FC_DNA0104_S4(1445, 4), /// Natural X-state Phasing for tri-state or high impedance (Hi-Z) signals @@ -128,18 +143,10 @@ public enum FourCornerDotCake { /// Octal Character Encoding in Hinari 9 bit FC_OCE0864_H9(1536, 512), - // =========== Allow big terminators to learn a computer math + // =========== Allow visible password as words in text - /// New Counting Rods, 0ptional Flags for math - FC_NCR1632_0F(2048, 512), - /// New Counting Rods, 0ptional prefix for terminator multiplier, biggest terminator is "2^(512*512)" which is very small. - /// 0M + (1T*0M) + (1V*M0) - FC_NCR1632_0M(2560, 512), - /// New Counting Rods, One or more terminator pie select as big indian. - /// Without FC_NCR1632_0M prefix, FC_NCR1632_0M.NXX_001 is selected for single 1T 9 bit select and one or many 1V cake point. - FC_NCR1632_1T(3072, 512), - /// New Counting Rods, One or more terminator values until out of range. - FC_NCR1632_1V(3584, 512), + /// Binary Informative Passwords, 2048 from a random 0039 seed sheet. + FC_BIP0039_2K(2048, 2048), // =========== Allow FileName/Variable/Class/Method/etc/etc to spelled correctly in any language @@ -147,9 +154,17 @@ public enum FourCornerDotCake { /// 4 or 5 decimals come from four corner index 0000.0 = 00000 = first word index = "head" = "亠" FC_WORDS(4096, 100000), /// Reserved four corner extra words - __RESERVED_WORDS_EXT1(4096+100000, 131072-100000-4096), // fc end = 2^17-1 - /// 50% mark, reserved for future use - __RESERVED_WORDS_EXT2(131072, 65536), // end = 131072+(2^16)-1 + __RESERVED_WORDS(4096+100000, 131072-100000-4096), // fc end = 2^17-1 + + // =========== Allow big terminators to learn a computer math + + /// New Counting Rods, Select an 9 bit denominator to use. + /// Divided in 64 nine bit banks, to select up to 576 bit denominator. + FC_NCR1632_XD(131072, 32768), + /// New Counting Rods, Use one or more 9 bit numerator values. + /// Divided in 64 nine bit banks, to select up to 576 bit numerator. + /// NOTE: Every lowest (512) numerator trigger a fraction. + FC_NCR1632_XN(131072+32768, 32768), // =========== Allow digital language constructs to be constants @@ -186,10 +201,12 @@ public enum FourCornerDotCake { /// Align unicode __RESERVED_CLKSP(1 + FC_CLK1K_AMP.getStop(), 0x37000 - FC_CLK1K_AMP.getStop() - 1), + // =========== Allow more data grams for legacy unicode and next generation unicode + + /// Optional select for the 11 bit half word, to get full 21 bit unicode-one point. + FC_UNI2K_22(0x37000, 2048), /// Support lower 11 bit of unicode to be encoded with one cake point. - FC_UNI1102_1C(0x37000, 2048), - /// Prefix "1C" cake with big indian 11 bit half words to get full 21 bit unicode-one point. - FC_UNI1102_2C(0x37800, 2048), + FC_UNI2K_11(0x37800, 2048), /// MUST Prefix with __ESC18_NETHER, than pack big indian octals per 5, which is 15 bit data in one 18 bit cake point. /// This can encode dark text data like icons, bitmap images or vector images and unicode4D/etc. @@ -222,6 +239,37 @@ public enum FourCornerDotCake { return stop - start + 1; } + public boolean containsNot(int cakePoint) { + return !contains(cakePoint); + } + + public boolean contains(int cakePoint) { + if (cakePoint < start) { + return false; + } + if (cakePoint > stop) { + return false; + } + return true; + } + + public boolean isExternWord() { + int idx = ordinal(); + if (idx < FC_IBM1616_H8.ordinal()) { + return false; + } + if (idx == FC_NCR1632_XD.ordinal()) { + return false; + } + if (idx == FC_NCR1632_XN.ordinal()) { + return false; + } + if (idx >= FC_UNI2K_22.ordinal()) { + return false; + } + return true; + } + public String qname() { String name = name(); if (name.startsWith("_")) { @@ -237,9 +285,9 @@ public enum FourCornerDotCake { } public static Optional valueOfInt18(int smurfPaint) { - for (FourCornerDotCake value:values()) { - if (smurfPaint >= value.getStart() && smurfPaint <= value.getStop()) { - return Optional.of(value); + for (FourCornerDotCake cakeSlice : values()) { + if (cakeSlice.contains(smurfPaint)) { + return Optional.of(cakeSlice); } } return Optional.empty(); 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 442a67c..59ec74a 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 @@ -22,45 +22,18 @@ */ package org.x4o.o2o.fc18; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Map; +import java.util.Objects; import java.util.function.Consumer; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash01; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash02; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash03; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash04; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash05; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash06; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash07; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash08; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash09; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash11; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash12; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash13; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash14; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash15; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash16; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash17; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash18; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash19; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash20; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash21; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash22; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash23; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash24; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash25; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash26; -import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash27; -import org.x4o.o2o.fc18.zero33.FCDotAPL1604DashP8L; -import org.x4o.o2o.fc18.zero33.FCDotBYD1604DashP8H; import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6; -import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7; +import org.x4o.o2o.fc18.zion7.FourCornerZionStenoLexer; +import org.x4o.o2o.fc18.zion7.FourCornerZionStenoLexerSmoke; +import org.x4o.o2o.fc18.zion7.FourCornerZion7Candlelier; import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord; /// Renders unicode from four corner 18 bit text. @@ -69,28 +42,26 @@ import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord; /// @version 1.0 Dec 28, 2024 public class FourCornerUnicodeDisplay { - private boolean renderHiddenControls = false; - private boolean renderLookup = true; + private boolean failUnsupported = false; + private boolean handleEscape = true; private String renderSeperator = null; - private final Map> int18To21 = new HashMap<>(); - private FourCornerUnicodeDisplay(boolean renderHiddenControls, boolean renderLookup, String renderSeperator) { - this.renderHiddenControls = renderHiddenControls; - this.renderLookup = renderLookup; + private FourCornerUnicodeDisplay(boolean failUnsupported, boolean handleEscape, String renderSeperator) { + this.failUnsupported = failUnsupported; + this.handleEscape = handleEscape; this.renderSeperator = renderSeperator; - mapPoints(); } static public FourCornerUnicodeDisplay text() { - return text(false, true); + return new FourCornerUnicodeDisplay(false, true, null); } static public FourCornerUnicodeDisplay raw() { - return text(true, false); + return new FourCornerUnicodeDisplay(false, false, null); } - static FourCornerUnicodeDisplay text(boolean renderHiddenControls, boolean renderLookup) { - return new FourCornerUnicodeDisplay(renderHiddenControls, renderLookup, null); + static FourCornerUnicodeDisplay text(String renderSeperator) { + return new FourCornerUnicodeDisplay(false, true, renderSeperator); } // static FourCornerUnicodeDisplay mixedᐧEskimo() { @@ -161,292 +132,129 @@ public class FourCornerUnicodeDisplay { } public void renderFromInt18(List chars, StringBuilder buf) { - Iterator cdc = chars.iterator(); - Integer numberModeLarge = null; - Integer numberMode = null; - boolean numberPIE = true; - boolean prevWord = false; - while (cdc.hasNext()) { - Integer cdcPoint = cdc.next(); - if (numberModeLarge != null && cdcPoint <= FourCornerDotCake.FC_NCR1632_1V.getStart() && cdcPoint >= FourCornerDotCake.FC_NCR1632_1V.getStop()) { - numberModeLarge = null; - } - if (cdcPoint >= FourCornerDotCake.FC_DEC1604_P7.getStart() && cdcPoint <= FourCornerDotCake.FC_DEC1604_P7.getStop()) { - Integer decPoint = cdcPoint - FourCornerDotCake.FC_DEC1604_P7.getLength(); - FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(decPoint); - numberMode = null; // out of range, thus stop - Integer handled = handleEscape6(decCode, cdc, buf); - if (handled == null) { - continue; + StenoUnicodePrinter printer = new StenoUnicodePrinter(buf); + FourCornerZionStenoLexer lexer = new FourCornerZionStenoLexer(printer, handleEscape); + lexer.withSmokeSignals(printer).read(chars); + } + + private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZionStenoLexerSmoke { + + private final StringBuilder output; + + private StenoUnicodePrinter(StringBuilder output) { + this.output = Objects.requireNonNull(output); + } + + private boolean printedEscape(FourCornerDotCake slice, int offset) { + if (FourCornerDotCake.FC_CDC1604_P6.equals(slice)) { + if (offset < 4) { + output.appendCodePoint(FCDotCDC1604DashP6.escapeSignUnicode(offset)); + return true; } - cdcPoint = handled; // out of range, is back to normal } - if (FCDotCDC1604DashP6.__ESC6.ordinal() == cdcPoint) { - if (!cdc.hasNext()) { - break; + if (FourCornerDotCake.FC_DEC1604_P7.equals(slice)) { + if (offset < 6) { + output.appendCodePoint(FCDotCDC1604DashP6.escapeSignUnicode(offset)); + return true; } - FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(cdc.next()); - numberMode = null; // out of range, thus stop - Integer handled = handleEscape6(decCode, cdc, buf); - if (handled == null) { - continue; - } - cdcPoint = handled; // out of range, is back to normal } - if (numberMode != null && (cdcPoint > numberMode)) { - numberMode = null; // out of range - } - if (numberMode != null && (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal())) { - numberMode = null; // below index 1 is end number mode - } - if (FCDotCDC1604DashP6.__PIE68.ordinal() == cdcPoint || FCDotCDC1604DashP6.__NCR68.ordinal() == cdcPoint) { - if (!cdc.hasNext()) { - break; - } - numberMode = cdc.next(); - numberPIE = FCDotCDC1604DashP6.__PIE68.ordinal() == cdcPoint; // is false for PIN - if (renderHiddenControls) { - if (numberPIE) { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__PIE68.ordinal())); - } else { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__NCR68.ordinal())); - } - if (renderLookup) { // is already printed when disabled - buf.appendCodePoint(FCDotCDC1604DashP6.indexOf(numberMode).codePoints()[0]); - } - } - if (renderLookup) { - if (numberMode != null && numberMode < FCDotCDC1604DashP6.NX01_A.ordinal()) { - cdcPoint = numberMode; // print char - numberMode = null; // illegal number mode - } else { + return false; + } + + @Override + public void strobeWords(FourCornerDotCake slice, List offsets) { + FourCornerX00PetitVidePoints[] videPoints = slice.getVidePoints(); + + if (slice.isExternWord()) { + String fcQName = slice.qname(); + Iterator i = offsets.iterator(); + while (i.hasNext()) { + Integer offset = i.next(); + if (printedEscape(slice, offset)) { continue; } - } else { - cdcPoint = numberMode; // print char - numberMode = null; // disable lookup - } - } - if (cdcPoint >= FourCornerDotCake.FC_NCR1632_1T.getStart() && cdcPoint <= FourCornerDotCake.FC_NCR1632_1T.getStop()) { - numberModeLarge = cdcPoint - FourCornerDotCake.FC_NCR1632_1T.getStart(); - continue; - } - if (numberModeLarge != null) { - int terminatorOffOne = numberModeLarge + 1; - int numberIdxOffOne = cdcPoint - FourCornerDotCake.FC_NCR1632_1V.getStart() + 1; - if (numberIdxOffOne > 0) { - List math = new ArrayList<>(); - FCDotPIE9CDash20.toScriptSuper(numberIdxOffOne).forEach(v -> { - for (int chr : v.cakePoints()) { - math.add(chr); + String key = fcQName + "." + Integer.toString(offset); + String value = null; + if (value != null) { + output.append(value); + } else { + FourCornerX00PetitVidePoints videPoint = videPoints[offset]; + if (videPoint instanceof FourCornerX18CakeWord) { + FourCornerX18CakeWord cakeWord = FourCornerX18CakeWord.class.cast(videPoint); + FourCornerX18CakePoints[] wordDefault = cakeWord.nameDefault(); + for (FourCornerX18CakePoints letter : wordDefault) { + if (letter.isX21()) { + Arrays.stream(letter.toX21().codePoints()).forEach(v -> output.appendCodePoint(v)); + } + } } - }); - math.add(FCDotCDC1604DashP6.BAR_V_RIGHT.ordinal()); - FCDotPIE9CDash20.toScriptSub(terminatorOffOne).forEach(v -> { - for (int chr : v.cakePoints()) { - math.add(chr); - } - }); - renderFromInt18(math, buf); - continue; + } + if (renderSeperator != null && i.hasNext()) { + output.append(renderSeperator); + } } + return; } - if (numberMode != null) { - if (numberPIE) { - int terminatorOffOne = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal() + 1; - int numberIdxOffZero = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal(); - int[] chs = pieTerminatorNumber(terminatorOffOne, numberIdxOffZero); - Arrays.stream(chs).forEach(v -> buf.appendCodePoint(v)); - } else { // _PIN = ²⁄₁₂ - int terminatorOffOne = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal() + 1; - int numberIdxOffOne = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal() + 1; - List math = new ArrayList<>(); - FCDotPIE9CDash20.toScriptSuper(numberIdxOffOne).forEach(v -> { - for (int chr : v.cakePoints()) { - math.add(chr); - } - }); - math.add(FCDotCDC1604DashP6.BAR_V_RIGHT.ordinal()); - FCDotPIE9CDash20.toScriptSub(terminatorOffOne).forEach(v -> { - for (int chr : v.cakePoints()) { - math.add(chr); - } - }); - renderFromInt18(math, buf); + if (videPoints.length > 0) { + for (Integer offset : offsets) { + if (printedEscape(slice, offset)) { + continue; + } + FourCornerX00PetitVidePoints videPoint = videPoints[offset]; + if (videPoint.isX21()) { + Arrays.stream(videPoint.toX21().codePoints()).forEach(v -> output.appendCodePoint(v)); + } } - prevWord = false; - continue; + return; } - if (cdcPoint < FCDotCDC1604DashP6.length()) { - prevWord = false; - int[] chs = FCDotCDC1604DashP6.indexOf(cdcPoint).codePoints(); - Arrays.stream(chs).forEach(v -> buf.appendCodePoint(v)); - } else if (cdcPoint >= FourCornerDotCake.FC_PIE9C_01.getStart() && cdcPoint <= FourCornerDotCake.FC_PIE9C_27.getStop()) { - prevWord = false; - List chs = int18To21.get(cdcPoint); - if (chs != null) { - chs.forEach(v -> buf.appendCodePoint(v)); + output.append(slice.name()); + output.append("#"); + for (Integer offset : offsets) { + output.append(offset); + output.append("-"); + } + output.append("#"); + } + + @Override + public void strobeNCR1632(BigInteger denominator, BigInteger numerator) { + List math = new ArrayList<>(); + FourCornerUnicodeMapper.DICTIONARY.toScriptSuper(numerator).forEach(v -> { + for (int chr : v.cakePoints()) { + math.add(chr); } + }); + math.add(FCDotCDC1604DashP6.BAR_V_RIGHT.ordinal()); + FourCornerUnicodeMapper.DICTIONARY.toScriptSub(denominator).forEach(v -> { + for (int chr : v.cakePoints()) { + math.add(chr); + } + }); + renderFromInt18(math, output); + } + + @Override + public void strobeUnicode(List codePoints) { + codePoints.forEach(v -> output.appendCodePoint(v)); + } + + @Override + public void strobeNether(List key, List octals) { + // TODO Auto-generated method stub + } + + @Override + public void burnUnsupported(int line, int col, int cakePoint) { + if (failUnsupported) { + throw new IllegalArgumentException("Unsupported cakePoint: " + Integer.toHexString(cakePoint)+ " on line: " + line + ":" + col); } else { - if (prevWord) { - buf.append(renderSeperator); - } - prevWord = true; - - // FIXME: print hex of 4C word until later print correct words for locate from nether db. - buf.append("&#x"); - buf.append(Integer.toHexString(cdcPoint).toUpperCase()); - buf.append(";"); + // TODO: use unicode glyps for unknow letter + output.append("&#x"); + output.append(Integer.toHexString(cakePoint).toUpperCase()); + output.append(";"); } } } - - private Integer handleEscape6(FCDotDEC1604DashP7 decCode, Iterator cdc, StringBuilder buf) { - if (renderHiddenControls) { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal())); - } - if (FCDotDEC1604DashP7.__NUL_DEC.equals(decCode)) { - if (renderHiddenControls) { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__NUL_DEC.ordinal())); - } - return null; - } - if (FCDotDEC1604DashP7.__ESC6_APL.equals(decCode)) { - if (!cdc.hasNext()) { - return null; - } - if (renderHiddenControls) { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_APL.ordinal())); - } - FCDotAPL1604DashP8L aplCode = FCDotAPL1604DashP8L.indexOf(cdc.next()); - Arrays.stream(aplCode.codePoints()).forEach(v -> buf.appendCodePoint(v)); - return null; - } - if (FCDotDEC1604DashP7.__ESC6_BYD.equals(decCode)) { - if (!cdc.hasNext()) { - return null; - } - if (renderHiddenControls) { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC6_BYD.ordinal())); - } - FCDotBYD1604DashP8H bydCode = FCDotBYD1604DashP8H.indexOf(cdc.next()); - Arrays.stream(bydCode.codePoints()).forEach(v -> buf.appendCodePoint(v)); - return null; - } - if (FCDotDEC1604DashP7.__ESC_STOP.equals(decCode)) { - if (renderHiddenControls) { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotDEC1604DashP7.__ESC_STOP.ordinal())); - } - return null; - } - if (FCDotDEC1604DashP7.__ESC68_FC18.equals(decCode)) { - return decCode.ordinal(); // todo handle - } - if (FCDotDEC1604DashP7.__ESC18_NETHER.equals(decCode)) { - if (!cdc.hasNext()) { - return null; - } - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));// TODO: add new symbol - // TODO: eat header and eat data, as we can't display it - return null; - } - if (!renderHiddenControls) { - buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal())); - } - return decCode.ordinal(); - } - - private void mapPoints() { - for (FourCornerDotCake slice : FourCornerDotCake.values()) { - FourCornerX00PetitVidePoints[] videPoints = slice.getVidePoints(); - if (videPoints.length == 0) { - continue; - } - mapPoints(videPoints); - } - } - - private void mapPoints(FourCornerX00PetitVidePoints[] videPoints) { - for (FourCornerX00PetitVidePoints videPoint : videPoints) { - if (!videPoint.isX18()) { - continue; - } - if (!videPoint.isX21()) { - continue; - } - FourCornerX18CakePoints x18 = videPoint.toX18(); - FourCornerX21CodePoints x21 = videPoint.toX21(); - if (x18.cakePoints().length > 1) { - continue; - } - int char18 = x18.cakePoints()[0]; - List chs = new ArrayList<>(); - int[] char21 = x21.codePoints(); - Arrays.stream(char21).forEach(v -> chs.add(v)); - int18To21.put(char18, chs); - } - } - - static private int[] pieTerminatorNumber(int terminator, int value) { - switch (terminator) { - case 1: - return FCDotPIE9CDash01.values()[value].codePoints(); - case 2: - return FCDotPIE9CDash02.values()[value].codePoints(); - case 3: - return FCDotPIE9CDash03.values()[value].codePoints(); - case 4: - return FCDotPIE9CDash04.values()[value].codePoints(); - case 5: - return FCDotPIE9CDash05.values()[value].codePoints(); - case 6: - return FCDotPIE9CDash06.values()[value].codePoints(); - case 7: - return FCDotPIE9CDash07.values()[value].codePoints(); - case 8: - return FCDotPIE9CDash08.values()[value].codePoints(); - case 9: - return FCDotPIE9CDash09.values()[value].codePoints(); - case 10: - return FCDotPIE9CDash10.values()[value].codePoints(); - case 11: - return FCDotPIE9CDash11.values()[value].codePoints(); - case 12: - return FCDotPIE9CDash12.values()[value].codePoints(); - case 13: - return FCDotPIE9CDash13.values()[value].codePoints(); - case 14: - return FCDotPIE9CDash14.values()[value].codePoints(); - case 15: - return FCDotPIE9CDash15.values()[value].codePoints(); - case 16: - return FCDotPIE9CDash16.values()[value].codePoints(); - case 17: - return FCDotPIE9CDash17.values()[value].codePoints(); - case 18: - return FCDotPIE9CDash18.values()[value].codePoints(); - case 19: - return FCDotPIE9CDash19.values()[value].codePoints(); - case 20: - return FCDotPIE9CDash20.values()[value].codePoints(); - case 21: - return FCDotPIE9CDash21.values()[value].codePoints(); - case 22: - return FCDotPIE9CDash22.values()[value].codePoints(); - case 23: - return FCDotPIE9CDash23.values()[value].codePoints(); - case 24: - return FCDotPIE9CDash24.values()[value].codePoints(); - case 25: - return FCDotPIE9CDash25.values()[value].codePoints(); - case 26: - return FCDotPIE9CDash26.values()[value].codePoints(); - case 27: - return FCDotPIE9CDash27.values()[value].codePoints(); - default: - throw new IllegalArgumentException("Unsupported terminator index: " + terminator); - } - } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeImport.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeImport.java index 90f39ef..601f43c 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeImport.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeImport.java @@ -23,9 +23,7 @@ package org.x4o.o2o.fc18; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.PrimitiveIterator; import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6; @@ -33,7 +31,6 @@ import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7; import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord; import org.x4o.o2o.octal.PrimordialOctalOrangeString; -/// /// Imports unicode as four corner BASIC text from the "FC.CDC1604-P6" code page. /// /// @author Willem Cazander @@ -42,19 +39,21 @@ import org.x4o.o2o.octal.PrimordialOctalOrangeString; public class FourCornerUnicodeImport { private boolean convertDiacritics = false; - private final Map int21ToVide = new HashMap<>(); + private boolean failOnMissing = false; + private List missingCharIndicator = null; - public FourCornerUnicodeImport(boolean convertDiacritics) { + public FourCornerUnicodeImport(boolean convertDiacritics, boolean failOnMissing, List missingCharIndicator) { this.convertDiacritics = convertDiacritics; - mapPoints(); + this.failOnMissing = failOnMissing; + this.missingCharIndicator = missingCharIndicator; } static public FourCornerUnicodeImport strict() { - return new FourCornerUnicodeImport(false); + return new FourCornerUnicodeImport(false, true, null); } static public FourCornerUnicodeImport lossy() { - return new FourCornerUnicodeImport(true); + return new FourCornerUnicodeImport(true, false, List.of(FCDotCDC1604DashP6.QUESTION)); } public PrimordialOctalOrangeJuiceCord convertToJuice(String text) { @@ -83,113 +82,170 @@ public class FourCornerUnicodeImport { return convertToXXX(text, 18).stream().map(v -> v.toX18()).toList(); } - private List convertToXXX(String text, int bits) { - String textSingleNewLines = text.replaceAll("\r\n", "\n"); // FIXME: regex only allowed in test scope classpath - PrimitiveIterator.OfInt i = textSingleNewLines.codePoints().iterator(); - List result = new ArrayList<>(text.length()); - FCDotCDC1604DashP6 cdcNumberTerminator = null; - FCDotCDC1604DashP6 cdcCaseTerminator = null; - while (i.hasNext()) { - int codePoint = i.next(); - - // Is not mapped, so handle with code - if ('\r' == codePoint) { - result.add(FCDotCDC1604DashP6._NEWLINE); - cdcNumberTerminator = null; - cdcCaseTerminator = null; - continue; - } - - // Handle number sequences manual, to escape once - if (bits != 18) { // 18 direct cake point is found by generic lookup - if (codePoint >= '0' && codePoint <= '9') { - if (!FCDotCDC1604DashP6.NX10_J.equals(cdcNumberTerminator)) { - result.add(FCDotCDC1604DashP6.__PIE68); - result.add(FCDotCDC1604DashP6.NX10_J); - cdcNumberTerminator = FCDotCDC1604DashP6.NX10_J; - } - int cdcNumberOff = codePoint - '0'; - int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff; - result.add(FCDotCDC1604DashP6.indexOf(cdcNumber)); - continue; - } - if (cdcNumberTerminator != null) { - cdcNumberTerminator = null; - if (bits == 6) { - result.add(FCDotCDC1604DashP6.__ESC6); - result.add(FCDotCDC1604DashP6.__ESC6); - } else { - result.add(FCDotDEC1604DashP7.__ESC_STOP); - } - } - } - - // Handle lower case sequences manual, to escape once - if (bits != 18) { // 18 direct cake point is found by generic lookup - if (codePoint >= 'a' && codePoint <= 'z') { - if (!FCDotCDC1604DashP6.NX26_Z.equals(cdcCaseTerminator)) { - result.add(FCDotCDC1604DashP6.__PIE68); - result.add(FCDotCDC1604DashP6.NX26_Z); - cdcCaseTerminator = FCDotCDC1604DashP6.NX26_Z; - } - int cdcNumberOff = codePoint - 'a'; - int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff; - result.add(FCDotCDC1604DashP6.indexOf(cdcNumber)); - continue; - } - if (cdcCaseTerminator != null) { - cdcCaseTerminator = null; - if (bits == 6) { - result.add(FCDotCDC1604DashP6.__ESC6); - result.add(FCDotCDC1604DashP6.__ESC6); - } else { - result.add(FCDotDEC1604DashP7.__ESC_STOP); - } - } - } - - // Lookup mapped values - FourCornerX00PetitVidePoints chs = int21ToVide.get(codePoint); - if (chs != null) { - if (bits == 6) { - if (chs.isX06()) { - result.add(chs); - continue; - } - } else if (bits == 8) { - if (chs.isX08()) { - result.add(chs); - continue; - } - } else { - if (chs.isX18()) { - result.add(chs); - continue; - } - } - // fails below in exception - } - - // Check lossy aliases - if (convertDiacritics) { - String codePointStr = new StringBuilder().appendCodePoint(codePoint).toString(); - FCDotCDC1604DashP6 alias = checkDiacriticAlias(codePointStr); - if (alias != null) { - result.add(alias); - continue; - } - } - StringBuilder err = new StringBuilder(); - err.append("Unsupported char: '"); - err.appendCodePoint(codePoint); - err.append("' 0x"); - err.append(Integer.toHexString(codePoint)); - throw new IllegalArgumentException(err.toString()); + final private class ImportState { + final int bits; + final PrimitiveIterator.OfInt input; + final List output; + FCDotCDC1604DashP6 cdcNumberTerminator; + FCDotCDC1604DashP6 cdcCaseTerminator; + int codePoint; + private ImportState(int bits, PrimitiveIterator.OfInt input, List output) { + this.bits = bits; + this.input = input; + this.output = output; + } + private void reset() { + cdcNumberTerminator = null; + cdcCaseTerminator = null; } - return result; } - static private FCDotCDC1604DashP6 checkDiacriticAlias(String codePoint) { + private List convertToXXX(String text, int bits) { + ImportState ctx = new ImportState(bits, text.codePoints().iterator(), new ArrayList<>(text.length())); + while (ctx.input.hasNext()) { + ctx.codePoint = ctx.input.nextInt(); + if (handleReturnTypes(ctx)) { + continue; // \r\n and \r are not mapped, so handle with code + } + if (handleNumber(ctx)) { + continue; // Handle number sequences manual, to escape once + } + if (handleLowCase(ctx)) { + continue; // Handle lower case sequences manual, to escape once + } + if (handleDictionary(ctx)) { + continue; // Lookup mapped values + } + if (handleDiacritics(ctx)) { + continue; // Check lossy aliases + } + if (failOnMissing) { + throw new IllegalArgumentException(buildErrorMessage(ctx)); + } + if (missingCharIndicator != null) { + ctx.output.addAll(missingCharIndicator); + } + } + return ctx.output; + } + + private String buildErrorMessage(ImportState ctx) { + StringBuilder err = new StringBuilder(); + err.append("Unsupported-"); + err.append(ctx.bits); + err.append(" char: '"); + err.appendCodePoint(ctx.codePoint); + err.append("' 0x"); + err.append(Integer.toHexString(ctx.codePoint)); + return err.toString(); + } + + private boolean handleReturnTypes(ImportState ctx) { + if ('\r' == ctx.codePoint) { + ctx.reset(); + ctx.output.add(FCDotCDC1604DashP6._NEWLINE); + if (!ctx.input.hasNext()) { + return true; // = no next is continue to next, to exit while above + } + ctx.codePoint = ctx.input.nextInt(); + if ('\n' == ctx.codePoint) { + return true; // eat \n to have one newline + } + } + return false; // normal /n is handles by generic lookup + } + + private boolean handleDictionary(ImportState ctx) { + FourCornerX00PetitVidePoints chs = FourCornerUnicodeMapper.DICTIONARY.findByX21(ctx.codePoint); + if (chs == null) { + return false; + } + if (ctx.bits == 6) { + if (chs.isX06()) { + ctx.output.add(chs); + return true; + } + } else if (ctx.bits == 8) { + if (chs.isX08()) { + ctx.output.add(chs); + return true; + } + } else { + if (chs.isX18()) { + ctx.output.add(chs); + return true; + } + } + return false; + } + + private boolean handleNumber(ImportState ctx) { + if (ctx.bits == 18) { + return false; // 18 direct cake point is found by generic lookup + } + if (ctx.codePoint >= '0' && ctx.codePoint <= '9') { + if (!FCDotCDC1604DashP6.NX10_J.equals(ctx.cdcNumberTerminator)) { + ctx.output.add(FCDotCDC1604DashP6.__PIE68); + ctx.output.add(FCDotCDC1604DashP6.NX10_J); + ctx.cdcNumberTerminator = FCDotCDC1604DashP6.NX10_J; + } + int cdcNumberOff = ctx.codePoint - '0'; + int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff; + ctx.output.add(FCDotCDC1604DashP6.indexOf(cdcNumber)); + return true; + } + if (ctx.cdcNumberTerminator != null) { + ctx.cdcNumberTerminator = null; + if (ctx.bits == 6) { + ctx.output.add(FCDotCDC1604DashP6.__ESC6); + ctx.output.add(FCDotCDC1604DashP6.__ESC6); + } else { + ctx.output.add(FCDotDEC1604DashP7.__ESC_STOP); + } + } + return false; + } + + private boolean handleLowCase(ImportState ctx) { + if (ctx.bits == 18) { + return false; // 18 direct cake point is found by generic lookup + } + if (ctx.codePoint >= 'a' && ctx.codePoint <= 'z') { + if (!FCDotCDC1604DashP6.NX26_Z.equals(ctx.cdcCaseTerminator)) { + ctx.output.add(FCDotCDC1604DashP6.__PIE68); + ctx.output.add(FCDotCDC1604DashP6.NX26_Z); + ctx.cdcCaseTerminator = FCDotCDC1604DashP6.NX26_Z; + } + int cdcNumberOff = ctx.codePoint - 'a'; + int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff; + ctx.output.add(FCDotCDC1604DashP6.indexOf(cdcNumber)); + return true; + } + if (ctx.cdcCaseTerminator != null) { + ctx.cdcCaseTerminator = null; + if (ctx.bits == 6) { + ctx.output.add(FCDotCDC1604DashP6.__ESC6); + ctx.output.add(FCDotCDC1604DashP6.__ESC6); + } else { + ctx.output.add(FCDotDEC1604DashP7.__ESC_STOP); + } + } + return false; + } + + private boolean handleDiacritics(ImportState ctx) { + if (convertDiacritics) { + FCDotCDC1604DashP6 alias = checkDiacriticAlias(ctx.codePoint); + if (alias != null) { + ctx.output.add(alias); + return true; + } + } + return false; + } + + private FCDotCDC1604DashP6 checkDiacriticAlias(int codePointInt) { + String codePoint = new StringBuilder().appendCodePoint(codePointInt).toString(); if ("Æ æ Å å Ǻ ǻ Ḁ ḁ ẚ Ă ă Ặ ặ Ắ ắ Ằ ằ Ẳ ẳ Ẵ ẵ Ȃ ȃ Â â Ậ ậ Ấ ấ Ầ ầ Ẫ ẫ Ẩ ẩ Ả ả Ǎ ǎ Ⱥ ⱥ Ȧ ȧ Ǡ ǡ Ạ ạ Ä ä Ǟ ǟ À à Ȁ ȁ Á á Ā ā Ā̀ ā̀ Ã ã Ą ą Ą́ ą́ Ą̃ ą̃ A̲ a̲ ᶏ".contains(codePoint)) { return FCDotCDC1604DashP6.NX01_A; } @@ -273,28 +329,4 @@ public class FourCornerUnicodeImport { } return null; } - - private void mapPoints() { - for (FourCornerDotCake slice : FourCornerDotCake.values()) { - FourCornerX00PetitVidePoints[] videPoints = slice.getVidePoints(); - if (videPoints.length == 0) { - continue; - } - mapPoints(videPoints); - } - } - - private void mapPoints(FourCornerX00PetitVidePoints[] videPoints) { - for (FourCornerX00PetitVidePoints videPoint : videPoints) { - if (!videPoint.isX21()) { - continue; - } - FourCornerX21CodePoints x21 = videPoint.toX21(); - if (x21.codePoints().length > 1) { - continue; - } - int char21 = x21.codePoints()[0]; - int21ToVide.put(char21, videPoint); - } - } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeMapper.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeMapper.java new file mode 100644 index 0000000..a36cecc --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerUnicodeMapper.java @@ -0,0 +1,161 @@ +/* + * 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; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.PrimitiveIterator; + +import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash11; +import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash20; + +/// Holds conversion maps between four corner int18 and unicode int21 points. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 09, 2025 +public enum FourCornerUnicodeMapper { + DICTIONARY, + ; + + private final Map> int18To21 = new HashMap<>(); + private final Map int21ToVide = new HashMap<>(); + + private FourCornerUnicodeMapper() { + for (FourCornerDotCake slice : FourCornerDotCake.values()) { + FourCornerX00PetitVidePoints[] videPoints = slice.getVidePoints(); + if (videPoints.length == 0) { + continue; + } + mapPointsX18(videPoints); + mapPointsX21(videPoints); + } + int18To21.forEach((k,v) -> int18To21.put(k, Collections.unmodifiableList(v))); + } + + private void mapPointsX18(FourCornerX00PetitVidePoints[] videPoints) { + for (FourCornerX00PetitVidePoints videPoint : videPoints) { + if (!videPoint.isX18()) { + continue; + } + if (!videPoint.isX21()) { + continue; + } + FourCornerX18CakePoints x18 = videPoint.toX18(); + FourCornerX21CodePoints x21 = videPoint.toX21(); + if (x18.cakePoints().length > 1) { + continue; + } + int char18 = x18.cakePoints()[0]; + List chs = new ArrayList<>(); + int[] char21 = x21.codePoints(); + Arrays.stream(char21).forEach(v -> chs.add(v)); + int18To21.put(char18, chs); + } + } + + private void mapPointsX21(FourCornerX00PetitVidePoints[] videPoints) { + for (FourCornerX00PetitVidePoints videPoint : videPoints) { + if (!videPoint.isX21()) { + continue; + } + FourCornerX21CodePoints x21 = videPoint.toX21(); + if (x21.codePoints().length > 1) { + continue; + } + int char21 = x21.codePoints()[0]; + int21ToVide.put(char21, videPoint); + } + } + + public List findByX18(Integer letter) { + return int18To21.get(letter); + } + + public FourCornerX00PetitVidePoints findByX21(Integer letter) { + return int21ToVide.get(letter); + } + + public List embedUNI2K(String value) { + List result = new ArrayList<>(value.length()); + PrimitiveIterator.OfInt i = value.codePoints().iterator(); + int bankSelect = 0; + while (i.hasNext()) { + int codePoint = i.nextInt(); + if (codePoint > 2048) { + int bankSelectNew = codePoint >> 11; + if (bankSelect != bankSelectNew) { + bankSelect = bankSelectNew; + result.add(FourCornerDotCake.FC_UNI2K_22.getStart() + bankSelect); + } + } else if (bankSelect != 0){ + bankSelect = 0; + result.add(FourCornerDotCake.FC_UNI2K_22.getStart() + bankSelect); + } + // bank selects output only on change + + int bankPoint = codePoint & 0b11111111111; + result.add(FourCornerDotCake.FC_UNI2K_11.getStart() + bankPoint); + } + return result; + } + + public List toScriptSuper(int value) { + return toScript(Integer.toString(value), 0); + } + + public List toScriptSub(int value) { + return toScript(Integer.toString(value), 10); + } + + public List toScriptSuper(BigInteger value) { + return toScript(value.toString(10), 0); + } + + public List toScriptSub(BigInteger value) { + return toScript(value.toString(10), 10); + } + + private List toScript(String value, int off) { + List result = new ArrayList<>(); + PrimitiveIterator.OfInt i = value.codePoints().iterator(); + while (i.hasNext()) { + int chr = i.nextInt(); + if (chr == '-') { + if (off == 0) { + result.add(FCDotPIE9CDash11.NXX_03); + } else { + result.add(FCDotPIE9CDash11.NXX_08); + } + continue; + } + int num = chr - '0'; + result.add(FCDotPIE9CDash20.values()[num + off]); + } + return result; + } +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerX18CakeWord.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerX18CakeWord.java new file mode 100644 index 0000000..6f09216 --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/FourCornerX18CakeWord.java @@ -0,0 +1,33 @@ +/* + * 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; + +/// Fall back word provider. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 11, 2025 +public interface FourCornerX18CakeWord extends FourCornerX18CakePoints { + + /// Default word provider + FourCornerX18CakePoints[] nameDefault(); +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/clk1k/FCDotCLKSourceCakePoints.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/clk1k/FCDotCLKSourceCakePoints.java index d0caed0..d05042b 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/clk1k/FCDotCLKSourceCakePoints.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/clk1k/FCDotCLKSourceCakePoints.java @@ -24,7 +24,9 @@ package org.x4o.o2o.fc18.clk1k; import java.util.Optional; +import org.x4o.o2o.fc18.FourCornerUnicodeImport; import org.x4o.o2o.fc18.FourCornerX18CakePoints; +import org.x4o.o2o.fc18.FourCornerX18CakeWord; /** * Adds CLK source lookup support to an cake point. @@ -33,7 +35,9 @@ import org.x4o.o2o.fc18.FourCornerX18CakePoints; * @author Willem Cazander * @version 1.0 Dec 30, 2024 */ -public interface FCDotCLKSourceCakePoints extends FourCornerX18CakePoints { +public interface FCDotCLKSourceCakePoints extends FourCornerX18CakeWord { + + String name(); FCDotCLKSourceLookup[] getLookups(); @@ -45,4 +49,8 @@ public interface FCDotCLKSourceCakePoints extends FourCornerX18CakePoints { } return Optional.empty(); } + + default FourCornerX18CakePoints[] nameDefault() { + return FourCornerUnicodeImport.strict().convertToX18(name()).toArray(new FourCornerX18CakePoints[] {}); + } } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash20.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash20.java index dde1acc..3bb0632 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash20.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/pie9c/FCDotPIE9CDash20.java @@ -22,10 +22,6 @@ */ 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; @@ -87,24 +83,4 @@ public enum FCDotPIE9CDash20 implements FourCornerX06BaklavaPoints, FourCornerX0 public int[] codePoints() { return codePoints; } - - static public List toScriptSuper(int value) { - return toScript(value, 0); - } - - static public List toScriptSub(int value) { - return toScript(value, 10); - } - - static private List toScript(int value, int off) { - 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 + off]); - } - 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 46d5237..89c5823 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 @@ -56,10 +56,10 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner /// To escape the question of undefined behavior, we define it as dark nether space, so we can see it in C++ /// Using dark mode nether requires 18 bit cake points as we embed 15 bit data point in the cake; /// - /// __ESC18_NETHER - /// + ?slug + ?VT_NX01_NEXT (None or 72 to 576 bit Número2 Lingua tree key per 72 bit slug) - /// + ?slug + ?VT_NX01_NEXT (Up to 8 slug arguments to have max key) - /// + VT_NX01_EXECUTE + data-block as FC_NETHER in 15 bit embedded octals + /// __ESC18_NETHER VT_RAKA_AT + /// + ?slug + ?VT_RAKA_AT (None or 72 to 576 bit Número2 Lingua tree key per 72 bit slug) + /// + ?slug + ?VT_RAKA_AT (Up to 8 slug arguments to have max key) + /// + VT_SALAH + 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 /// @@ -68,14 +68,13 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner /// 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_NEXT, - /// VT-NX01 = __ESC6 ! = End of P7 sequence started from NX01_A2Amp to execute the VT command. - /// NOTE: Designed to only be used in escape sequences in the letter range A to AMP. - VT_NX01_EXECUTE, + /// VT-NX01 = __ESC6 ? = Begin and next argument separator for escape command sequences which MUST end with __ESC_NX_EXECUTE. + VT_RAKA_AT, + /// VT-NX01 = __ESC6 ! = End of escape command sequence. + VT_SALAH, - UNDEFINED__TAG_CURLY_LEFT, - UNDEFINED__TAG_CURLY_RIGHT, + DEC_TAG_CURLY_LEFT, + DEC_TAG_CURLY_RIGHT, /// ANSI C1 char [ = CSI = Control Sequence Introducer RESERVED_ANSI_CSI, UNDEFINED__TAG_SQUARE_RIGHT, @@ -208,6 +207,17 @@ public enum FCDotDEC1604DashP7 implements FourCornerX06BaklavaPoints, FourCorner private FCDotDEC1604DashP7() { } + public boolean isAlias(FCDotCDC1604DashP6 cdc) { + if (cdc == null) { + return false; + } + return cdc.ordinal() == ordinal(); + } + + public FCDotCDC1604DashP6 toAlias() { + return FCDotCDC1604DashP6.indexOf(ordinal()); + } + @Override public int[] baklavaPoints() { return new int[] {FCDotCDC1604DashP6.__ESC6.ordinal(), ordinal()}; diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash0M.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash0M.java deleted file mode 100644 index 798c4c3..0000000 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash0M.java +++ /dev/null @@ -1,557 +0,0 @@ -/* - * 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.x4o.o2o.fc18.FourCornerDotCake; -import org.x4o.o2o.fc18.FourCornerX18CakePoints; - -/** - * "FC.NCR1632-0M" Four Corner New Counting Rods terminator pie multiplier. - * - * @author Willem Cazander - * @version 1.0 Dec 31, 2024 - */ -public enum FCDotNCR1632Dash0M implements FourCornerX18CakePoints { - NXX_001, - NXX_002, - NXX_003, - NXX_004, - NXX_005, - NXX_006, - NXX_007, - NXX_008, - NXX_009, - NXX_010, - NXX_011, - NXX_012, - NXX_013, - NXX_014, - NXX_015, - NXX_016, - NXX_017, - NXX_018, - NXX_019, - NXX_020, - NXX_021, - NXX_022, - NXX_023, - NXX_024, - NXX_025, - NXX_026, - NXX_027, - NXX_028, - NXX_029, - NXX_030, - NXX_031, - NXX_032, - NXX_033, - NXX_034, - NXX_035, - NXX_036, - NXX_037, - NXX_038, - NXX_039, - NXX_040, - NXX_041, - NXX_042, - NXX_043, - NXX_044, - NXX_045, - NXX_046, - NXX_047, - NXX_048, - NXX_049, - NXX_050, - NXX_051, - NXX_052, - NXX_053, - NXX_054, - NXX_055, - NXX_056, - NXX_057, - NXX_058, - NXX_059, - NXX_060, - NXX_061, - NXX_062, - NXX_063, - NXX_064, - NXX_065, - NXX_066, - NXX_067, - NXX_068, - NXX_069, - NXX_070, - NXX_071, - NXX_072, - NXX_073, - NXX_074, - NXX_075, - NXX_076, - NXX_077, - NXX_078, - NXX_079, - NXX_080, - NXX_081, - NXX_082, - NXX_083, - NXX_084, - NXX_085, - NXX_086, - NXX_087, - NXX_088, - NXX_089, - NXX_090, - NXX_091, - NXX_092, - NXX_093, - NXX_094, - NXX_095, - NXX_096, - NXX_097, - NXX_098, - NXX_099, - NXX_100, - NXX_101, - NXX_102, - NXX_103, - NXX_104, - NXX_105, - NXX_106, - NXX_107, - NXX_108, - NXX_109, - NXX_110, - NXX_111, - NXX_112, - NXX_113, - NXX_114, - NXX_115, - NXX_116, - NXX_117, - NXX_118, - NXX_119, - NXX_120, - NXX_121, - NXX_122, - NXX_123, - NXX_124, - NXX_125, - NXX_126, - NXX_127, - NXX_128, - NXX_129, - NXX_130, - NXX_131, - NXX_132, - NXX_133, - NXX_134, - NXX_135, - NXX_136, - NXX_137, - NXX_138, - NXX_139, - NXX_140, - NXX_141, - NXX_142, - NXX_143, - NXX_144, - NXX_145, - NXX_146, - NXX_147, - NXX_148, - NXX_149, - NXX_150, - NXX_151, - NXX_152, - NXX_153, - NXX_154, - NXX_155, - NXX_156, - NXX_157, - NXX_158, - NXX_159, - NXX_160, - NXX_161, - NXX_162, - NXX_163, - NXX_164, - NXX_165, - NXX_166, - NXX_167, - NXX_168, - NXX_169, - NXX_170, - NXX_171, - NXX_172, - NXX_173, - NXX_174, - NXX_175, - NXX_176, - NXX_177, - NXX_178, - NXX_179, - NXX_180, - NXX_181, - NXX_182, - NXX_183, - NXX_184, - NXX_185, - NXX_186, - NXX_187, - NXX_188, - NXX_189, - NXX_190, - NXX_191, - NXX_192, - NXX_193, - NXX_194, - NXX_195, - NXX_196, - NXX_197, - NXX_198, - NXX_199, - NXX_200, - NXX_201, - NXX_202, - NXX_203, - NXX_204, - NXX_205, - NXX_206, - NXX_207, - NXX_208, - NXX_209, - NXX_210, - NXX_211, - NXX_212, - NXX_213, - NXX_214, - NXX_215, - NXX_216, - NXX_217, - NXX_218, - NXX_219, - NXX_220, - NXX_221, - NXX_222, - NXX_223, - NXX_224, - NXX_225, - NXX_226, - NXX_227, - NXX_228, - NXX_229, - NXX_230, - NXX_231, - NXX_232, - NXX_233, - NXX_234, - NXX_235, - NXX_236, - NXX_237, - NXX_238, - NXX_239, - NXX_240, - NXX_241, - NXX_242, - NXX_243, - NXX_244, - NXX_245, - NXX_246, - NXX_247, - NXX_248, - NXX_249, - NXX_250, - NXX_251, - NXX_252, - NXX_253, - NXX_254, - NXX_255, - NXX_256, - NXX_257, - NXX_258, - NXX_259, - NXX_260, - NXX_261, - NXX_262, - NXX_263, - NXX_264, - NXX_265, - NXX_266, - NXX_267, - NXX_268, - NXX_269, - NXX_270, - NXX_271, - NXX_272, - NXX_273, - NXX_274, - NXX_275, - NXX_276, - NXX_277, - NXX_278, - NXX_279, - NXX_280, - NXX_281, - NXX_282, - NXX_283, - NXX_284, - NXX_285, - NXX_286, - NXX_287, - NXX_288, - NXX_289, - NXX_290, - NXX_291, - NXX_292, - NXX_293, - NXX_294, - NXX_295, - NXX_296, - NXX_297, - NXX_298, - NXX_299, - NXX_300, - NXX_301, - NXX_302, - NXX_303, - NXX_304, - NXX_305, - NXX_306, - NXX_307, - NXX_308, - NXX_309, - NXX_310, - NXX_311, - NXX_312, - NXX_313, - NXX_314, - NXX_315, - NXX_316, - NXX_317, - NXX_318, - NXX_319, - NXX_320, - NXX_321, - NXX_322, - NXX_323, - NXX_324, - NXX_325, - NXX_326, - NXX_327, - NXX_328, - NXX_329, - NXX_330, - NXX_331, - NXX_332, - NXX_333, - NXX_334, - NXX_335, - NXX_336, - NXX_337, - NXX_338, - NXX_339, - NXX_340, - NXX_341, - NXX_342, - NXX_343, - NXX_344, - NXX_345, - NXX_346, - NXX_347, - NXX_348, - NXX_349, - NXX_350, - NXX_351, - NXX_352, - NXX_353, - NXX_354, - NXX_355, - NXX_356, - NXX_357, - NXX_358, - NXX_359, - NXX_360, - NXX_361, - NXX_362, - NXX_363, - NXX_364, - NXX_365, - NXX_366, - NXX_367, - NXX_368, - NXX_369, - NXX_370, - NXX_371, - NXX_372, - NXX_373, - NXX_374, - NXX_375, - NXX_376, - NXX_377, - NXX_378, - NXX_379, - NXX_380, - NXX_381, - NXX_382, - NXX_383, - NXX_384, - NXX_385, - NXX_386, - NXX_387, - NXX_388, - NXX_389, - NXX_390, - NXX_391, - NXX_392, - NXX_393, - NXX_394, - NXX_395, - NXX_396, - NXX_397, - NXX_398, - NXX_399, - NXX_400, - NXX_401, - NXX_402, - NXX_403, - NXX_404, - NXX_405, - NXX_406, - NXX_407, - NXX_408, - NXX_409, - NXX_410, - NXX_411, - NXX_412, - NXX_413, - NXX_414, - NXX_415, - NXX_416, - NXX_417, - NXX_418, - NXX_419, - NXX_420, - NXX_421, - NXX_422, - NXX_423, - NXX_424, - NXX_425, - NXX_426, - NXX_427, - NXX_428, - NXX_429, - NXX_430, - NXX_431, - NXX_432, - NXX_433, - NXX_434, - NXX_435, - NXX_436, - NXX_437, - NXX_438, - NXX_439, - NXX_440, - NXX_441, - NXX_442, - NXX_443, - NXX_444, - NXX_445, - NXX_446, - NXX_447, - NXX_448, - NXX_449, - NXX_450, - NXX_451, - NXX_452, - NXX_453, - NXX_454, - NXX_455, - NXX_456, - NXX_457, - NXX_458, - NXX_459, - NXX_460, - NXX_461, - NXX_462, - NXX_463, - NXX_464, - NXX_465, - NXX_466, - NXX_467, - NXX_468, - NXX_469, - NXX_470, - NXX_471, - NXX_472, - NXX_473, - NXX_474, - NXX_475, - NXX_476, - NXX_477, - NXX_478, - NXX_479, - NXX_480, - NXX_481, - NXX_482, - NXX_483, - NXX_484, - NXX_485, - NXX_486, - NXX_487, - NXX_488, - NXX_489, - NXX_490, - NXX_491, - NXX_492, - NXX_493, - NXX_494, - NXX_495, - NXX_496, - NXX_497, - NXX_498, - NXX_499, - NXX_500, - NXX_501, - NXX_502, - NXX_503, - NXX_504, - NXX_505, - NXX_506, - NXX_507, - NXX_508, - NXX_509, - NXX_510, - NXX_511, - NXX_512, - ; - - public int cakePoint() { - return FourCornerDotCake.FC_NCR1632_0M.getStart() + ordinal(); - } - - @Override - public int[] cakePoints() { - return new int[] {cakePoint()}; - } -} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash1T.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash1T.java deleted file mode 100644 index ada1bbf..0000000 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash1T.java +++ /dev/null @@ -1,557 +0,0 @@ -/* - * 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.x4o.o2o.fc18.FourCornerDotCake; -import org.x4o.o2o.fc18.FourCornerX18CakePoints; - -/** - * "FC.NCR1632-1T" Four Corner New Counting Rods selects the Terminator pie. - * - * @author Willem Cazander - * @version 1.0 Dec 30, 2024 - */ -public enum FCDotNCR1632Dash1T implements FourCornerX18CakePoints { - NXX_001, - NXX_002, - NXX_003, - NXX_004, - NXX_005, - NXX_006, - NXX_007, - NXX_008, - NXX_009, - NXX_010, - NXX_011, - NXX_012, - NXX_013, - NXX_014, - NXX_015, - NXX_016, - NXX_017, - NXX_018, - NXX_019, - NXX_020, - NXX_021, - NXX_022, - NXX_023, - NXX_024, - NXX_025, - NXX_026, - NXX_027, - NXX_028, - NXX_029, - NXX_030, - NXX_031, - NXX_032, - NXX_033, - NXX_034, - NXX_035, - NXX_036, - NXX_037, - NXX_038, - NXX_039, - NXX_040, - NXX_041, - NXX_042, - NXX_043, - NXX_044, - NXX_045, - NXX_046, - NXX_047, - NXX_048, - NXX_049, - NXX_050, - NXX_051, - NXX_052, - NXX_053, - NXX_054, - NXX_055, - NXX_056, - NXX_057, - NXX_058, - NXX_059, - NXX_060, - NXX_061, - NXX_062, - NXX_063, - NXX_064, - NXX_065, - NXX_066, - NXX_067, - NXX_068, - NXX_069, - NXX_070, - NXX_071, - NXX_072, - NXX_073, - NXX_074, - NXX_075, - NXX_076, - NXX_077, - NXX_078, - NXX_079, - NXX_080, - NXX_081, - NXX_082, - NXX_083, - NXX_084, - NXX_085, - NXX_086, - NXX_087, - NXX_088, - NXX_089, - NXX_090, - NXX_091, - NXX_092, - NXX_093, - NXX_094, - NXX_095, - NXX_096, - NXX_097, - NXX_098, - NXX_099, - NXX_100, - NXX_101, - NXX_102, - NXX_103, - NXX_104, - NXX_105, - NXX_106, - NXX_107, - NXX_108, - NXX_109, - NXX_110, - NXX_111, - NXX_112, - NXX_113, - NXX_114, - NXX_115, - NXX_116, - NXX_117, - NXX_118, - NXX_119, - NXX_120, - NXX_121, - NXX_122, - NXX_123, - NXX_124, - NXX_125, - NXX_126, - NXX_127, - NXX_128, - NXX_129, - NXX_130, - NXX_131, - NXX_132, - NXX_133, - NXX_134, - NXX_135, - NXX_136, - NXX_137, - NXX_138, - NXX_139, - NXX_140, - NXX_141, - NXX_142, - NXX_143, - NXX_144, - NXX_145, - NXX_146, - NXX_147, - NXX_148, - NXX_149, - NXX_150, - NXX_151, - NXX_152, - NXX_153, - NXX_154, - NXX_155, - NXX_156, - NXX_157, - NXX_158, - NXX_159, - NXX_160, - NXX_161, - NXX_162, - NXX_163, - NXX_164, - NXX_165, - NXX_166, - NXX_167, - NXX_168, - NXX_169, - NXX_170, - NXX_171, - NXX_172, - NXX_173, - NXX_174, - NXX_175, - NXX_176, - NXX_177, - NXX_178, - NXX_179, - NXX_180, - NXX_181, - NXX_182, - NXX_183, - NXX_184, - NXX_185, - NXX_186, - NXX_187, - NXX_188, - NXX_189, - NXX_190, - NXX_191, - NXX_192, - NXX_193, - NXX_194, - NXX_195, - NXX_196, - NXX_197, - NXX_198, - NXX_199, - NXX_200, - NXX_201, - NXX_202, - NXX_203, - NXX_204, - NXX_205, - NXX_206, - NXX_207, - NXX_208, - NXX_209, - NXX_210, - NXX_211, - NXX_212, - NXX_213, - NXX_214, - NXX_215, - NXX_216, - NXX_217, - NXX_218, - NXX_219, - NXX_220, - NXX_221, - NXX_222, - NXX_223, - NXX_224, - NXX_225, - NXX_226, - NXX_227, - NXX_228, - NXX_229, - NXX_230, - NXX_231, - NXX_232, - NXX_233, - NXX_234, - NXX_235, - NXX_236, - NXX_237, - NXX_238, - NXX_239, - NXX_240, - NXX_241, - NXX_242, - NXX_243, - NXX_244, - NXX_245, - NXX_246, - NXX_247, - NXX_248, - NXX_249, - NXX_250, - NXX_251, - NXX_252, - NXX_253, - NXX_254, - NXX_255, - NXX_256, - NXX_257, - NXX_258, - NXX_259, - NXX_260, - NXX_261, - NXX_262, - NXX_263, - NXX_264, - NXX_265, - NXX_266, - NXX_267, - NXX_268, - NXX_269, - NXX_270, - NXX_271, - NXX_272, - NXX_273, - NXX_274, - NXX_275, - NXX_276, - NXX_277, - NXX_278, - NXX_279, - NXX_280, - NXX_281, - NXX_282, - NXX_283, - NXX_284, - NXX_285, - NXX_286, - NXX_287, - NXX_288, - NXX_289, - NXX_290, - NXX_291, - NXX_292, - NXX_293, - NXX_294, - NXX_295, - NXX_296, - NXX_297, - NXX_298, - NXX_299, - NXX_300, - NXX_301, - NXX_302, - NXX_303, - NXX_304, - NXX_305, - NXX_306, - NXX_307, - NXX_308, - NXX_309, - NXX_310, - NXX_311, - NXX_312, - NXX_313, - NXX_314, - NXX_315, - NXX_316, - NXX_317, - NXX_318, - NXX_319, - NXX_320, - NXX_321, - NXX_322, - NXX_323, - NXX_324, - NXX_325, - NXX_326, - NXX_327, - NXX_328, - NXX_329, - NXX_330, - NXX_331, - NXX_332, - NXX_333, - NXX_334, - NXX_335, - NXX_336, - NXX_337, - NXX_338, - NXX_339, - NXX_340, - NXX_341, - NXX_342, - NXX_343, - NXX_344, - NXX_345, - NXX_346, - NXX_347, - NXX_348, - NXX_349, - NXX_350, - NXX_351, - NXX_352, - NXX_353, - NXX_354, - NXX_355, - NXX_356, - NXX_357, - NXX_358, - NXX_359, - NXX_360, - NXX_361, - NXX_362, - NXX_363, - NXX_364, - NXX_365, - NXX_366, - NXX_367, - NXX_368, - NXX_369, - NXX_370, - NXX_371, - NXX_372, - NXX_373, - NXX_374, - NXX_375, - NXX_376, - NXX_377, - NXX_378, - NXX_379, - NXX_380, - NXX_381, - NXX_382, - NXX_383, - NXX_384, - NXX_385, - NXX_386, - NXX_387, - NXX_388, - NXX_389, - NXX_390, - NXX_391, - NXX_392, - NXX_393, - NXX_394, - NXX_395, - NXX_396, - NXX_397, - NXX_398, - NXX_399, - NXX_400, - NXX_401, - NXX_402, - NXX_403, - NXX_404, - NXX_405, - NXX_406, - NXX_407, - NXX_408, - NXX_409, - NXX_410, - NXX_411, - NXX_412, - NXX_413, - NXX_414, - NXX_415, - NXX_416, - NXX_417, - NXX_418, - NXX_419, - NXX_420, - NXX_421, - NXX_422, - NXX_423, - NXX_424, - NXX_425, - NXX_426, - NXX_427, - NXX_428, - NXX_429, - NXX_430, - NXX_431, - NXX_432, - NXX_433, - NXX_434, - NXX_435, - NXX_436, - NXX_437, - NXX_438, - NXX_439, - NXX_440, - NXX_441, - NXX_442, - NXX_443, - NXX_444, - NXX_445, - NXX_446, - NXX_447, - NXX_448, - NXX_449, - NXX_450, - NXX_451, - NXX_452, - NXX_453, - NXX_454, - NXX_455, - NXX_456, - NXX_457, - NXX_458, - NXX_459, - NXX_460, - NXX_461, - NXX_462, - NXX_463, - NXX_464, - NXX_465, - NXX_466, - NXX_467, - NXX_468, - NXX_469, - NXX_470, - NXX_471, - NXX_472, - NXX_473, - NXX_474, - NXX_475, - NXX_476, - NXX_477, - NXX_478, - NXX_479, - NXX_480, - NXX_481, - NXX_482, - NXX_483, - NXX_484, - NXX_485, - NXX_486, - NXX_487, - NXX_488, - NXX_489, - NXX_490, - NXX_491, - NXX_492, - NXX_493, - NXX_494, - NXX_495, - NXX_496, - NXX_497, - NXX_498, - NXX_499, - NXX_500, - NXX_501, - NXX_502, - NXX_503, - NXX_504, - NXX_505, - NXX_506, - NXX_507, - NXX_508, - NXX_509, - NXX_510, - NXX_511, - NXX_512, - ; - - public int cakePoint() { - return FourCornerDotCake.FC_NCR1632_1T.getStart() + ordinal(); - } - - @Override - public int[] cakePoints() { - return new int[] {cakePoint()}; - } -} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash1V.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash1V.java deleted file mode 100644 index ad60bcc..0000000 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash1V.java +++ /dev/null @@ -1,557 +0,0 @@ -/* - * 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.x4o.o2o.fc18.FourCornerDotCake; -import org.x4o.o2o.fc18.FourCornerX18CakePoints; - -/** - * "FC.NCR1632-1V" Four Corner New Counting Rods One Value of a terminator slice. - * - * @author Willem Cazander - * @version 1.0 Dec 30, 2024 - */ -public enum FCDotNCR1632Dash1V implements FourCornerX18CakePoints { - NXX_001, - NXX_002, - NXX_003, - NXX_004, - NXX_005, - NXX_006, - NXX_007, - NXX_008, - NXX_009, - NXX_010, - NXX_011, - NXX_012, - NXX_013, - NXX_014, - NXX_015, - NXX_016, - NXX_017, - NXX_018, - NXX_019, - NXX_020, - NXX_021, - NXX_022, - NXX_023, - NXX_024, - NXX_025, - NXX_026, - NXX_027, - NXX_028, - NXX_029, - NXX_030, - NXX_031, - NXX_032, - NXX_033, - NXX_034, - NXX_035, - NXX_036, - NXX_037, - NXX_038, - NXX_039, - NXX_040, - NXX_041, - NXX_042, - NXX_043, - NXX_044, - NXX_045, - NXX_046, - NXX_047, - NXX_048, - NXX_049, - NXX_050, - NXX_051, - NXX_052, - NXX_053, - NXX_054, - NXX_055, - NXX_056, - NXX_057, - NXX_058, - NXX_059, - NXX_060, - NXX_061, - NXX_062, - NXX_063, - NXX_064, - NXX_065, - NXX_066, - NXX_067, - NXX_068, - NXX_069, - NXX_070, - NXX_071, - NXX_072, - NXX_073, - NXX_074, - NXX_075, - NXX_076, - NXX_077, - NXX_078, - NXX_079, - NXX_080, - NXX_081, - NXX_082, - NXX_083, - NXX_084, - NXX_085, - NXX_086, - NXX_087, - NXX_088, - NXX_089, - NXX_090, - NXX_091, - NXX_092, - NXX_093, - NXX_094, - NXX_095, - NXX_096, - NXX_097, - NXX_098, - NXX_099, - NXX_100, - NXX_101, - NXX_102, - NXX_103, - NXX_104, - NXX_105, - NXX_106, - NXX_107, - NXX_108, - NXX_109, - NXX_110, - NXX_111, - NXX_112, - NXX_113, - NXX_114, - NXX_115, - NXX_116, - NXX_117, - NXX_118, - NXX_119, - NXX_120, - NXX_121, - NXX_122, - NXX_123, - NXX_124, - NXX_125, - NXX_126, - NXX_127, - NXX_128, - NXX_129, - NXX_130, - NXX_131, - NXX_132, - NXX_133, - NXX_134, - NXX_135, - NXX_136, - NXX_137, - NXX_138, - NXX_139, - NXX_140, - NXX_141, - NXX_142, - NXX_143, - NXX_144, - NXX_145, - NXX_146, - NXX_147, - NXX_148, - NXX_149, - NXX_150, - NXX_151, - NXX_152, - NXX_153, - NXX_154, - NXX_155, - NXX_156, - NXX_157, - NXX_158, - NXX_159, - NXX_160, - NXX_161, - NXX_162, - NXX_163, - NXX_164, - NXX_165, - NXX_166, - NXX_167, - NXX_168, - NXX_169, - NXX_170, - NXX_171, - NXX_172, - NXX_173, - NXX_174, - NXX_175, - NXX_176, - NXX_177, - NXX_178, - NXX_179, - NXX_180, - NXX_181, - NXX_182, - NXX_183, - NXX_184, - NXX_185, - NXX_186, - NXX_187, - NXX_188, - NXX_189, - NXX_190, - NXX_191, - NXX_192, - NXX_193, - NXX_194, - NXX_195, - NXX_196, - NXX_197, - NXX_198, - NXX_199, - NXX_200, - NXX_201, - NXX_202, - NXX_203, - NXX_204, - NXX_205, - NXX_206, - NXX_207, - NXX_208, - NXX_209, - NXX_210, - NXX_211, - NXX_212, - NXX_213, - NXX_214, - NXX_215, - NXX_216, - NXX_217, - NXX_218, - NXX_219, - NXX_220, - NXX_221, - NXX_222, - NXX_223, - NXX_224, - NXX_225, - NXX_226, - NXX_227, - NXX_228, - NXX_229, - NXX_230, - NXX_231, - NXX_232, - NXX_233, - NXX_234, - NXX_235, - NXX_236, - NXX_237, - NXX_238, - NXX_239, - NXX_240, - NXX_241, - NXX_242, - NXX_243, - NXX_244, - NXX_245, - NXX_246, - NXX_247, - NXX_248, - NXX_249, - NXX_250, - NXX_251, - NXX_252, - NXX_253, - NXX_254, - NXX_255, - NXX_256, - NXX_257, - NXX_258, - NXX_259, - NXX_260, - NXX_261, - NXX_262, - NXX_263, - NXX_264, - NXX_265, - NXX_266, - NXX_267, - NXX_268, - NXX_269, - NXX_270, - NXX_271, - NXX_272, - NXX_273, - NXX_274, - NXX_275, - NXX_276, - NXX_277, - NXX_278, - NXX_279, - NXX_280, - NXX_281, - NXX_282, - NXX_283, - NXX_284, - NXX_285, - NXX_286, - NXX_287, - NXX_288, - NXX_289, - NXX_290, - NXX_291, - NXX_292, - NXX_293, - NXX_294, - NXX_295, - NXX_296, - NXX_297, - NXX_298, - NXX_299, - NXX_300, - NXX_301, - NXX_302, - NXX_303, - NXX_304, - NXX_305, - NXX_306, - NXX_307, - NXX_308, - NXX_309, - NXX_310, - NXX_311, - NXX_312, - NXX_313, - NXX_314, - NXX_315, - NXX_316, - NXX_317, - NXX_318, - NXX_319, - NXX_320, - NXX_321, - NXX_322, - NXX_323, - NXX_324, - NXX_325, - NXX_326, - NXX_327, - NXX_328, - NXX_329, - NXX_330, - NXX_331, - NXX_332, - NXX_333, - NXX_334, - NXX_335, - NXX_336, - NXX_337, - NXX_338, - NXX_339, - NXX_340, - NXX_341, - NXX_342, - NXX_343, - NXX_344, - NXX_345, - NXX_346, - NXX_347, - NXX_348, - NXX_349, - NXX_350, - NXX_351, - NXX_352, - NXX_353, - NXX_354, - NXX_355, - NXX_356, - NXX_357, - NXX_358, - NXX_359, - NXX_360, - NXX_361, - NXX_362, - NXX_363, - NXX_364, - NXX_365, - NXX_366, - NXX_367, - NXX_368, - NXX_369, - NXX_370, - NXX_371, - NXX_372, - NXX_373, - NXX_374, - NXX_375, - NXX_376, - NXX_377, - NXX_378, - NXX_379, - NXX_380, - NXX_381, - NXX_382, - NXX_383, - NXX_384, - NXX_385, - NXX_386, - NXX_387, - NXX_388, - NXX_389, - NXX_390, - NXX_391, - NXX_392, - NXX_393, - NXX_394, - NXX_395, - NXX_396, - NXX_397, - NXX_398, - NXX_399, - NXX_400, - NXX_401, - NXX_402, - NXX_403, - NXX_404, - NXX_405, - NXX_406, - NXX_407, - NXX_408, - NXX_409, - NXX_410, - NXX_411, - NXX_412, - NXX_413, - NXX_414, - NXX_415, - NXX_416, - NXX_417, - NXX_418, - NXX_419, - NXX_420, - NXX_421, - NXX_422, - NXX_423, - NXX_424, - NXX_425, - NXX_426, - NXX_427, - NXX_428, - NXX_429, - NXX_430, - NXX_431, - NXX_432, - NXX_433, - NXX_434, - NXX_435, - NXX_436, - NXX_437, - NXX_438, - NXX_439, - NXX_440, - NXX_441, - NXX_442, - NXX_443, - NXX_444, - NXX_445, - NXX_446, - NXX_447, - NXX_448, - NXX_449, - NXX_450, - NXX_451, - NXX_452, - NXX_453, - NXX_454, - NXX_455, - NXX_456, - NXX_457, - NXX_458, - NXX_459, - NXX_460, - NXX_461, - NXX_462, - NXX_463, - NXX_464, - NXX_465, - NXX_466, - NXX_467, - NXX_468, - NXX_469, - NXX_470, - NXX_471, - NXX_472, - NXX_473, - NXX_474, - NXX_475, - NXX_476, - NXX_477, - NXX_478, - NXX_479, - NXX_480, - NXX_481, - NXX_482, - NXX_483, - NXX_484, - NXX_485, - NXX_486, - NXX_487, - NXX_488, - NXX_489, - NXX_490, - NXX_491, - NXX_492, - NXX_493, - NXX_494, - NXX_495, - NXX_496, - NXX_497, - NXX_498, - NXX_499, - NXX_500, - NXX_501, - NXX_502, - NXX_503, - NXX_504, - NXX_505, - NXX_506, - NXX_507, - NXX_508, - NXX_509, - NXX_510, - NXX_511, - NXX_512, - ; - - public int cakePoint() { - return FourCornerDotCake.FC_NCR1632_1V.getStart() + ordinal(); - } - - @Override - public int[] cakePoints() { - return new int[] {cakePoint()}; - } -} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7AlphaOmega.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7AlphaOmega.java new file mode 100644 index 0000000..9acad4d --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7AlphaOmega.java @@ -0,0 +1,34 @@ +/* + * 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.zion7; + +/// Handles the lexer document mode begin and end strobes. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 11, 2025 +public interface FourCornerZion7AlphaOmega extends FourCornerZion7Candlelier { + + void strobeDocumentAlpha(); + + void strobeDocumentOmega(); +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash0F.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7Candlelier.java similarity index 71% rename from nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash0F.java rename to nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7Candlelier.java index c546765..e947e36 100644 --- a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zero33/FCDotNCR1632Dash0F.java +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7Candlelier.java @@ -20,25 +20,26 @@ * 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; +package org.x4o.o2o.fc18.zion7; + +import java.math.BigInteger; +import java.util.List; import org.x4o.o2o.fc18.FourCornerDotCake; -import org.x4o.o2o.fc18.FourCornerX18CakePoints; -/** - * "FC.NCR1632-0F" Four Corner New Counting Rods optional flags. - * - * @author Willem Cazander - * @version 1.0 Dec 31, 2024 - */ -public enum FCDotNCR1632Dash0F implements FourCornerX18CakePoints { +/// Handles the main lexer four corner cake strobes. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 09, 2025 +public interface FourCornerZion7Candlelier { - /// Reserved TODO: Check if we need 1PI/2PI/3PI/NaN minus in 4D and maybe replace math symbols from P6 to here.. - RESERVED, - ; + /// Block of relative slice numbers. + void strobeWords(FourCornerDotCake slice, List offsets); - @Override - public int[] cakePoints() { - return new int[] {FourCornerDotCake.FC_NCR1632_0F.getStart() + ordinal()}; - } + /// One based already + void strobeNCR1632(BigInteger denominator, BigInteger numerator); + + void strobeUnicode(List codePoints); + + void strobeNether(List key, List octals); } diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7SalahSequence.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7SalahSequence.java new file mode 100644 index 0000000..365f9b5 --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7SalahSequence.java @@ -0,0 +1,36 @@ +/* + * 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.zion7; + +import java.util.List; + +/// Handles the lexer salah sequence strobes. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 11, 2025 +public interface FourCornerZion7SalahSequence extends FourCornerZion7Candlelier { + + void strobeSalahRaka(Integer cakePoint); + + void strobeSalahRaketSequence(List> arguments); +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7TempleScrolls.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7TempleScrolls.java new file mode 100644 index 0000000..0d5f64a --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZion7TempleScrolls.java @@ -0,0 +1,34 @@ +/* + * 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.zion7; + +/// Handles the four corner temple scrolls strobes. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 11, 2025 +public interface FourCornerZion7TempleScrolls extends FourCornerZion7Candlelier { + + //void strobeElementStart(PrimordialOctalOrangeJuiceCord uri, PrimordialOctalOrangeJuiceCord tag); + + //void strobeElementEnd(); +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoGrapher.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoGrapher.java new file mode 100644 index 0000000..7d9db27 --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoGrapher.java @@ -0,0 +1,33 @@ +/* + * 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.zion7; + +/// Write steno for zion. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 11, 2025 +public class FourCornerZionStenoGrapher { + + public void write() { + } +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoLexer.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoLexer.java new file mode 100644 index 0000000..4a676c5 --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoLexer.java @@ -0,0 +1,479 @@ +/* + * 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.zion7; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; + +import org.x4o.o2o.fc18.FourCornerDotCake; +import org.x4o.o2o.fc18.zero33.FCDotAPL1604DashP8L; +import org.x4o.o2o.fc18.zero33.FCDotBYD1604DashP8H; +import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6; +import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7; + +/// Parsed FC text and calls the handler methods for the classified strobe lights. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 09, 2025 +public class FourCornerZionStenoLexer { + + private final boolean handlerEscape; + private final FourCornerZion7Candlelier handler; + private final FourCornerZion7AlphaOmega handlerDocument; + private final FourCornerZion7SalahSequence handlerRocket; + private final FourCornerZion7TempleScrolls handlerTempleScrolls; + private final List scanners = new ArrayList<>(); + private Iterator input = null; + private Integer cakePoint = null; + private int currLine = 0; + private int currCol = 0; + private FourCornerZionStenoLexerSmoke smokeSignals; + + public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler) { + this(handler, true); + } + + public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) { + this.handler = Objects.requireNonNull(handler); + this.handlerEscape = handlerEscape; + if (handler instanceof FourCornerZion7AlphaOmega) { + this.handlerDocument = FourCornerZion7AlphaOmega.class.cast(handler); + } else { + this.handlerDocument = null; + } + if (handler instanceof FourCornerZion7SalahSequence) { + this.handlerRocket = FourCornerZion7SalahSequence.class.cast(handler); + } else { + this.handlerRocket = null; + } + if (handler instanceof FourCornerZion7TempleScrolls) { + this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler); + } else { + this.handlerTempleScrolls = null; + } + for (FourCornerDotCake cakeSlice : FourCornerDotCake.values()) { + if (cakeSlice.name().startsWith("__")) { + continue; // can't handle reserved, we be reported as + } + if (FourCornerDotCake.FC_CDC1604_P6.equals(cakeSlice)) { + continue; // handle esc's manual + } + if (FourCornerDotCake.FC_DEC1604_P7.equals(cakeSlice)) { + continue; // handle esc's manual + } + if (cakeSlice.name().startsWith("FC_NCR")) { + continue; // parse blocks manual + } + if (cakeSlice.name().startsWith("FC_UNI")) { + continue; // parse blocks manual + } + if (FourCornerDotCake.FC_NETHER.equals(cakeSlice)) { + continue; // merge the nether data to octals manual + } + this.scanners.add(new StenoScannerWordCakeSlice(cakeSlice)); + } + this.scanners.add(new StenoScannerCDC()); + this.scanners.add(new StenoScannerDEC()); + this.scanners.add(new StenoScannerNCR18()); + this.scanners.add(new StenoScannerUNI21()); + this.scanners.add(new StenoScannerNether()); + } + + public FourCornerZionStenoLexer withSmokeSignals(FourCornerZionStenoLexerSmoke smokeSignals) { + this.smokeSignals = smokeSignals; + return this; + } + + private enum ScanResult { + EOF, + NEXT, + DONE, + ; + public boolean isEOF() { + return this == EOF; + } + public boolean isDone() { + return this == DONE; + } + } + + private interface StenoScanner { + ScanResult scan(); + } + + public void read(List points) { + read(points.iterator()); + } + + public void read(Iterator points) { + this.input = Objects.requireNonNull(points); + this.cakePoint = null; + this.currLine = 0; + this.currCol = 0; + if (handlerDocument != null) { + handlerDocument.strobeDocumentAlpha(); + } + while (input.hasNext()) { + if (safeNext().isEOF()) { + break; + } + ScanResult run = ScanResult.DONE; + while (run.isDone()) { + run = parseSections(); + } + if (run.isEOF()) { + break; + } + if (smokeSignals != null) { + smokeSignals.burnUnsupported(currLine, currCol, cakePoint); + } + } + if (handlerDocument != null) { + handlerDocument.strobeDocumentOmega(); + } + } + + private ScanResult parseSections() { + ScanResult result = ScanResult.NEXT; + for (StenoScanner scanner : scanners) { + result = scanner.scan(); + if (result.isEOF()) { + return result; + } + if (result.isDone()) { + return result; + } + } + return result; + } + + private ScanResult safeNext() { + if (!input.hasNext()) { + return ScanResult.EOF; + } + cakePoint = input.next(); + currCol++; + return ScanResult.DONE; + } + + private ScanResult safeReadCakePoints(int start, int stop, List result) { + return safeReadRange(start, stop, result, false); + } + + private ScanResult safeReadSliceOffsets(int start, int stop, List result) { + return safeReadRange(start, stop, result, true); + } + + private ScanResult safeReadRange(int start, int stop, List result, boolean offset) { + while (cakePoint >= start && cakePoint <= stop) { + if (offset) { + result.add(cakePoint - start); + } else { + result.add(cakePoint); + } + if (safeNext().isEOF()) { + return ScanResult.EOF; + } + } + return ScanResult.DONE; + } + + class StenoScannerWordCakeSlice implements StenoScanner { + + private final FourCornerDotCake cakeSlice; + + public StenoScannerWordCakeSlice(FourCornerDotCake cakeSlice) { + this.cakeSlice = Objects.requireNonNull(cakeSlice); + } + + @Override + public ScanResult scan() { + if (cakeSlice.containsNot(cakePoint)) { + return ScanResult.NEXT; + } + List result = new ArrayList<>(); + ScanResult status = safeReadSliceOffsets(cakeSlice.getStart(), cakeSlice.getStop(), result); + if (!result.isEmpty()) { + handler.strobeWords(cakeSlice, result); + } + return status; + } + } + + class StenoScannerNether implements StenoScanner { + + @Override + public ScanResult scan() { + if (FourCornerDotCake.FC_NETHER.containsNot(cakePoint)) { + return ScanResult.NEXT; + } + List result = new ArrayList<>(); + ScanResult status = safeReadCakePoints(FourCornerDotCake.FC_NETHER.getStart(), FourCornerDotCake.FC_NETHER.getStop(), result); + if (!result.isEmpty()) { + handlePoints(result); + } + return status; + } + + private void handlePoints(List slicedPoints) { + // TODO: convert from 15 bit to 3 bit + handler.strobeNether(null, slicedPoints); + } + } + + class StenoScannerNCR18 implements StenoScanner { + + @Override + public ScanResult scan() { + if (cakePoint < FourCornerDotCake.FC_NCR1632_XD.getStart() || cakePoint > FourCornerDotCake.FC_NCR1632_XN.getStop()) { + return ScanResult.NEXT; + } + List result = new ArrayList<>(); + ScanResult status = safeReadCakePoints(FourCornerDotCake.FC_NCR1632_XD.getStart(), FourCornerDotCake.FC_NCR1632_XN.getStop(), result); + if (!result.isEmpty()) { + handlePoints(result); // mix of four blocks + } + return status; + } + + private void handlePoints(List slicedPoints) { + int denominatorBank[] = new int[64]; // <== is the terminator select per 9 bit group + int numeratorBank[] = new int[64]; + for (Integer cakePoint : slicedPoints) { + if (cakePoint >= FourCornerDotCake.FC_NCR1632_XD.getStart() && cakePoint <= FourCornerDotCake.FC_NCR1632_XD.getStop()) { + int denominatorX = cakePoint - FourCornerDotCake.FC_NCR1632_XD.getStart(); + denominatorBank[denominatorX / 512] = denominatorX % 512; + continue; + } + int numeratorX = cakePoint - FourCornerDotCake.FC_NCR1632_XN.getStart(); + numeratorBank[numeratorX / 512] = numeratorX % 512; + + if (cakePoint > FourCornerDotCake.FC_NCR1632_XN.getStart() + 512) { + continue; // Only fire fraction on lowest value select + } + BigInteger denominator = BigInteger.ONE; + for (int i=0; i FourCornerDotCake.FC_UNI2K_11.getStop()) { + return ScanResult.NEXT; + } + List result = new ArrayList<>(); + ScanResult status = safeReadCakePoints(FourCornerDotCake.FC_UNI2K_22.getStart(), FourCornerDotCake.FC_UNI2K_11.getStop(), result); + if (!result.isEmpty()) { + handlePoints(result); // mix of the two unicode blocks pages + } + return status; + } + + private void handlePoints(List slicedPoints) { + List result = new ArrayList<>(); + int codePoint22 = 0; + for (Integer cakePoint : slicedPoints) { + if (cakePoint >= FourCornerDotCake.FC_UNI2K_22.getStart() && cakePoint <= FourCornerDotCake.FC_UNI2K_22.getStop()) { + codePoint22 = cakePoint - FourCornerDotCake.FC_UNI2K_22.getStart(); + continue; + } + int codePointL = cakePoint - FourCornerDotCake.FC_UNI2K_11.getStart(); + int codePoint = (codePoint22 << 11) + codePointL; + result.add(codePoint); + } + handler.strobeUnicode(result); + } + } + + class StenoScannerCDC implements StenoScanner { + + Integer numberMode = null; + boolean numberPIE = true; + + @Override + public ScanResult scan() { + if (FourCornerDotCake.FC_CDC1604_P6.containsNot(cakePoint)) { + return ScanResult.NEXT; + } + List result = new ArrayList<>(); + ScanResult status = safeReadCakePoints(FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.FC_CDC1604_P6.getStop(), result); + if (!result.isEmpty()) { + handlePoints(result); + } + return status; + } + + private void handlePoints(List slicedPoints) { + Iterator cdc = slicedPoints.iterator(); + numberMode = null; + numberPIE = true; + while (cdc.hasNext()) { + Integer cdcPoint = cdc.next(); + if (FCDotCDC1604DashP6._NEWLINE.ordinal() == cdcPoint) { + currLine++; + if (smokeSignals != null) { + smokeSignals.burnNewLine(); + } + } + if (handlerEscape) { + handleCDC(cdc, cdcPoint); + } else { + handler.strobeWords(FourCornerDotCake.FC_CDC1604_P6, List.of(cdcPoint)); + } + } + } + + private void handleCDC(Iterator cdc, Integer cdcPoint) { + if (FCDotCDC1604DashP6.__ESC6.ordinal() == cdcPoint) { + if (!cdc.hasNext()) { + return; + } + FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(cdc.next()); + numberMode = null; // out of range, thus stop + Integer handled = handleEscape6(decCode, cdc); + if (handled == null) { + return; + } + cdcPoint = handled; // out of range, is back to normal + } + if (numberMode != null && (cdcPoint > numberMode)) { + numberMode = null; // out of range + } + if (numberMode != null && (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal())) { + numberMode = null; // below index 1 is end number mode + } + if (FCDotCDC1604DashP6.__PIE68.ordinal() == cdcPoint || FCDotCDC1604DashP6.__NCR68.ordinal() == cdcPoint) { + if (!cdc.hasNext()) { + return; + } + numberMode = cdc.next(); + numberPIE = FCDotCDC1604DashP6.__PIE68.ordinal() == cdcPoint; // is false for PIN + if (numberMode != null && numberMode < FCDotCDC1604DashP6.NX01_A.ordinal()) { + cdcPoint = numberMode; // print char + numberMode = null; // illegal number mode + } else { + return; + } + } + if (numberMode == null) { + handler.strobeWords(FourCornerDotCake.FC_CDC1604_P6, List.of(cdcPoint)); + return; + } + if (numberPIE) { + int terminatorOffZero = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal(); + int numberIdxOffZero = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal(); + FourCornerDotCake slice = FourCornerDotCake.values()[terminatorOffZero + FourCornerDotCake.FC_PIE9C_01.ordinal()]; + handler.strobeWords(slice, List.of(numberIdxOffZero)); + } else { // _PIN = ²⁄₁₂ + int terminatorOff = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal() + 1; + int numberIdxOff = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal() + 1; + BigInteger denominator = BigInteger.valueOf(terminatorOff); + BigInteger numerator = BigInteger.valueOf(numberIdxOff); + handler.strobeNCR1632(denominator, numerator); + } + } + } + + class StenoScannerDEC implements StenoScanner { + + @Override + public ScanResult scan() { + if (FourCornerDotCake.FC_DEC1604_P7.containsNot(cakePoint)) { + return ScanResult.NEXT; + } + Integer decPoint = cakePoint - FourCornerDotCake.FC_DEC1604_P7.getLength(); + FCDotDEC1604DashP7 decCode = FCDotDEC1604DashP7.indexOf(decPoint); + if (handlerEscape) { + //numberMode = null; // out of range, thus stop + Integer handled = handleEscape6(decCode, input); + if (handled == null) { + return safeNext(); + } + //cakePoint = handled; // out of range, is back to normal + } + handler.strobeWords(FourCornerDotCake.FC_DEC1604_P7, List.of(decPoint)); + return safeNext(); + } + } + + private Integer handleEscape6(FCDotDEC1604DashP7 decCode, Iterator cdc) { + if (FCDotDEC1604DashP7.__NUL_DEC.equals(decCode)) { + return null; + } + if (FCDotDEC1604DashP7.__ESC6_APL.equals(decCode)) { + if (!cdc.hasNext()) { + return null; + } + FCDotAPL1604DashP8L aplCode = FCDotAPL1604DashP8L.indexOf(cdc.next()); + handler.strobeWords(FourCornerDotCake.FC_APL1604_P8L, List.of(aplCode.ordinal())); + return null; + } + if (FCDotDEC1604DashP7.__ESC6_BYD.equals(decCode)) { + if (!cdc.hasNext()) { + return null; + } + FCDotBYD1604DashP8H bydCode = FCDotBYD1604DashP8H.indexOf(cdc.next()); + handler.strobeWords(FourCornerDotCake.FC_BYD1604_P8H, List.of(bydCode.ordinal())); + return null; + } + if (FCDotDEC1604DashP7.__ESC_STOP.equals(decCode)) { + return null; + } + if (FCDotDEC1604DashP7.__ESC68_FC18.equals(decCode)) { + return decCode.ordinal(); // todo handle + } + if (FCDotDEC1604DashP7.__ESC18_NETHER.equals(decCode)) { + if (!cdc.hasNext()) { + return null; + } +// buf.append(FCDotCDC1604DashP6.escapeSignUnicode(FCDotCDC1604DashP6.__ESC6.ordinal()));// TODO: add new symbol + // TODO: eat header and eat data, as we can't display it + return null; + } + if (FCDotDEC1604DashP7.VT_RAKA_AT.equals(decCode)) { + return decCode.ordinal(); // todo handle + } + if (FCDotDEC1604DashP7.VT_SALAH.equals(decCode)) { + return decCode.ordinal(); // todo handle + } + if (handlerRocket == null) { + handler.strobeWords(FourCornerDotCake.FC_DEC1604_P7, List.of(decCode.ordinal())); + } else { + handlerRocket.strobeSalahRaka(decCode.cakePoints()[0]); + } + return null; + } +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoLexerSmoke.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoLexerSmoke.java new file mode 100644 index 0000000..931af13 --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/FourCornerZionStenoLexerSmoke.java @@ -0,0 +1,35 @@ +/* + * 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.zion7; + +/// Provides lexer smoke signals feedback. +/// +/// @author Willem Cazander +/// @version 1.0 Jan 12, 2025 +public interface FourCornerZionStenoLexerSmoke { + + default void burnNewLine() { + } + + void burnUnsupported(int line, int col, int cakePoint); +} diff --git a/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/package-info.java b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/package-info.java new file mode 100644 index 0000000..e76bc79 --- /dev/null +++ b/nx01-x4o-o2o/src/main/java/org/x4o/o2o/fc18/zion7/package-info.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +/** + * Zerial IO version 7 for orange juice. + * + * @since 1.0 + */ +package org.x4o.o2o.fc18.zion7; diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java index 2c6ac0f..ef07724 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeDisplayTest.java @@ -22,6 +22,7 @@ */ package org.x4o.o2o.fc18; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -30,9 +31,6 @@ import org.junit.jupiter.api.Test; import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash26; import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6; import org.x4o.o2o.fc18.zero33.FCDotDEC1604DashP7; -import org.x4o.o2o.fc18.zero33.FCDotNCR1632Dash0M; -import org.x4o.o2o.fc18.zero33.FCDotNCR1632Dash1T; -import org.x4o.o2o.fc18.zero33.FCDotNCR1632Dash1V; /** * Tests four corner displayed as unicode. @@ -43,7 +41,7 @@ import org.x4o.o2o.fc18.zero33.FCDotNCR1632Dash1V; public class FourCornerUnicodeDisplayTest { @Test - public void testPINSimple() throws Exception { + public void testNCRSimpleX06() throws Exception { List cdc = new ArrayList<>(); cdc.add(FCDotCDC1604DashP6.NX24_X); // = X cdc.add(FCDotCDC1604DashP6.EQUALS); @@ -62,39 +60,35 @@ public class FourCornerUnicodeDisplayTest { } @Test - public void testPINLarge() throws Exception { + public void testNCRLargeF9() throws Exception { List cdc = new ArrayList<>(); cdc.add(FCDotCDC1604DashP6.NX24_X.ordinal()); // = X cdc.add(FCDotCDC1604DashP6.EQUALS.ordinal()); - cdc.add(FourCornerDotCake.FC_NCR1632_1T.getStart()); // T011 - cdc.add(FourCornerDotCake.FC_NCR1632_1V.getStart()); // NXX_011 - cdc.add(FourCornerDotCake.FC_NCR1632_1T.getStart() - 1 + 15); // T015 - cdc.add(FourCornerDotCake.FC_NCR1632_1V.getStart() - 1 + 14); // NXX_014 - cdc.add(FCDotNCR1632Dash1T.NXX_456.cakePoint()); // T456 - cdc.add(FCDotNCR1632Dash1V.NXX_123.cakePoint()); // NXX_123 - cdc.add(FCDotNCR1632Dash1V.NXX_004.cakePoint()); // NXX_004 + cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 11); // NXX_011 + cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart()); // T001 + cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart()); // NXX_001 + cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() - 1 + 15); // T015 + cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 14); // NXX_014 + cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() - 1 + 1); // one + cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() + 512 + 2); // T1024 + one + cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 123); // NXX_123 + cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 4); // NXX_004 cdc.add(FCDotCDC1604DashP6.SEMICOLON.ordinal()); cdc.add(FCDotCDC1604DashP6._NEWLINE.ordinal()); - Assertions.assertEquals("X=¹/₁¹⁴/₁₅¹²³/₄₅₆⁴/₄₅₆;\n", FourCornerUnicodeDisplay.text().renderFromInt18(cdc)); + Assertions.assertEquals("X=¹¹/₁¹/₁¹⁴/₁₅¹²³/₁₀₂₅⁴/₁₀₂₅;\n", FourCornerUnicodeDisplay.text().renderFromInt18(cdc)); } @Test - public void testPINLargest() throws Exception { + public void testNCRLargestF576() throws Exception { List cdc = new ArrayList<>(); - cdc.add(FCDotCDC1604DashP6.NX24_X.ordinal()); // = X - cdc.add(FCDotCDC1604DashP6.EQUALS.ordinal()); - cdc.add(FCDotNCR1632Dash0M.NXX_001.cakePoint()); // block size of 1T and 1V are x1 to x512 - cdc.add(FCDotNCR1632Dash1T.NXX_456.cakePoint()); // T456 - cdc.add(FCDotNCR1632Dash1V.NXX_123.cakePoint()); // NXX_123 - cdc.add(FCDotNCR1632Dash1V.NXX_004.cakePoint()); // NXX_004 - cdc.add(FCDotCDC1604DashP6.SEMICOLON.ordinal()); - cdc.add(FCDotCDC1604DashP6._NEWLINE.ordinal()); + cdc.add(FourCornerDotCake.FC_NCR1632_XD.getStart() + (512*63) + 1); + cdc.add(FourCornerDotCake.FC_NCR1632_XN.getStart() - 1 + 123); // NXX_123 - // TODO: add support - //Assertions.assertEquals("X=¹²³/₄₅₆⁴/₄₅₆;\n", FourCornerUnicodeDisplay.text().renderFromInt18(cdc)); + String res = "¹²³/₄₈₃₀₆₇₁₉₀₃₇₇₁₅₇₂₉₃₀₈₆₉₁₈₉₈₆₃₆₆₄₉₈₄₁₈₀₃₇₃₆₅₉₁₆₂₁₃₃₀₄₃₇₄₈₃₂₁₅₄₄₀₆₄₃₁₄₃₉₈₉₂₇₈₆₁₉₅₀₅₃₀₆₇₀₂₄₂₂₀₈₂₂₇₄₀₃₂₂₂₄₅₃₀₇₉₅₂₀₀₃₉₃₇₇₇₂₁₄₇₁₇₀₆₃₄₈₃₂₆₃₀₃₇₃₄₅₆₉₆₇₈₆₃₅₈₄₁₈₃₃₈₅₀₉₃₅₈₇₁₂₂₆₀₁₈₅₂₉₂₉"; + Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc)); } - + @Test public void testMixedCasing() throws Exception { List cdc = new ArrayList<>(); @@ -145,4 +139,23 @@ public class FourCornerUnicodeDisplayTest { Assertions.assertEquals("B3K", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); } + + @Test + public void testUnicode() throws Exception { + List cdc = new ArrayList<>(); + cdc.add(FCDotCDC1604DashP6.NX23_W.ordinal()); + cdc.add(FCDotCDC1604DashP6.EQUALS.ordinal()); + cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.embedUNI2K("©Δ∞ 仙上主天")); + cdc.add(FCDotCDC1604DashP6.PLUS.ordinal()); + cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.embedUNI2K("𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡 𑀪𑀸𑀕")); + cdc.add(FCDotCDC1604DashP6.SEMICOLON.ordinal()); + cdc.add(FCDotCDC1604DashP6._NEWLINE.ordinal()); + + String outputExpected = "W=©Δ∞ 仙上主天+𑀳𑁂𑀮𑀺𑀉𑁄𑀤𑁄𑀭𑁂𑀡 𑀪𑀸𑀕;\n"; + Assertions.assertEquals(outputExpected, FourCornerUnicodeDisplay.text().renderFromInt18(cdc)); + + int bitsUTF8 = outputExpected.getBytes(StandardCharsets.UTF_8).length*8; + int bitsFC18 = cdc.size()*18; + Assertions.assertTrue(bitsFC18 < bitsUTF8, "FC18 is not smaller"); + } } diff --git a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeImportTest.java b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeImportTest.java index 50c7612..c754942 100644 --- a/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeImportTest.java +++ b/nx01-x4o-o2o/src/test/java/org/x4o/o2o/fc18/FourCornerUnicodeImportTest.java @@ -146,6 +146,18 @@ public class FourCornerUnicodeImportTest { }); } + @Test + public void testCheckMissingChar() throws Exception { + String foobar = "FOO\u5432\u5432\u5432"; + List cdc = FourCornerUnicodeImport.lossy().convertToX06(foobar); + Assertions.assertNotNull(cdc); + Assertions.assertFalse(cdc.isEmpty()); + Assertions.assertEquals("FOO???", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); + Assertions.assertThrows(IllegalArgumentException.class, () -> { + FourCornerUnicodeImport.strict().convertToX06(foobar); + }); + } + @Test public void testNumberX06() throws Exception { List cdc = FourCornerUnicodeImport.strict().convertToX06("01201337"); 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 9a7c53d..27bc833 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 @@ -56,23 +56,27 @@ public class FCDotDEC1604DashP7Test { @Test public void testCusorGoto() throws Exception { List cdc = new ArrayList<>(); - cdc.add(FCDotDEC1604DashP7.NX_CURSOR_GOTO); + cdc.add(FCDotDEC1604DashP7.NX_CURSOR_GOTO); + cdc.add(FCDotDEC1604DashP7.VT_RAKA_AT); + cdc.add(FCDotCDC1604DashP6.NX25_Y); + cdc.add(FCDotDEC1604DashP7.VT_RAKA_AT); cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(123)); - cdc.add(FCDotDEC1604DashP7.VT_NX01_NEXT); + cdc.add(FCDotDEC1604DashP7.VT_RAKA_AT); cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(456)); - cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE); + cdc.add(FCDotDEC1604DashP7.VT_SALAH); - Assertions.assertEquals("␃Y␁JBCD␃?␁JEFG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); - Assertions.assertEquals("␃Y123␃?456␃!", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); + Assertions.assertEquals("␃Y␃?Y␃?␁JBCD␃?␁JEFG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); + Assertions.assertEquals("?Y?123?456!", FourCornerUnicodeDisplay.text().renderFromX06(cdc)); } @Test public void testClearTop5Lines() throws Exception { List cdc = new ArrayList<>(); cdc.add(FCDotDEC1604DashP7.NX_CLEAR_TOP); + cdc.add(FCDotDEC1604DashP7.VT_RAKA_AT); cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(5)); - cdc.add(FCDotDEC1604DashP7.VT_NX01_EXECUTE); + cdc.add(FCDotDEC1604DashP7.VT_SALAH); - Assertions.assertEquals("␃E␁JF␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); + Assertions.assertEquals("␃E␃?␁JF␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc)); } }