Removed sand worm spice state from steno lexer

This commit is contained in:
Willem Cazander 2025-01-24 01:39:59 +01:00
parent f630b919f2
commit e04aa1440b
6 changed files with 65 additions and 62 deletions

View file

@ -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<Integer> codePoints) {
codePoints.forEach(v -> output.appendCodePoint(v));
}
@Override
public void strobeRecursiveCake(List<Integer> cakePoints) {
if (thisDisplayEscaked == null) {
@ -230,8 +226,11 @@ public class FourCornerUnicodeDisplay {
}
@Override
public void strobeSandWorm(List<Integer> head, List<Integer> body) {
// TODO Auto-generated method stub
public void strobeSandWalker(List<Integer> rhythm) {
}
@Override
public void strobeSandWorm(List<Integer> spice) {
}
@Override
@ -245,5 +244,14 @@ public class FourCornerUnicodeDisplay {
output.append(";");
}
}
@Override
public void strobeWaterUnicode(List<Integer> codePoints) {
codePoints.forEach(v -> output.appendCodePoint(v));
}
@Override
public void strobeWaterKanji(List<Integer> kuTenPoints) {
}
}
}

View file

@ -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<Integer> codePoints);
/// Allows a 6 bit computer to use the nether,fractions or unicode.
void strobeRecursiveCake(List<Integer> cakePoints);
/// Octal sand worm, with up to 576 bit mime-type data type header.
void strobeSandWorm(List<Integer> head, List<Integer> body);
/// Octal sand walker, with an 72 to 576 bit mime-type rhythm header.
void strobeSandWalker(List<Integer> rhythm);
/// Octal sand worm spice
void strobeSandWorm(List<Integer> spice);
interface Adapter extends FourCornerZion7Candlelier {
@ -65,16 +65,16 @@ public interface FourCornerZion7Candlelier {
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
}
@Override
default void strobeUnicode(List<Integer> codePoints) {
}
@Override
default void strobeRecursiveCake(List<Integer> cakePoints) {
}
@Override
default void strobeSandWorm(List<Integer> head, List<Integer> body) {
default void strobeSandWalker(List<Integer> rhythm) {
}
@Override
default void strobeSandWorm(List<Integer> spice) {
}
}
}

View file

@ -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<Integer> codePoints);
/// To support native rendering on the MSX
void strobeWaterKanji(List<Integer> kuTenPoints);
interface Adapter extends FourCornerZion7WaterCodex, FourCornerZion7Candlelier.Adapter {
@Override
default void strobeWaterUnicode(List<Integer> codePoints) {
}
@Override
default void strobeWaterKanji(List<Integer> kuTenPoints) {
}
}
}

View file

@ -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<StenoScanner> 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<Integer> sandwormHead = new ArrayList<>();
private boolean sandwormSign = false;
private int sandwormSignLine = 0;
private int sandwormSignColumn = 0;
private List<Integer> 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<Integer> 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
}
lexer.sandwormHead.clear();
int wormHeadSize = sandwormHead.size();
if (!WORM_SIGN.contains(wormHeadSize)) {
lexer.smokeSignals.burnSandWormSignIncorrect(lexer.currLine, lexer.currCol, wormHeadSize);
return;
}
// 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<Integer> wormBody15 = new ArrayList<>();
for (int i = idxFirst; i <= idxLast; i++) {
wormBody15.add(lexer.input.get(i));
}
List<Integer> wormBody = new ArrayList<>();
List<Integer> wormSpice = new ArrayList<>();
Iterator<Integer> 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);
}
}
}

View file

@ -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) {
}
}
}

View file

@ -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) {
}
}
}