FC18: Changed candlelier interface
This commit is contained in:
parent
6c0ee56272
commit
586b5f9fe3
8 changed files with 35 additions and 27 deletions
|
|
@ -30,9 +30,6 @@ import java.util.Objects;
|
||||||
import java.util.PrimitiveIterator;
|
import java.util.PrimitiveIterator;
|
||||||
|
|
||||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||||
import org.x4o.fc18.cake2.FourCornerX00PetitVide;
|
|
||||||
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
|
||||||
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
|
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash10;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash10;
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash11;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash11;
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20;
|
||||||
|
|
@ -98,11 +95,11 @@ final public class FourCornerRecipe {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public List<Integer> embedSandWalker(List<PrimordialOctal> rhythm) {
|
static public List<Integer> embedSandWalkerX06(List<PrimordialOctal> rhythm) {
|
||||||
return embedSandWalker(new ArrayList<>(), rhythm);
|
return embedSandWalkerX06(new ArrayList<>(), rhythm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public List<Integer> embedSandWalker(List<Integer> out, List<PrimordialOctal> rhythm) {
|
static public List<Integer> embedSandWalkerX06(List<Integer> out, List<PrimordialOctal> rhythm) {
|
||||||
Objects.requireNonNull(rhythm);
|
Objects.requireNonNull(rhythm);
|
||||||
if (!FourCornerRecipe.SAND_WORM_SIGN.contains(rhythm.size())) {
|
if (!FourCornerRecipe.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||||
throw new IllegalArgumentException("Sand walker rhythm is not 72 bit aligned: " + rhythm.size());
|
throw new IllegalArgumentException("Sand walker rhythm is not 72 bit aligned: " + rhythm.size());
|
||||||
|
|
@ -266,7 +263,7 @@ final public class FourCornerRecipe {
|
||||||
if (denominator.equals(BigInteger.ZERO)) {
|
if (denominator.equals(BigInteger.ZERO)) {
|
||||||
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
||||||
}
|
}
|
||||||
if (numerator.equals(BigInteger.ZERO)) {
|
if (numerator.equals(BigInteger.ZERO)) { // TODO: rm this and make both zero based, 0/1 = zero
|
||||||
throw new IllegalArgumentException("The numerator value ZERO is not allowed.");
|
throw new IllegalArgumentException("The numerator value ZERO is not allowed.");
|
||||||
}
|
}
|
||||||
//if (denominator.signum() == -1) {
|
//if (denominator.signum() == -1) {
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public class FourCornerUnicodeDisplay {
|
||||||
lexer.withSmokeSignals(printer).read(chars);
|
lexer.withSmokeSignals(printer).read(chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier.Adapter, FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
||||||
|
|
||||||
private final StringBuilder output;
|
private final StringBuilder output;
|
||||||
private boolean wasExternalWord = false;
|
private boolean wasExternalWord = false;
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,16 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
||||||
__ESC_RESERVED_A8,
|
__ESC_RESERVED_A8,
|
||||||
|
|
||||||
/// _ESC6_X1 _ESC6_X3 _ESC6_X3 = 9
|
/// _ESC6_X1 _ESC6_X3 _ESC6_X3 = 9
|
||||||
|
/// Content type prolog 8 doctype modes of document
|
||||||
|
/// * 6 bit pure mainframe mode
|
||||||
|
/// * 6 bit with vt06+candy
|
||||||
|
/// * 6 bit with vt06+candy+NCR+grams
|
||||||
|
/// * 6 bit with vt06+candy+NCR+grams+worms
|
||||||
|
/// * 18 bit only xdbx strict adult structure
|
||||||
|
/// * 18 bit only xdbx sweaty candy structure
|
||||||
|
/// * 18 bit simple adult mode (no xdbx, no worms)
|
||||||
|
/// * 18 bit full range (default, no limits on cake points used)
|
||||||
|
//ESC_PROLOG_DOCTYPE
|
||||||
__ESC_RESERVED_A9,
|
__ESC_RESERVED_A9,
|
||||||
|
|
||||||
// =========== Internal escape sequence, to embed symbols,fractions and adult texts.
|
// =========== Internal escape sequence, to embed symbols,fractions and adult texts.
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ package org.x4o.fc18.zion7;
|
||||||
///
|
///
|
||||||
/// @author Willem Cazander
|
/// @author Willem Cazander
|
||||||
/// @version 1.0 Jan 11, 2025
|
/// @version 1.0 Jan 11, 2025
|
||||||
public interface FourCornerZion7AlphaOmega extends FourCornerZion7Candlelier {
|
public interface FourCornerZion7AlphaOmega {
|
||||||
|
|
||||||
void strobeDocumentAlpha();
|
void strobeDocumentAlpha();
|
||||||
|
|
||||||
void strobeDocumentOmega();
|
void strobeDocumentOmega();
|
||||||
|
|
||||||
interface Adapter extends FourCornerZion7AlphaOmega, FourCornerZion7Candlelier.Adapter {
|
interface Adapter extends FourCornerZion7AlphaOmega {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeDocumentAlpha() {
|
default void strobeDocumentAlpha() {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.x4o.fc18.octal8.PrimordialOctal;
|
||||||
///
|
///
|
||||||
/// @author Willem Cazander
|
/// @author Willem Cazander
|
||||||
/// @version 1.0 Jan 09, 2025
|
/// @version 1.0 Jan 09, 2025
|
||||||
public interface FourCornerZion7Candlelier {
|
public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
|
||||||
|
|
||||||
/// Single word cake point.
|
/// Single word cake point.
|
||||||
void strobeWord(int cakePoint);
|
void strobeWord(int cakePoint);
|
||||||
|
|
@ -39,6 +39,10 @@ public interface FourCornerZion7Candlelier {
|
||||||
/// Block of word cake points.
|
/// Block of word cake points.
|
||||||
void strobeWords(List<Integer> cakePoints);
|
void strobeWords(List<Integer> cakePoints);
|
||||||
|
|
||||||
|
//void strobeWordGrams(int gramBase, List<Integer> values);
|
||||||
|
//void strobeWordDozimal(BigDecimal value);
|
||||||
|
//void strobeWordDozeger(BigInteger value); // up to 192 bit integer
|
||||||
|
|
||||||
/// 1152 bit fractions of two 576 bit numbers.
|
/// 1152 bit fractions of two 576 bit numbers.
|
||||||
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
||||||
|
|
||||||
|
|
@ -51,7 +55,7 @@ public interface FourCornerZion7Candlelier {
|
||||||
/// Handles the lexer salah sequence strobes
|
/// Handles the lexer salah sequence strobes
|
||||||
void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments);
|
void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments);
|
||||||
|
|
||||||
interface Adapter extends FourCornerZion7Candlelier {
|
interface Adapter extends FourCornerZion7Candlelier, FourCornerZion7AlphaOmega.Adapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeWord(int cakePoint) {
|
default void strobeWord(int cakePoint) {
|
||||||
|
|
|
||||||
|
|
@ -36,15 +36,15 @@ import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice;
|
||||||
/// @version 1.0 Jan 11, 2025
|
/// @version 1.0 Jan 11, 2025
|
||||||
public class FourCornerZionStenoGrapher {
|
public class FourCornerZionStenoGrapher {
|
||||||
|
|
||||||
static public FourCornerWriter writerX06(List<Integer> out) {
|
static public FourCornerZion7Candlelier writerX06(List<Integer> out) {
|
||||||
return new FourCornerWriter(out, true);
|
return new FourCornerWriter(out, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public FourCornerWriter writerX18(List<Integer> out) {
|
static public FourCornerZion7TempleScrolls writerX18(List<Integer> out) {
|
||||||
return new FourCornerWriter(out, false);
|
return new FourCornerWriter(out, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public final class FourCornerWriter implements FourCornerZion7AlphaOmega,FourCornerZion7TempleScrolls {
|
static public final class FourCornerWriter implements FourCornerZion7Candlelier,FourCornerZion7TempleScrolls {
|
||||||
|
|
||||||
private final List<Integer> out;
|
private final List<Integer> out;
|
||||||
private final boolean isSixBit;
|
private final boolean isSixBit;
|
||||||
|
|
@ -92,7 +92,11 @@ public class FourCornerZionStenoGrapher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||||
FourCornerRecipe.embedSandWalker(out, rhythm);
|
//if (isSixBit) {
|
||||||
|
FourCornerRecipe.embedSandWalkerX06(out, rhythm);
|
||||||
|
//} else {
|
||||||
|
// FourCornerRecipe.embedSandWalkerX18(out, rhythm); // mmm bring back...
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,11 @@ import org.x4o.fc18.octal8.PrimordialOctal;
|
||||||
/// @version 1.0 Jan 09, 2025
|
/// @version 1.0 Jan 09, 2025
|
||||||
public class FourCornerZionStenoLexer {
|
public class FourCornerZionStenoLexer {
|
||||||
|
|
||||||
private final static FourCornerZion7AlphaOmega CLEAN_BIBLE = new FourCornerZion7AlphaOmega.Adapter() {};
|
|
||||||
private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.Adapter() {};
|
private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.Adapter() {};
|
||||||
private final static FourCornerZionStenoLexerSmoke CLEAN_SMOKE = new FourCornerZionStenoLexerSmoke.Adapter() {};
|
private final static FourCornerZionStenoLexerSmoke CLEAN_SMOKE = new FourCornerZionStenoLexerSmoke.Adapter() {};
|
||||||
private final static List<StenoScanner> CAKE_SLICE_EATERS = new ArrayList<>();
|
private final static List<StenoScanner> CAKE_SLICE_EATERS = new ArrayList<>();
|
||||||
private final boolean handlerEscape;
|
private final boolean handlerEscape;
|
||||||
private final FourCornerZion7Candlelier handler;
|
private final FourCornerZion7Candlelier handler;
|
||||||
private final FourCornerZion7AlphaOmega handlerDocument;
|
|
||||||
private final FourCornerZion7TempleScrolls handlerTempleScrolls;
|
private final FourCornerZion7TempleScrolls handlerTempleScrolls;
|
||||||
private final int denominatorBank[] = new int[64]; // <== is the terminator select are 6 bit of banks with 9 bit of values.
|
private final int denominatorBank[] = new int[64]; // <== is the terminator select are 6 bit of banks with 9 bit of values.
|
||||||
private final int numeratorBank[] = new int[denominatorBank.length];
|
private final int numeratorBank[] = new int[denominatorBank.length];
|
||||||
|
|
@ -110,11 +108,6 @@ public class FourCornerZionStenoLexer {
|
||||||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) {
|
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) {
|
||||||
this.handler = Objects.requireNonNull(handler);
|
this.handler = Objects.requireNonNull(handler);
|
||||||
this.handlerEscape = handlerEscape;
|
this.handlerEscape = handlerEscape;
|
||||||
if (handler instanceof FourCornerZion7AlphaOmega) {
|
|
||||||
this.handlerDocument = FourCornerZion7AlphaOmega.class.cast(handler);
|
|
||||||
} else {
|
|
||||||
this.handlerDocument = CLEAN_BIBLE;
|
|
||||||
}
|
|
||||||
if (handler instanceof FourCornerZion7TempleScrolls) {
|
if (handler instanceof FourCornerZion7TempleScrolls) {
|
||||||
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -151,7 +144,7 @@ public class FourCornerZionStenoLexer {
|
||||||
currLine = 0;
|
currLine = 0;
|
||||||
currCol = 0; // allow reuse of lexer
|
currCol = 0; // allow reuse of lexer
|
||||||
decModeReset();
|
decModeReset();
|
||||||
handlerDocument.strobeDocumentAlpha();
|
handler.strobeDocumentAlpha();
|
||||||
do {
|
do {
|
||||||
ScanResult run = readTokens();
|
ScanResult run = readTokens();
|
||||||
if (run.isEOF()) {
|
if (run.isEOF()) {
|
||||||
|
|
@ -161,7 +154,7 @@ public class FourCornerZionStenoLexer {
|
||||||
smokeSignals.burnLexerReservedCakePoint(currLine, currCol, input.get(inputIndex));
|
smokeSignals.burnLexerReservedCakePoint(currLine, currCol, input.get(inputIndex));
|
||||||
}
|
}
|
||||||
} while (safeNext());
|
} while (safeNext());
|
||||||
handlerDocument.strobeDocumentOmega();
|
handler.strobeDocumentOmega();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScanResult readTokens() {
|
private ScanResult readTokens() {
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,13 @@ public class FourCornerRecipeTest {
|
||||||
public void testSandWalker() throws Exception {
|
public void testSandWalker() throws Exception {
|
||||||
List<Integer> cdc = new ArrayList<>();
|
List<Integer> cdc = new ArrayList<>();
|
||||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||||
FourCornerRecipe.embedSandWalker(cdc, List.of(PrimordialOctal.PART_1));
|
FourCornerRecipe.embedSandWalkerX06(cdc, List.of(PrimordialOctal.PART_1));
|
||||||
});
|
});
|
||||||
List<PrimordialOctal> octalMine = new ArrayList<>();
|
List<PrimordialOctal> octalMine = new ArrayList<>();
|
||||||
for (int i=0;i<24;i++) {
|
for (int i=0;i<24;i++) {
|
||||||
octalMine.add(PrimordialOctal.PART_1);
|
octalMine.add(PrimordialOctal.PART_1);
|
||||||
}
|
}
|
||||||
FourCornerRecipe.embedSandWalker(cdc, octalMine);
|
FourCornerRecipe.embedSandWalkerX06(cdc, octalMine);
|
||||||
String res = FourCornerUnicodeDisplay.text().renderFromInt18(cdc);
|
String res = FourCornerUnicodeDisplay.text().renderFromInt18(cdc);
|
||||||
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
|
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue