From e04aa1440b6e591e16997528e216016487fcb1a3 Mon Sep 17 00:00:00 2001 From: Willem Date: Fri, 24 Jan 2025 01:39:59 +0100 Subject: [PATCH] Removed sand worm spice state from steno lexer --- .../x4o/fc18/FourCornerUnicodeDisplay.java | 24 ++++++--- .../fc18/zion7/FourCornerZion7Candlelier.java | 20 +++---- .../fc18/zion7/FourCornerZion7WaterCodex.java | 18 ++++++- .../fc18/zion7/FourCornerZionStenoLexer.java | 53 ++++++++----------- .../zion7/FourCornerZionStenoLexerFire.java | 6 --- .../zion7/FourCornerZionStenoLexerSmoke.java | 6 --- 6 files changed, 65 insertions(+), 62 deletions(-) diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java index f9c6c08..12b8e59 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/FourCornerUnicodeDisplay.java @@ -36,6 +36,7 @@ import org.x4o.fc18.cake2.FourCornerX18CakePointSequence; import org.x4o.fc18.cake2.pie9d.FCDotPIE9DDash09; import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6; import org.x4o.fc18.zion7.FourCornerZion7Candlelier; +import org.x4o.fc18.zion7.FourCornerZion7WaterCodex; import org.x4o.fc18.zion7.FourCornerZionStenoLexer; import org.x4o.fc18.zion7.FourCornerZionStenoLexerSmoke; @@ -118,7 +119,7 @@ public class FourCornerUnicodeDisplay { lexer.withSmokeSignals(printer).read(chars); } - private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZionStenoLexerSmoke.Adapter { + private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZion7WaterCodex, FourCornerZionStenoLexerSmoke.Adapter { private final StringBuilder output; private FourCornerZionStenoLexer thisDisplayEscaked = null; @@ -216,11 +217,6 @@ public class FourCornerUnicodeDisplay { renderFromInt18(math, output); } - @Override - public void strobeUnicode(List codePoints) { - codePoints.forEach(v -> output.appendCodePoint(v)); - } - @Override public void strobeRecursiveCake(List cakePoints) { if (thisDisplayEscaked == null) { @@ -230,8 +226,11 @@ public class FourCornerUnicodeDisplay { } @Override - public void strobeSandWorm(List head, List body) { - // TODO Auto-generated method stub + public void strobeSandWalker(List rhythm) { + } + + @Override + public void strobeSandWorm(List spice) { } @Override @@ -245,5 +244,14 @@ public class FourCornerUnicodeDisplay { output.append(";"); } } + + @Override + public void strobeWaterUnicode(List codePoints) { + codePoints.forEach(v -> output.appendCodePoint(v)); + } + + @Override + public void strobeWaterKanji(List kuTenPoints) { + } } } diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java index f21f10e..e655d90 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7Candlelier.java @@ -42,14 +42,14 @@ public interface FourCornerZion7Candlelier { /// 1152 bit fractions of two 576 bit numbers. void strobeNCR1632(BigInteger denominator, BigInteger numerator); - /// To support current code and resources which require unicode to access. - void strobeUnicode(List codePoints); - /// Allows a 6 bit computer to use the nether,fractions or unicode. void strobeRecursiveCake(List cakePoints); + + /// Octal sand walker, with an 72 to 576 bit mime-type rhythm header. + void strobeSandWalker(List rhythm); - /// Octal sand worm, with up to 576 bit mime-type data type header. - void strobeSandWorm(List head, List body); + /// Octal sand worm spice + void strobeSandWorm(List spice); interface Adapter extends FourCornerZion7Candlelier { @@ -65,16 +65,16 @@ public interface FourCornerZion7Candlelier { default void strobeNCR1632(BigInteger denominator, BigInteger numerator) { } - @Override - default void strobeUnicode(List codePoints) { - } - @Override default void strobeRecursiveCake(List cakePoints) { } @Override - default void strobeSandWorm(List head, List body) { + default void strobeSandWalker(List rhythm) { + } + + @Override + default void strobeSandWorm(List spice) { } } } diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7WaterCodex.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7WaterCodex.java index 23fd760..96cfc7d 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7WaterCodex.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZion7WaterCodex.java @@ -24,12 +24,26 @@ package org.x4o.fc18.zion7; import java.util.List; -import org.x4o.fc18.cake2.zero33.FCDotDEC0901DashEU; - /// Handles the lexer water codex strobes. /// /// @author Willem Cazander /// @version 1.0 Jan 22, 2025 public interface FourCornerZion7WaterCodex extends FourCornerZion7Candlelier { + /// To support current code and resources which require unicode to access. + void strobeWaterUnicode(List codePoints); + + /// To support native rendering on the MSX + void strobeWaterKanji(List kuTenPoints); + + interface Adapter extends FourCornerZion7WaterCodex, FourCornerZion7Candlelier.Adapter { + + @Override + default void strobeWaterUnicode(List codePoints) { + } + + @Override + default void strobeWaterKanji(List kuTenPoints) { + } + } } diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java index 4179696..0284341 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexer.java @@ -45,20 +45,18 @@ import org.x4o.fc18.cake2.zero33.FCDotDEC2701DashPX0; public class FourCornerZionStenoLexer { private final static FourCornerZion7AlphaOmega CLEAN_BIBLE = new FourCornerZion7AlphaOmega.Adapter() {}; + private final static FourCornerZion7WaterCodex CLEAN_WATER = new FourCornerZion7WaterCodex.Adapter() {}; private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.Adapter() {}; private final static FourCornerZionStenoLexerSmoke CLEAN_SMOKE = new FourCornerZionStenoLexerSmoke.Adapter() {}; private final boolean handlerEscape; private final FourCornerZion7Candlelier handler; private final FourCornerZion7AlphaOmega handlerDocument; + private final FourCornerZion7WaterCodex handlerCodex; private final FourCornerZion7SalahSequence handlerSalahSequence; private final FourCornerZion7TempleScrolls handlerTempleScrolls; private final List scanners = new ArrayList<>(); // TODO: make static is WIP private final int denominatorBank[] = new int[64]; // <== is the terminator select per 9 bit group private final int numeratorBank[] = new int[denominatorBank.length]; - private final List sandwormHead = new ArrayList<>(); - private boolean sandwormSign = false; - private int sandwormSignLine = 0; - private int sandwormSignColumn = 0; private List input; private int inputIndex = 0; private int currLine = 0; @@ -78,6 +76,11 @@ public class FourCornerZionStenoLexer { } else { this.handlerDocument = CLEAN_BIBLE; } + if (handler instanceof FourCornerZion7WaterCodex) { + this.handlerCodex = FourCornerZion7WaterCodex.class.cast(handler); + } else { + this.handlerCodex = CLEAN_WATER; + } if (handler instanceof FourCornerZion7SalahSequence) { this.handlerSalahSequence = FourCornerZion7SalahSequence.class.cast(handler); } else { @@ -170,9 +173,6 @@ public class FourCornerZionStenoLexer { smokeSignals.burnUnsupported(currLine, currCol, input.get(inputIndex)); } } - if (sandwormSign) { - smokeSignals.burnSandWormSignUnused(sandwormSignLine, sandwormSignColumn); - } handlerDocument.strobeDocumentOmega(); } @@ -301,9 +301,6 @@ public class FourCornerZionStenoLexer { @Override public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) { - if (lexer.sandwormSign) { - lexer.smokeSignals.burnSandWormSignUnused(lexer.sandwormSignLine, lexer.sandwormSignColumn); - } int bitSize = 0; int bitIdxLast = 0; int[] sandWalking = new int[576]; @@ -318,7 +315,7 @@ public class FourCornerZionStenoLexer { sandWalking[bitOff] = 1; bitSize = bitOff; } - lexer.sandwormHead.clear(); + List sandwormHead = new ArrayList<>(); PrimitiveIterator.OfInt i = Arrays.stream(sandWalking).iterator(); int octalIdx = 2; int octalValue = 0; @@ -334,20 +331,17 @@ public class FourCornerZionStenoLexer { octalIdx--; continue; } - lexer.sandwormHead.add(octalValue); + sandwormHead.add(octalValue); octalIdx = 2; octalValue = 0; } - int wormHeadSize = lexer.sandwormHead.size(); - if (WORM_SIGN.contains(wormHeadSize)) { - lexer.sandwormSign = true; - lexer.sandwormSignLine = lexer.currLine; - lexer.sandwormSignColumn = lexer.currCol; - lexer.fireSignals.fireStateSandWormSign(wormHeadSize); - return; // Sand walking signal pulses have been stamped correctly to call the worm + int wormHeadSize = sandwormHead.size(); + if (!WORM_SIGN.contains(wormHeadSize)) { + lexer.smokeSignals.burnSandWormSignIncorrect(lexer.currLine, lexer.currCol, wormHeadSize); + return; } - lexer.sandwormHead.clear(); - lexer.smokeSignals.burnSandWormSignIncorrect(lexer.currLine, lexer.currCol, wormHeadSize); + // Sand walking signal pulses have been stamped correctly to call the worm + lexer.handler.strobeSandWalker(sandwormHead); } } @@ -359,12 +353,11 @@ public class FourCornerZionStenoLexer { @Override public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) { - lexer.sandwormSign = false; List wormBody15 = new ArrayList<>(); for (int i = idxFirst; i <= idxLast; i++) { wormBody15.add(lexer.input.get(i)); } - List wormBody = new ArrayList<>(); + List wormSpice = new ArrayList<>(); Iterator i15 = wormBody15.iterator(); while (i15.hasNext()) { int bitValue15 = i15.next(); @@ -388,13 +381,13 @@ public class FourCornerZionStenoLexer { octal0 += ((bitValue15 >> 2) & 0b1) << 2; octal0 += ((bitValue15 >> 1) & 0b1) << 1; octal0 += ((bitValue15 >> 0) & 0b1) << 0; - wormBody.add(octal4); - wormBody.add(octal3); - wormBody.add(octal2); - wormBody.add(octal1); - wormBody.add(octal0); + wormSpice.add(octal4); + wormSpice.add(octal3); + wormSpice.add(octal2); + wormSpice.add(octal1); + wormSpice.add(octal0); } - lexer.handler.strobeSandWorm(lexer.sandwormHead, wormBody); + lexer.handler.strobeSandWorm(wormSpice); } } @@ -471,7 +464,7 @@ public class FourCornerZionStenoLexer { lexer.smokeSignals.burnUNI21UnusedBigIndian(lexer.currLine, lexer.currCol); } if (!result.isEmpty()) { - lexer.handler.strobeUnicode(result); + lexer.handlerCodex.strobeWaterUnicode(result); } } } diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java index 7ee8805..cb6ea6d 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerFire.java @@ -38,8 +38,6 @@ public interface FourCornerZionStenoLexerFire { void fireStateNCR1632BankReset(boolean magic); - void fireStateSandWormSign(int size); - interface Adapter extends FourCornerZionStenoLexerFire { @Override @@ -61,9 +59,5 @@ public interface FourCornerZionStenoLexerFire { @Override default void fireStateNCR1632BankReset(boolean magic) { } - - @Override - default void fireStateSandWormSign(int size) { - } } } diff --git a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerSmoke.java b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerSmoke.java index abe5e95..54b8f27 100644 --- a/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerSmoke.java +++ b/nx01-x4o-fc18/src/main/java/org/x4o/fc18/zion7/FourCornerZionStenoLexerSmoke.java @@ -45,8 +45,6 @@ public interface FourCornerZionStenoLexerSmoke { void burnSandWormSignIncorrect(int line, int col, int size); - void burnSandWormSignUnused(int line, int col); - interface Adapter extends FourCornerZionStenoLexerSmoke { @@ -77,9 +75,5 @@ public interface FourCornerZionStenoLexerSmoke { @Override default void burnSandWormSignIncorrect(int line, int col, int size) { } - - @Override - default void burnSandWormSignUnused(int line, int col) { - } } }