FC18: Raw version of FC6 numbers and fixed escapes and made lexer faster
This commit is contained in:
parent
a8d80e07b9
commit
4d26ade723
21 changed files with 566 additions and 186 deletions
|
|
@ -47,6 +47,7 @@ import org.x4o.fc18.zion7.flame4.FCFlameFremanLegoBase8;
|
|||
import org.x4o.fc18.zion7.flame4.FCFlameFremanSignedBase2;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberTaste;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameSalahSequence;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameWordDish;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberGram;
|
||||
|
||||
/// Renders unicode from four corner 18 bit text.
|
||||
|
|
@ -168,7 +169,7 @@ public class FourCornerUnicodeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeTheWord(int cakePoint) {
|
||||
public void strobeTheWord(FCFlameWordDish course, int cakePoint) {
|
||||
|
||||
// TODO: remove slice here;
|
||||
Optional<FourCornerDotCake> sliceOpt = FourCornerDotCake.valueFromCakePoint(cakePoint);
|
||||
|
|
@ -227,9 +228,9 @@ public class FourCornerUnicodeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeTheWords(List<Integer> cakePoints) {
|
||||
public void strobeTheWords(FCFlameWordDish course, List<Integer> cakePoints) {
|
||||
for (int i = 0; i < cakePoints.size(); i++) {
|
||||
strobeTheWord(cakePoints.get(i));
|
||||
strobeTheWord(course, cakePoints.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +276,7 @@ public class FourCornerUnicodeDisplay {
|
|||
if (taste.statusCarryOke()) {
|
||||
numberCandy.add(FCDotCDC1604DashP6.NY20_PLUS.ordinal()); // TODO: use name word symbols
|
||||
}
|
||||
if (taste.numberValidInfinity()) {
|
||||
if (taste.numberValidInfinity4D()) {
|
||||
numberCandy.add(FCDotCDC1604DashP6.NX09_I.ordinal()); // TODO: use name word symbols
|
||||
numberCandy.add(FCDotCDC1604DashP6.NX14_N.ordinal());
|
||||
numberCandy.add(FCDotCDC1604DashP6.NX06_F.ordinal());
|
||||
|
|
|
|||
|
|
@ -278,39 +278,48 @@ public enum FourCornerDotCake {
|
|||
FC_EXTRA_1011(1 + FC_EXTRA_1010.getStop(), 10000, "Four Corner Words 110000-119999"),
|
||||
FC_EXTRA_1100(1 + FC_EXTRA_1011.getStop(), 131072-120000-4096, "Four Corner Words 120000-129999"),
|
||||
|
||||
// TODO: enlarge FC_WORD to 17 bit and make it 16*8192 or 32*4096
|
||||
//FC_WORDS_1010(1 + FC_WORDS_1001.getStop(), 10000, "Four Corner Words 100000-109999"),
|
||||
//FC_WORDS_1011(1 + FC_WORDS_1010.getStop(), 10000, "Four Corner Words 110000-119999"),
|
||||
//FC_WORDS_1100(1 + FC_WORDS_1011.getStop(), 10000, "Four Corner Words 120000-129999"),
|
||||
//FC_WORDS_1101(1 + FC_WORDS_1100.getStop(), 1072, "Four Corner Words 130000-131072"), // 2^17 of words
|
||||
//FC_CLK1K_A(135168 + ...
|
||||
|
||||
// =========== Allow digital language constructs to be constants
|
||||
|
||||
/// Code Language Keywords for VHDL/C++ and Java/etc which allows a user to load a custom word dictionary.
|
||||
/// TODO: Add a few more sources and do a few dedup alias rename sessions AND abbr... unpacking + aliasses
|
||||
FC_CLK1K_A(131072 + (1024*0), 1024, FCDotCLK1KDashA.values()), // start at "2^17+2^16"
|
||||
FC_CLK1K_B(131072 + (1024*1), 1024, FCDotCLK1KDashB.values()),
|
||||
FC_CLK1K_C(131072 + (1024*2), 1024, FCDotCLK1KDashC.values()),
|
||||
FC_CLK1K_D(131072 + (1024*3), 1024, FCDotCLK1KDashD.values()),
|
||||
FC_CLK1K_E(131072 + (1024*4), 1024, FCDotCLK1KDashE.values()),
|
||||
FC_CLK1K_F(131072 + (1024*5), 1024, FCDotCLK1KDashF.values()),
|
||||
FC_CLK1K_G(131072 + (1024*6), 1024, FCDotCLK1KDashG.values()),
|
||||
FC_CLK1K_H(131072 + (1024*7), 1024, FCDotCLK1KDashH.values()),
|
||||
FC_CLK1K_I(131072 + (1024*8), 1024, FCDotCLK1KDashI.values()),
|
||||
FC_CLK1K_J(131072 + (1024*9), 1024, FCDotCLK1KDashJ.values()),
|
||||
FC_CLK1K_K(131072 + (1024*10), 1024, FCDotCLK1KDashK.values()),
|
||||
FC_CLK1K_L(131072 + (1024*11), 1024, FCDotCLK1KDashL.values()),
|
||||
FC_CLK1K_M(131072 + (1024*12), 1024, FCDotCLK1KDashM.values()),
|
||||
FC_CLK1K_N(131072 + (1024*13), 1024, FCDotCLK1KDashN.values()),
|
||||
FC_CLK1K_O(131072 + (1024*14), 1024, FCDotCLK1KDashO.values()),
|
||||
FC_CLK1K_P(131072 + (1024*15), 1024, FCDotCLK1KDashP.values()),
|
||||
FC_CLK1K_Q(131072 + (1024*16), 1024, FCDotCLK1KDashQ.values()),
|
||||
FC_CLK1K_R(131072 + (1024*17), 1024, FCDotCLK1KDashR.values()),
|
||||
FC_CLK1K_S(131072 + (1024*18), 1024, FCDotCLK1KDashS.values()),
|
||||
FC_CLK1K_T(131072 + (1024*19), 1024, FCDotCLK1KDashT.values()),
|
||||
FC_CLK1K_U(131072 + (1024*20), 1024, FCDotCLK1KDashU.values()),
|
||||
FC_CLK1K_V(131072 + (1024*21), 1024, FCDotCLK1KDashV.values()),
|
||||
FC_CLK1K_W(131072 + (1024*22), 1024, FCDotCLK1KDashW.values()),
|
||||
FC_CLK1K_X(131072 + (1024*23), 1024, FCDotCLK1KDashX.values()),
|
||||
FC_CLK1K_Y(131072 + (1024*24), 1024, FCDotCLK1KDashY.values()),
|
||||
FC_CLK1K_Z(131072 + (1024*25), 1024, FCDotCLK1KDashZ.values()),
|
||||
FC_CLK1K_A(131072 + (1024*0), 1024, FCDotCLK1KDashA.values(), "Code Language Keywords with letter A"),
|
||||
FC_CLK1K_B(131072 + (1024*1), 1024, FCDotCLK1KDashB.values(), "Code Language Keywords with letter B"),
|
||||
FC_CLK1K_C(131072 + (1024*2), 1024, FCDotCLK1KDashC.values(), "Code Language Keywords with letter C"),
|
||||
FC_CLK1K_D(131072 + (1024*3), 1024, FCDotCLK1KDashD.values(), "Code Language Keywords with letter D"),
|
||||
FC_CLK1K_E(131072 + (1024*4), 1024, FCDotCLK1KDashE.values(), "Code Language Keywords with letter E"),
|
||||
FC_CLK1K_F(131072 + (1024*5), 1024, FCDotCLK1KDashF.values(), "Code Language Keywords with letter F"),
|
||||
FC_CLK1K_G(131072 + (1024*6), 1024, FCDotCLK1KDashG.values(), "Code Language Keywords with letter G"),
|
||||
FC_CLK1K_H(131072 + (1024*7), 1024, FCDotCLK1KDashH.values(), "Code Language Keywords with letter H"),
|
||||
FC_CLK1K_I(131072 + (1024*8), 1024, FCDotCLK1KDashI.values(), "Code Language Keywords with letter I"),
|
||||
FC_CLK1K_J(131072 + (1024*9), 1024, FCDotCLK1KDashJ.values(), "Code Language Keywords with letter J"),
|
||||
FC_CLK1K_K(131072 + (1024*10), 1024, FCDotCLK1KDashK.values(), "Code Language Keywords with letter K"),
|
||||
FC_CLK1K_L(131072 + (1024*11), 1024, FCDotCLK1KDashL.values(), "Code Language Keywords with letter L"),
|
||||
FC_CLK1K_M(131072 + (1024*12), 1024, FCDotCLK1KDashM.values(), "Code Language Keywords with letter M"),
|
||||
FC_CLK1K_N(131072 + (1024*13), 1024, FCDotCLK1KDashN.values(), "Code Language Keywords with letter N"),
|
||||
FC_CLK1K_O(131072 + (1024*14), 1024, FCDotCLK1KDashO.values(), "Code Language Keywords with letter O"),
|
||||
FC_CLK1K_P(131072 + (1024*15), 1024, FCDotCLK1KDashP.values(), "Code Language Keywords with letter P"),
|
||||
FC_CLK1K_Q(131072 + (1024*16), 1024, FCDotCLK1KDashQ.values(), "Code Language Keywords with letter Q"),
|
||||
FC_CLK1K_R(131072 + (1024*17), 1024, FCDotCLK1KDashR.values(), "Code Language Keywords with letter R"),
|
||||
FC_CLK1K_S(131072 + (1024*18), 1024, FCDotCLK1KDashS.values(), "Code Language Keywords with letter S"),
|
||||
FC_CLK1K_T(131072 + (1024*19), 1024, FCDotCLK1KDashT.values(), "Code Language Keywords with letter T"),
|
||||
FC_CLK1K_U(131072 + (1024*20), 1024, FCDotCLK1KDashU.values(), "Code Language Keywords with letter U"),
|
||||
FC_CLK1K_V(131072 + (1024*21), 1024, FCDotCLK1KDashV.values(), "Code Language Keywords with letter V"),
|
||||
FC_CLK1K_W(131072 + (1024*22), 1024, FCDotCLK1KDashW.values(), "Code Language Keywords with letter W"),
|
||||
FC_CLK1K_X(131072 + (1024*23), 1024, FCDotCLK1KDashX.values(), "Code Language Keywords with letter X"),
|
||||
FC_CLK1K_Y(131072 + (1024*24), 1024, FCDotCLK1KDashY.values(), "Code Language Keywords with letter Y"),
|
||||
FC_CLK1K_Z(131072 + (1024*25), 1024, FCDotCLK1KDashZ.values(), "Code Language Keywords with letter Z"),
|
||||
|
||||
// =========== Define digital document structures
|
||||
|
||||
//FC_CLK1K_USSR
|
||||
|
||||
//FC_TXTBLK_64 <== LAST cake slice to have "external" defined words for display
|
||||
// - FC_F4TXT0001_SP // <= FC18, FC6 => esc seq (note in 6 bit display char-ROM first few chars are none candy letters)
|
||||
// - commentTXT start + stop + comment to end of line ?
|
||||
|
|
|
|||
|
|
@ -138,10 +138,6 @@ public enum FCDotCDC1604DashP6 implements FourCornerDotColleZero33 {
|
|||
return ordinal();
|
||||
}
|
||||
|
||||
public int muffinPointDotIndex() {
|
||||
return baklavaPointDotIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> baklavaPointSequence() {
|
||||
return baklavaSequence;
|
||||
|
|
@ -149,7 +145,7 @@ public enum FCDotCDC1604DashP6 implements FourCornerDotColleZero33 {
|
|||
|
||||
@Override
|
||||
public int cakePointDotIndex() {
|
||||
return muffinPointDotIndex();
|
||||
return baklavaPointDotIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -157,6 +153,14 @@ public enum FCDotCDC1604DashP6 implements FourCornerDotColleZero33 {
|
|||
return codePoint;
|
||||
}
|
||||
|
||||
public boolean isNothingX() {
|
||||
return ordinal() >= NX01_A.ordinal() && ordinal() <= NX27_AMP.ordinal();
|
||||
}
|
||||
|
||||
public boolean isNothingY() {
|
||||
return ordinal() <= NY01_AT.ordinal() && ordinal() >= NY27_SQUARE_LEFT.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FourCornerX00PetitVideCoinCarneFrapper coinCarneFrapper() {
|
||||
// TODO: Add kerning for symbols too
|
||||
|
|
|
|||
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* 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.fc18.cake2.zero33;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
|
||||
///
|
||||
/// A dice saw to cut the CDC1604 in multiple octal parts.
|
||||
///
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Sep 6, 2025
|
||||
///
|
||||
public enum FCDotCDC1604DiceSaw {
|
||||
FACE_1NX(0, FCDotCDC1604DashP6.NX01_A),
|
||||
FACE_2NX(3, FCDotCDC1604DashP6.NX09_I),
|
||||
FACE_3NX(6, FCDotCDC1604DashP6.NX17_Q),
|
||||
FACE_4NY(0, FCDotCDC1604DashP6.NY01_AT),
|
||||
FACE_5NY(3, FCDotCDC1604DashP6.NY09_EQUALS),
|
||||
FACE_6NY(6, FCDotCDC1604DashP6.NY17_COMMA),
|
||||
;
|
||||
|
||||
static final private FCDotCDC1604DiceSaw[] VALUES = values();
|
||||
|
||||
private final int shiftValue;
|
||||
private final FCDotCDC1604DashP6 offset;
|
||||
|
||||
private FCDotCDC1604DiceSaw(int shiftValue, FCDotCDC1604DashP6 offset) {
|
||||
this.shiftValue = shiftValue;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public boolean sideNothingX() {
|
||||
return ordinal() <= FACE_3NX.ordinal();
|
||||
}
|
||||
|
||||
public boolean sideNothingY() {
|
||||
return ordinal() >= FACE_4NY.ordinal();
|
||||
}
|
||||
|
||||
public FCDotCDC1604DashP6 encodeOctal(PrimordialOctal octal) {
|
||||
return encodeOctal(octal.ordinal());
|
||||
}
|
||||
|
||||
public FCDotCDC1604DashP6 encodeOctal(int value) {
|
||||
int octalIdx = (value >> shiftValue) & 0b111;
|
||||
if (octalIdx < 0) {
|
||||
throw new IllegalArgumentException("Octal value is out of range");
|
||||
}
|
||||
if (octalIdx > 7) {
|
||||
throw new IllegalArgumentException("Octal value is out of range");
|
||||
}
|
||||
if (offset.isNothingX()) {
|
||||
return FCDotCDC1604DashP6.valueOf(offset.ordinal() + octalIdx);
|
||||
} else {
|
||||
return FCDotCDC1604DashP6.valueOf(offset.ordinal() - octalIdx);
|
||||
}
|
||||
}
|
||||
|
||||
public int decodeOctal(int value, int cakePoint) {
|
||||
if (offset.isNothingX()) {
|
||||
return value + ((cakePoint - offset.ordinal()) << shiftValue);
|
||||
} else {
|
||||
return value + ((offset.ordinal() - cakePoint) << shiftValue);
|
||||
}
|
||||
}
|
||||
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotCDC1604DiceSaw valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
|
||||
static public Optional<FCDotCDC1604DiceSaw> valueOfCakePoint(int cakePoint) {
|
||||
final int valuesLength = valuesLength();
|
||||
for (int i = 0; i < valuesLength; i++) {
|
||||
FCDotCDC1604DiceSaw dice = valueOf(i);
|
||||
if (dice.sideNothingX() && cakePoint >= dice.offset.ordinal() && cakePoint < dice.offset.ordinal() + 8) {
|
||||
return Optional.of(dice);
|
||||
}
|
||||
if (dice.sideNothingY() && cakePoint > dice.offset.ordinal() - 8 && cakePoint <= dice.offset.ordinal()) {
|
||||
return Optional.of(dice);
|
||||
}
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
|
@ -81,16 +81,16 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
|||
// =========== Embed escape sequence
|
||||
|
||||
/// _ESC6_X2 _ESC6_X1 _ESC6_X1 = 10
|
||||
ESC6_NUMBER_BASE2_LEGO,
|
||||
ESC6_BASE2_LEGO,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X1 _ESC6_X2 = 11
|
||||
ESC6_NUMBER_BASE2_SIGNED,
|
||||
ESC6_BASE2_SIGNED,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X1 _ESC6_X3 = 12
|
||||
ESC6_NUMBER_BASE8_LEGO,
|
||||
ESC6_BASE8_LEGO,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X2 _ESC6_X1 = 13
|
||||
ESC6_NUMBER_BASE8_CHOCO,
|
||||
ESC6_BASE8_CHOCO,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X2 _ESC6_X2 = 14
|
||||
/// Select packed pie 9C terminator symbol on 6 and 8 bit systems.
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.x4o.fc18.zion7.flame4.FCFlameFremanLegoBase8;
|
|||
import org.x4o.fc18.zion7.flame4.FCFlameFremanSignedBase2;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberTaste;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameSalahSequence;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameWordDish;
|
||||
|
||||
/// Handles the main four corner cake strobes.
|
||||
///
|
||||
|
|
@ -40,10 +41,10 @@ import org.x4o.fc18.zion7.flame4.FCFlameSalahSequence;
|
|||
public interface FourCornerZion7Bereshit extends FourCornerZion7AlphaOmega {
|
||||
|
||||
/// Single word cake point.
|
||||
void strobeTheWord(int cakePoint);
|
||||
void strobeTheWord(FCFlameWordDish course, int cakePoint);
|
||||
|
||||
/// Block of word cake points.
|
||||
void strobeTheWords(List<Integer> cakePoints);
|
||||
void strobeTheWords(FCFlameWordDish course, List<Integer> cakePoints);
|
||||
|
||||
//void strobeStructSpacePastor();
|
||||
//void strobeStructNunLine();
|
||||
|
|
@ -69,11 +70,11 @@ public interface FourCornerZion7Bereshit extends FourCornerZion7AlphaOmega {
|
|||
interface Adapter extends FourCornerZion7Bereshit, FourCornerZion7AlphaOmega.Adapter {
|
||||
|
||||
@Override
|
||||
default void strobeTheWord(int cakePoint) {
|
||||
default void strobeTheWord(FCFlameWordDish course, int cakePoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeTheWords(List<Integer> cakePoints) {
|
||||
default void strobeTheWords(FCFlameWordDish course, List<Integer> cakePoints) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import java.util.function.IntConsumer;
|
|||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.FourCornerX00PetitVide;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DiceSaw;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
||||
|
|
@ -47,6 +48,7 @@ import org.x4o.fc18.zion7.flame4.FCFlameFremanSuit;
|
|||
import org.x4o.fc18.zion7.flame4.FCFlameNumberTaste;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameSalahSequence;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameStenoTongue;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameWordDish;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberGram;
|
||||
|
||||
/// Write steno for zion.
|
||||
|
|
@ -167,19 +169,28 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
}
|
||||
|
||||
private void outAddFremanCake8(FCFlameFremanSuit suit, int bankStart, BigInteger value, Function<Integer, Integer> overrideMsb) {
|
||||
private void outAddBankCakeFC6(int bankBits, BigInteger bankMask,FCFlameFremanSuit suit, int bankStart, BigInteger value, Function<Integer, Integer> overrideMsb) {
|
||||
outAddAll(suit.escapeSequenceFC6().baklavaPointSequence());
|
||||
outAddAll(FCDotCDC1604DashP6.salt3SequenceWrite(new ArrayList<>(), suit.ordinal()));
|
||||
outAddBankCake(bankBits, bankMask, suit.cakeOffsetSel0(), suit.cakeOffsetBank(), bankStart, value, v -> {
|
||||
if (v < suit.cakeOffsetBank()) {
|
||||
int sel0 = v - suit.cakeOffsetSel0();
|
||||
outAdd(FCDotCDC1604DiceSaw.FACE_6NY.encodeOctal(sel0).baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DiceSaw.FACE_5NY.encodeOctal(sel0).baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DiceSaw.FACE_4NY.encodeOctal(sel0).baklavaPointDotIndex());
|
||||
} else {
|
||||
int bank = v - suit.cakeOffsetBank();
|
||||
outAdd(FCDotCDC1604DiceSaw.FACE_3NX.encodeOctal(bank).baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DiceSaw.FACE_2NX.encodeOctal(bank).baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DiceSaw.FACE_1NX.encodeOctal(bank).baklavaPointDotIndex());
|
||||
}
|
||||
}, overrideMsb);
|
||||
outAdd(FCDotCDC1604DashP6.NS04_RAKA1_INTERROBANG.baklavaPointDotIndex());
|
||||
}
|
||||
|
||||
private void outAddFremanCake8(FCFlameFremanSuit suit, int bankStart, BigInteger value, Function<Integer, Integer> overrideMsb) {
|
||||
if (outTongue.isSixBit()) {
|
||||
outAdd(FCDotDEC2701DashPX0.ESC6_NUMBER_BASE2_LEGO.cakePointDotIndex()); /// todo: move as arg...
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + suit.ordinal());
|
||||
// TODO: add octal split for 9 bit and write to out
|
||||
outAddBankCake(NCR_BANK8_BITS, BIG_BITS_8, suit.cakeOffsetSel0(), suit.cakeOffsetBank(), bankStart, value, v -> {
|
||||
if (v < suit.cakeOffsetBank()) {
|
||||
int sel0 = v - suit.cakeOffsetSel0();
|
||||
} else {
|
||||
int bank = v - suit.cakeOffsetBank();
|
||||
}
|
||||
}, overrideMsb);
|
||||
outAdd(FCDotCDC1604DashP6.NS04_RAKA1_INTERROBANG.cakePointDotIndex());
|
||||
outAddBankCakeFC6(NCR_BANK8_BITS, BIG_BITS_8, suit, bankStart, value, overrideMsb);
|
||||
} else {
|
||||
outAddBankCake(NCR_BANK8_BITS, BIG_BITS_8, suit.cakeOffsetSel0(), suit.cakeOffsetBank(), bankStart, value, out, overrideMsb);
|
||||
}
|
||||
|
|
@ -187,8 +198,11 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
|
||||
private void outAddFremanCake9(FCFlameFremanSuit suit, int bankStart, BigInteger value, Function<Integer, Integer> overrideMsb) {
|
||||
//TODO if (isSixBit) {
|
||||
outAddBankCake(NCR_BANK9_BITS, BIG_BITS_9, suit.cakeOffsetSel0(), suit.cakeOffsetBank(), bankStart, value, out, overrideMsb);
|
||||
if (outTongue.isSixBit()) {
|
||||
outAddBankCakeFC6(NCR_BANK9_BITS, BIG_BITS_9, suit, bankStart, value, overrideMsb);
|
||||
} else {
|
||||
outAddBankCake(NCR_BANK9_BITS, BIG_BITS_9, suit.cakeOffsetSel0(), suit.cakeOffsetBank(), bankStart, value, out, overrideMsb);
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
||||
|
|
@ -236,13 +250,14 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeTheWord(int cakePoint) {
|
||||
public void strobeTheWord(FCFlameWordDish course, int cakePoint) {
|
||||
if (cakePoint < outTongue.cakePointMin()) {
|
||||
throw new IllegalArgumentException("Cake point is smaller than limit: 0x" + Integer.toHexString(cakePoint));
|
||||
}
|
||||
if (cakePoint > outTongue.cakePointMax()) {
|
||||
throw new IllegalArgumentException("Cake point is greater than limit: 0x" + Integer.toHexString(cakePoint));
|
||||
}
|
||||
// TODO: validate with course
|
||||
if (FCFlameStenoTongue.FC6_PLUS.equals(outTongue) && cakePoint > CAKE_POINT_MAX_FC6) {
|
||||
// fixme improve this
|
||||
FourCornerDotCake slice = FourCornerDotCake.valueFromCakePoint(cakePoint).get();
|
||||
|
|
@ -256,11 +271,11 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeTheWords(List<Integer> cakePoints) {
|
||||
public void strobeTheWords(FCFlameWordDish course, List<Integer> cakePoints) {
|
||||
Objects.requireNonNull(cakePoints);
|
||||
int cakeSize = cakePoints.size();
|
||||
for (int i = NCR_ZERO; i < cakeSize; i++) {
|
||||
strobeTheWord(cakePoints.get(i));
|
||||
strobeTheWord(course, cakePoints.get(i));
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,14 @@ import java.util.Arrays;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCakeTower;
|
||||
import org.x4o.fc18.cake2.flag4.FCDotF4TTY0001DashNL;
|
||||
import org.x4o.fc18.cake2.flag4.FCDotF4TXT0001DashSP;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DiceSaw;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotCMD5401Dash2D;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotINC0801DashP8;
|
||||
|
|
@ -45,6 +47,7 @@ import org.x4o.fc18.zion7.flame4.FCFlameFremanLegoBase8;
|
|||
import org.x4o.fc18.zion7.flame4.FCFlameFremanSignedBase2;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberTaste;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameSalahSequence;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameWordDish;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberGram;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberSparklerSmoke;
|
||||
|
||||
|
|
@ -56,7 +59,11 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
|
||||
private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.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_EATERS = new ArrayList<>();
|
||||
private static int CAKE_EATER_BASE2_LEGO_IDX = -1;
|
||||
private static int CAKE_EATER_BASE2_SIGNED_IDX = -1;
|
||||
private static int CAKE_EATER_BASE8_LEGO_IDX = -1;
|
||||
private static int CAKE_EATER_BASE8_CHOCO_IDX = -1;
|
||||
private final boolean handlerEscape;
|
||||
private final FourCornerZion7Candlelier handler;
|
||||
private final FourCornerZion7TempleScrolls handlerTempleScrolls;
|
||||
|
|
@ -71,101 +78,75 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
private FCDotINC0801DashP8 cdcDECModeInc = null;
|
||||
private int cdcDECModePie = 0;
|
||||
private Boolean cdcDECModePieAlt = null;
|
||||
private int cdcFremanGroupIndex = -1;
|
||||
private int cdcFremanSel0 = 0;
|
||||
private int cdcFremanBank = 0;
|
||||
private FourCornerZionStenoLexerSmoke smokeSignals = CLEAN_SMOKE;
|
||||
private FourCornerZionStenoLexerFire fireSignals = CLEAN_FIRE;
|
||||
|
||||
static {
|
||||
CAKE_EATERS.add(new StenoScannerCDC()); // does APPETIZER + escaped others
|
||||
CAKE_EATERS.add(new StenoScannerWordCakeSlice(FCFlameWordDish.CANDY_BAR));
|
||||
CAKE_EATERS.add(new StenoScannerWordCakeSlice(FCFlameWordDish.CANDY_PIE));
|
||||
for (FourCornerDotCake cakeSlice : FourCornerDotCake.values()) {
|
||||
if (FourCornerDotCakeTower.TXT_GRAMS.equals(cakeSlice.tower())) {
|
||||
CAKE_EATERS.add(new StenoScannerNumberGramSlice(cakeSlice));
|
||||
}
|
||||
}
|
||||
CAKE_EATERS.add(new StenoScannerWordCakeSlice(FCFlameWordDish.KANJI_MEAT));
|
||||
CAKE_EATERS.add(new StenoScannerWordCakeSlice(FCFlameWordDish.CLOCK_SAUCE));
|
||||
CAKE_EATERS.add(new StenoScannerSandWorm());
|
||||
// fixme: convert to 4 freman loops
|
||||
Iterator<FCFlameFremanLegoBase2> fremanBase2LegoItr = Arrays.asList(FCFlameFremanLegoBase2.values()).iterator();
|
||||
Iterator<FCFlameFremanSignedBase2> fremanBase2IntItr = Arrays.asList(FCFlameFremanSignedBase2.values()).iterator();
|
||||
Iterator<FCFlameFremanLegoBase8> fremanBase8LegoItr = Arrays.asList(FCFlameFremanLegoBase8.values()).iterator();
|
||||
Iterator<FCFlameFremanChocoBase8> fremanBase8IntItr = Arrays.asList(FCFlameFremanChocoBase8.values()).iterator();
|
||||
// fixme: inverse loop to multiple small sets
|
||||
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)) {
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerCDCDEC(cakeSlice));
|
||||
continue; // handle CDC manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_DEC2701_PX0.equals(cakeSlice)) {
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerCDCDEC(cakeSlice));
|
||||
continue; // handle DEC manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_XDBX0512_NS.equals(cakeSlice)) {
|
||||
continue; // parse nether head manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_XDBX2048_ATTR.equals(cakeSlice)) {
|
||||
continue; // parse nether head manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_XDBX2048_TAG.equals(cakeSlice)) {
|
||||
continue; // parse nether head manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_SANDWALK_12.equals(cakeSlice)) {
|
||||
continue; // parse nether head manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_SANDWORM_15.equals(cakeSlice)) {
|
||||
continue; // parse nether body manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_RATIONAL2304_SEL0.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_RATIONAL2304_BANK.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_DECIMAL2304_SEL0.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_DECIMAL2304_BANK.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_FLOAT2304_SEL0.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_FLOAT2304_BANK.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_CHOPED2304_SEL0.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_CHOPED2304_BANK.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
if (!FourCornerDotCakeTower.TXT_NCR.equals(cakeSlice.tower())) {
|
||||
continue;
|
||||
}
|
||||
if (cakeSlice.name().endsWith("_SEL0") && cakeSlice.name().startsWith("FC_BA")) {
|
||||
continue; // done by bank slices below
|
||||
}
|
||||
if (cakeSlice.name().startsWith("FC_BA2L") && cakeSlice.name().endsWith("_BANK")) {
|
||||
if (CAKE_EATER_BASE2_LEGO_IDX == -1) {
|
||||
CAKE_EATER_BASE2_LEGO_IDX = CAKE_EATERS.size();
|
||||
}
|
||||
FourCornerDotCake cakeSliceSel = FourCornerDotCake.valueOf(cakeSlice.ordinal() - 1);
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberBase2Lego(cakeSliceSel, cakeSlice, fremanBase2LegoItr.next()));
|
||||
CAKE_EATERS.add(new StenoScannerNumberBase2Lego(cakeSliceSel, cakeSlice, fremanBase2LegoItr.next()));
|
||||
continue;
|
||||
}
|
||||
if (cakeSlice.name().startsWith("FC_BA2I") && cakeSlice.name().endsWith("_BANK")) {
|
||||
if (CAKE_EATER_BASE2_SIGNED_IDX == -1) {
|
||||
CAKE_EATER_BASE2_SIGNED_IDX = CAKE_EATERS.size();
|
||||
}
|
||||
FourCornerDotCake cakeSliceSel = FourCornerDotCake.valueOf(cakeSlice.ordinal() - 1);
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberBase2Signed(cakeSliceSel, cakeSlice, fremanBase2IntItr.next()));
|
||||
CAKE_EATERS.add(new StenoScannerNumberBase2Signed(cakeSliceSel, cakeSlice, fremanBase2IntItr.next()));
|
||||
continue;
|
||||
}
|
||||
if (cakeSlice.name().startsWith("FC_BA8L") && cakeSlice.name().endsWith("_BANK")) {
|
||||
if (CAKE_EATER_BASE8_LEGO_IDX == -1) {
|
||||
CAKE_EATER_BASE8_LEGO_IDX = CAKE_EATERS.size();
|
||||
}
|
||||
FourCornerDotCake cakeSliceSel = FourCornerDotCake.valueOf(cakeSlice.ordinal() - 1);
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberBase8Lego(cakeSliceSel, cakeSlice, fremanBase8LegoItr.next()));
|
||||
CAKE_EATERS.add(new StenoScannerNumberBase8Lego(cakeSliceSel, cakeSlice, fremanBase8LegoItr.next()));
|
||||
continue;
|
||||
}
|
||||
if (cakeSlice.name().startsWith("FC_BA8C") && cakeSlice.name().endsWith("_BANK")) {
|
||||
if (CAKE_EATER_BASE8_CHOCO_IDX == -1) {
|
||||
CAKE_EATER_BASE8_CHOCO_IDX = CAKE_EATERS.size();
|
||||
}
|
||||
FourCornerDotCake cakeSliceSel = FourCornerDotCake.valueOf(cakeSlice.ordinal() - 1);
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberBase8Choco(cakeSliceSel, cakeSlice, fremanBase8IntItr.next()));
|
||||
CAKE_EATERS.add(new StenoScannerNumberBase8Choco(cakeSliceSel, cakeSlice, fremanBase8IntItr.next()));
|
||||
continue;
|
||||
}
|
||||
if (FourCornerDotCakeTower.TXT_GRAMS.equals(cakeSlice.tower())) {
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberGramSlice(cakeSlice));
|
||||
continue;
|
||||
}
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerWordCakeSlice(cakeSlice));
|
||||
}
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerSandWorm());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberChocoPigRational());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberChocoPigDecimal());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberChocoPigFloat());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberChocoPigChoped());
|
||||
ArrayList.class.cast(CAKE_SLICE_EATERS).trimToSize();
|
||||
CAKE_EATERS.add(new StenoScannerNumberChocoPigRational());
|
||||
CAKE_EATERS.add(new StenoScannerNumberChocoPigDecimal());
|
||||
CAKE_EATERS.add(new StenoScannerNumberChocoPigFloat());
|
||||
CAKE_EATERS.add(new StenoScannerNumberChocoPigChoped());
|
||||
CAKE_EATERS.add(new StenoScannerDEC());
|
||||
ArrayList.class.cast(CAKE_EATERS).trimToSize();
|
||||
}
|
||||
|
||||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler) {
|
||||
|
|
@ -226,9 +207,9 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
|
||||
private ScanResult readTokens() {
|
||||
ScanResult result = ScanResult.NEXT;
|
||||
final int cakeCutSize = CAKE_SLICE_EATERS.size();
|
||||
final int cakeCutSize = CAKE_EATERS.size();
|
||||
for (int i = 0; i < cakeCutSize; i++) {
|
||||
StenoScanner scanner = CAKE_SLICE_EATERS.get(i);
|
||||
StenoScanner scanner = CAKE_EATERS.get(i);
|
||||
result = scanner.scan(this);
|
||||
if (result.isEOF()) {
|
||||
return result;
|
||||
|
|
@ -261,6 +242,9 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
cdcDECModeInc = null;
|
||||
cdcDECModePie = 0;
|
||||
cdcDECModePieAlt = null;
|
||||
cdcFremanGroupIndex = -1;
|
||||
cdcFremanSel0 = 0;
|
||||
cdcFremanBank = 0;
|
||||
}
|
||||
|
||||
private void numberBankReset() {
|
||||
|
|
@ -394,16 +378,19 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
|
||||
static final class StenoScannerWordCakeSlice extends StenoScanner {
|
||||
|
||||
public StenoScannerWordCakeSlice(FourCornerDotCake cakeSlice) {
|
||||
super(cakeSlice);
|
||||
private final FCFlameWordDish course;
|
||||
|
||||
public StenoScannerWordCakeSlice(FCFlameWordDish course) {
|
||||
super(course.cakePointMin(), course.cakePointMax());
|
||||
this.course = Objects.requireNonNull(course);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
if (idxFirst == idxLast) {
|
||||
lexer.handler.strobeTheWord(lexer.input.get(idxFirst));
|
||||
lexer.handler.strobeTheWord(course, lexer.input.get(idxFirst));
|
||||
} else {
|
||||
lexer.handler.strobeTheWords(lexer.input.subList(idxFirst, idxLast + 1));
|
||||
lexer.handler.strobeTheWords(course, lexer.input.subList(idxFirst, idxLast + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -603,45 +590,57 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
}
|
||||
}
|
||||
|
||||
static final class StenoScannerCDCDEC extends StenoScanner {
|
||||
static final class StenoScannerDEC extends StenoScanner {
|
||||
|
||||
public StenoScannerCDCDEC(FourCornerDotCake cakeSlice) {
|
||||
super(cakeSlice);
|
||||
public StenoScannerDEC() {
|
||||
super(FourCornerDotCake.FC_DEC2701_PX0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
if (!lexer.handlerEscape) {
|
||||
return; // disabled escape handing
|
||||
}
|
||||
lexer.decModeReset();
|
||||
int cakePointEscape = -1;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
if (cakePointEscape != -1) {
|
||||
lexer.smokeSignals.burnSalahIgnoredSequence(lexer.currLine, lexer.currCol, cakePointEscape);
|
||||
}
|
||||
cakePointEscape = lexer.input.get(i);
|
||||
lexer.cdcDECMode = FCDotDEC2701DashPX0.valueOfCakePoint(cakePointEscape);
|
||||
if (FCDotDEC2701DashPX0.ESC_STOP.equals(lexer.cdcDECMode)) {
|
||||
cakePointEscape = -1; // skip report ESC_STOP
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final class StenoScannerCDC extends StenoScanner {
|
||||
|
||||
public StenoScannerCDC() {
|
||||
super(FourCornerDotCake.FC_CDC1604_P6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
lexer.cdcDECScanIndex = idxFirst;
|
||||
lexer.cdcDECScanIndexEnd = idxLast;
|
||||
for (lexer.cdcDECScanIndex = idxFirst; lexer.cdcDECScanIndex <= lexer.cdcDECScanIndexEnd; lexer.cdcDECScanIndex++) {
|
||||
if (handleEscape(lexer)) {
|
||||
continue;
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (lexer.handlerEscape && FCDotCDC1604DashP6.isEscape6(cdcPoint)) {
|
||||
lexer.decModeReset();
|
||||
lexer.cdcDECMode = readEscape6(lexer);
|
||||
continue; // goto next letter
|
||||
}
|
||||
if (lexer.cdcDECMode != null && handleDECMode(lexer)) {
|
||||
continue;
|
||||
continue; // letter is done, goto next
|
||||
}
|
||||
int cdcDECPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
lexer.handler.strobeTheWord(cdcDECPoint);
|
||||
lexer.handler.strobeTheWord(FCFlameWordDish.APPETIZER, cdcPoint);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleEscape(FourCornerZionStenoLexer lexer) {
|
||||
if (!lexer.handlerEscape) {
|
||||
return false; // disable escape handing
|
||||
}
|
||||
int cdcDECPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (FourCornerDotCake.FC_DEC2701_PX0.contains(cdcDECPoint)) {
|
||||
lexer.decModeReset();
|
||||
lexer.cdcDECMode = FCDotDEC2701DashPX0.valueOfCakePoint(cdcDECPoint);
|
||||
return true;
|
||||
} else if (FCDotCDC1604DashP6.isEscape6(cdcDECPoint)) {
|
||||
lexer.decModeReset();
|
||||
lexer.cdcDECMode = readEscape6(lexer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// fixme: fold below 3 read to one base method
|
||||
|
||||
private FCDotDEC2701DashPX0 readEscape6(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint1 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
|
|
@ -691,6 +690,30 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
return FCDotCDC1604DashP6.pepper3SequenceRead(x1, x2, x3);
|
||||
}
|
||||
|
||||
private Integer readEscapeSalt3(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint1 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (lexer.cdcDECScanIndex >= lexer.cdcDECScanIndexEnd) {
|
||||
return null;
|
||||
}
|
||||
lexer.cdcDECScanIndex++;
|
||||
int cdcPoint2 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (!FCDotCDC1604DashP6.isEscapeSalt(cdcPoint2)) {
|
||||
return null;
|
||||
}
|
||||
if (lexer.cdcDECScanIndex >= lexer.cdcDECScanIndexEnd) {
|
||||
return null;
|
||||
}
|
||||
lexer.cdcDECScanIndex++;
|
||||
int cdcPoint3 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (!FCDotCDC1604DashP6.isEscapeSalt(cdcPoint3)) {
|
||||
return null;
|
||||
}
|
||||
FCDotCDC1604DashP6 x1 = FCDotCDC1604DashP6.valueOf(cdcPoint1);
|
||||
FCDotCDC1604DashP6 x2 = FCDotCDC1604DashP6.valueOf(cdcPoint2);
|
||||
FCDotCDC1604DashP6 x3 = FCDotCDC1604DashP6.valueOf(cdcPoint3);
|
||||
return FCDotCDC1604DashP6.salt3SequenceRead(x1, x2, x3);
|
||||
}
|
||||
|
||||
private boolean handleDECMode(FourCornerZionStenoLexer lexer) {
|
||||
FCDotDEC2701DashPX0 cdcDECMode = lexer.cdcDECMode;
|
||||
if (FCDotDEC2701DashPX0.ESC_STOP.equals(cdcDECMode)) {
|
||||
|
|
@ -707,10 +730,22 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
if (FCDotDEC2701DashPX0.ESC_VT06.equals(cdcDECMode)) {
|
||||
lexer.handler.strobeSalahSequence(FCFlameSalahSequence.ESC_VT06, args);
|
||||
} else {
|
||||
lexer.handler.strobeSalahSequence(FCFlameSalahSequence.values()[cdcDECMode.ordinal()], args); // todo: use fast enum
|
||||
lexer.handler.strobeSalahSequence(FCFlameSalahSequence.valueOf(cdcDECMode.ordinal()), args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC6_BASE2_LEGO.equals(cdcDECMode)) {
|
||||
return handleFreman(lexer, CAKE_EATER_BASE2_LEGO_IDX);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC6_BASE2_SIGNED.equals(cdcDECMode)) {
|
||||
return handleFreman(lexer, CAKE_EATER_BASE2_SIGNED_IDX);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC6_BASE8_LEGO.equals(cdcDECMode)) {
|
||||
return handleFreman(lexer, CAKE_EATER_BASE8_LEGO_IDX);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC6_BASE8_CHOCO.equals(cdcDECMode)) {
|
||||
return handleFreman(lexer, CAKE_EATER_BASE8_CHOCO_IDX);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC6_2PIE9C.equals(cdcDECMode)) {
|
||||
if (lexer.cdcDECModePieAlt == null) {
|
||||
lexer.cdcDECModePieAlt = false;
|
||||
|
|
@ -730,7 +765,7 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
return handleINC(lexer);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC6_SAND_WORM.equals(cdcDECMode)) {
|
||||
return handleSandWorm68(lexer);
|
||||
return handleSandWorm(lexer);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -753,8 +788,11 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
//lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
lexer.handler.strobeTheWord(displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
if (FCDotINC0801DashP8.INC_PIE9C_26.equals(lexer.cdcDECModeInc)) { // TODO: delete this
|
||||
lexer.handler.strobeTheWord(FCFlameWordDish.CANDY_PIE, displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
lexer.handler.strobeTheWord(FCFlameWordDish.CANDY_BAR, displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -767,9 +805,8 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
return false;
|
||||
}
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TXT0001_SP.equals(cmdMode)) {
|
||||
lexer.decModeReset();
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_F4TXT0001_SP, 0); // white space
|
||||
lexer.handler.strobeTheWord(FCDotF4TXT0001DashSP.SPANISH_PEACE.cakePointDotIndex()); // white space
|
||||
lexer.decModeReset(); // TODO: delete CLK, this moves to own method.
|
||||
lexer.handler.strobeTheWord(FCFlameWordDish.CLOCK_SAUCE, FCDotF4TXT0001DashSP.SPANISH_PEACE.cakePointDotIndex()); // white space
|
||||
return true;
|
||||
}
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TTY0001_NL.equals(cmdMode)) {
|
||||
|
|
@ -777,8 +814,8 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
lexer.currLine++;
|
||||
lexer.currCol = 0;
|
||||
lexer.fireSignals.fireStateLine(lexer.currLine);
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_F4TTY0001_NL, 0); // new line
|
||||
lexer.handler.strobeTheWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex()); // new line
|
||||
// TODO: move to own method
|
||||
lexer.handler.strobeTheWord(FCFlameWordDish.CLOCK_SAUCE, FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex()); // new line
|
||||
return true;
|
||||
}
|
||||
lexer.decModeReset();
|
||||
|
|
@ -786,6 +823,48 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean handleFreman(FourCornerZionStenoLexer lexer, int cakeEaterIdx) {
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (FCDotCDC1604DashP6.isEscapeSalt(cdcPoint)) {
|
||||
lexer.cdcFremanGroupIndex = readEscapeSalt3(lexer);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcFremanGroupIndex == -1) { // == missing salt select
|
||||
lexer.decModeReset();
|
||||
return false; // not handled thus print
|
||||
}
|
||||
if (FCDotCDC1604DashP6.NS04_RAKA1_INTERROBANG.baklavaPointDotIndex() == cdcPoint) {
|
||||
lexer.decModeReset();
|
||||
return true;
|
||||
}
|
||||
Optional<FCDotCDC1604DiceSaw> diceOpt = FCDotCDC1604DiceSaw.valueOfCakePoint(cdcPoint);
|
||||
if (diceOpt.isEmpty()) {
|
||||
lexer.decModeReset();
|
||||
return false; // not handled thus print
|
||||
}
|
||||
FCDotCDC1604DiceSaw dice = diceOpt.get();
|
||||
if (dice.sideNothingY()) {
|
||||
lexer.cdcFremanSel0 = dice.decodeOctal(lexer.cdcFremanSel0, cdcPoint);
|
||||
} else {
|
||||
lexer.cdcFremanBank = dice.decodeOctal(lexer.cdcFremanBank, cdcPoint);
|
||||
}
|
||||
if (!FCDotCDC1604DiceSaw.FACE_1NX.equals(dice)) {
|
||||
return true;
|
||||
}
|
||||
lexer.numberBank[lexer.cdcFremanSel0] = lexer.cdcFremanBank;
|
||||
lexer.cdcFremanBank = 0;
|
||||
lexer.cdcFremanSel0--;
|
||||
if (lexer.cdcFremanSel0 < 0) {
|
||||
StenoScanner scanner = CAKE_EATERS.get(cakeEaterIdx + lexer.cdcFremanGroupIndex);
|
||||
StenoScannerNumberBank.class.cast(scanner).processBankZero(lexer);
|
||||
lexer.cdcFremanSel0 = 0;
|
||||
lexer.cdcFremanBank = 0;
|
||||
lexer.numberBankReset();
|
||||
// TODO: handle mising sparkler too
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handlePIE(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
|
||||
|
|
@ -824,8 +903,7 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
sliceBase = FourCornerDotCake.FC_PIE9D_01.ordinal();
|
||||
}
|
||||
FourCornerDotCake slice = FourCornerDotCake.valueOf(terminatorOffZero + sliceBase); // TODO: remove slice here
|
||||
//lexer.handler.strobeWord(slice, numberIdxOffZero);
|
||||
lexer.handler.strobeTheWord(slice.getStart() + numberIdxOffZero);
|
||||
lexer.handler.strobeTheWord(FCFlameWordDish.CANDY_PIE, slice.getStart() + numberIdxOffZero);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -862,7 +940,7 @@ public class FourCornerZionStenoLexer implements FourCornerZionStenoPetroglyphs
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean handleSandWorm68(FourCornerZionStenoLexer lexer) {
|
||||
private boolean handleSandWorm(FourCornerZionStenoLexer lexer) {
|
||||
List<PrimordialOctal> sandWalk = new ArrayList<>();
|
||||
List<PrimordialOctal> sandSpice = new ArrayList<>();
|
||||
boolean sandWalker = true;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
|
||||
void burnSalahMissingAmen(int line, int col);
|
||||
|
||||
void burnSalahIgnoredSequence(int line, int col, int cakePoint);
|
||||
|
||||
|
||||
void burnSandWalkerOutOfRhythm(int line, int col);
|
||||
|
||||
|
|
@ -61,6 +63,10 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
default void burnSalahMissingAmen(int line, int col) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnSalahIgnoredSequence(int line, int col, int cakePoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnControlCommandUnsupported(int line, int col, int cakePoint) {
|
||||
}
|
||||
|
|
@ -97,6 +103,11 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
burnMonoPipe(line, col, "burnSalahMissingAmen");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnSalahIgnoredSequence(int line, int col, int cakePoint) {
|
||||
burnMonoPipe(line, col, "burnSalahIgnoredSequence:0x" + Integer.toHexString(cakePoint));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnControlCommandUnsupported(int line, int col, int cakePoint) {
|
||||
burnMonoPipe(line, col, "burnControlCommandUnsupported:0x" + Integer.toHexString(cakePoint));
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package org.x4o.fc18.zion7.flame4;
|
|||
import java.math.BigInteger;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.zion7.FourCornerZionStenoPetroglyphs;
|
||||
|
||||
/// The supported choco sand dune formations.
|
||||
|
|
@ -70,6 +71,11 @@ public enum FCFlameFremanChocoBase8 implements FCFlameFremanSuit {
|
|||
return maxWaterLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCDotDEC2701DashPX0 escapeSequenceFC6() {
|
||||
return FCDotDEC2701DashPX0.ESC6_BASE8_CHOCO;
|
||||
}
|
||||
|
||||
public int octals() {
|
||||
return octals;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package org.x4o.fc18.zion7.flame4;
|
|||
import java.math.BigInteger;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.zion7.FourCornerZionStenoPetroglyphs;
|
||||
|
||||
/// The supported lego sand man bait marks.
|
||||
|
|
@ -70,6 +71,11 @@ public enum FCFlameFremanLegoBase2 implements FCFlameFremanSuit {
|
|||
return maxWaterLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCDotDEC2701DashPX0 escapeSequenceFC6() {
|
||||
return FCDotDEC2701DashPX0.ESC6_BASE2_LEGO;
|
||||
}
|
||||
|
||||
public int bytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package org.x4o.fc18.zion7.flame4;
|
|||
import java.math.BigInteger;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.zion7.FourCornerZionStenoPetroglyphs;
|
||||
|
||||
/// The supported lego sand dune formations.
|
||||
|
|
@ -70,6 +71,11 @@ public enum FCFlameFremanLegoBase8 implements FCFlameFremanSuit {
|
|||
return maxWaterLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCDotDEC2701DashPX0 escapeSequenceFC6() {
|
||||
return FCDotDEC2701DashPX0.ESC6_BASE8_LEGO;
|
||||
}
|
||||
|
||||
public int octals() {
|
||||
return octals;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package org.x4o.fc18.zion7.flame4;
|
|||
import java.math.BigInteger;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.zion7.FourCornerZionStenoPetroglyphs;
|
||||
|
||||
/// The supported signed sand man bait marks.
|
||||
|
|
@ -70,6 +71,11 @@ public enum FCFlameFremanSignedBase2 implements FCFlameFremanSuit {
|
|||
return maxWaterLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCDotDEC2701DashPX0 escapeSequenceFC6() {
|
||||
return FCDotDEC2701DashPX0.ESC6_BASE2_SIGNED;
|
||||
}
|
||||
|
||||
public int bytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ package org.x4o.fc18.zion7.flame4;
|
|||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
|
||||
/// The freman suite for taste amd water management
|
||||
|
|
@ -40,4 +41,6 @@ public interface FCFlameFremanSuit extends PrimordialOctal {
|
|||
int cakeOffsetBank();
|
||||
|
||||
BigInteger maxWaterLevel();
|
||||
|
||||
FCDotDEC2701DashPX0 escapeSequenceFC6();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,11 +78,11 @@ public enum FCFlameNumberTaste {
|
|||
return CHOCO_MASK_BIT_0000 == (ordinal() & CHOCO_MASK_BIT_1000);
|
||||
}
|
||||
|
||||
public boolean numberValidInteger() {
|
||||
public boolean numberValidInteger4D() {
|
||||
return CHOCO_MASK_BIT_0000 == (ordinal() & CHOCO_MASK_BIT_1100);
|
||||
}
|
||||
|
||||
public boolean numberValidInfinity() {
|
||||
public boolean numberValidInfinity4D() {
|
||||
return CHOCO_MASK_BIT_0100 == (ordinal() & CHOCO_MASK_BIT_1100);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,4 +36,17 @@ public enum FCFlameSalahSequence {
|
|||
ESC_USER_6,
|
||||
ESC_VT06,
|
||||
;
|
||||
|
||||
private static final FCFlameSalahSequence[] VALUES = values();
|
||||
|
||||
private FCFlameSalahSequence() {
|
||||
}
|
||||
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCFlameSalahSequence valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,20 +22,21 @@
|
|||
*/
|
||||
package org.x4o.fc18.zion7.flame4;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/// The steno tongue speak language supported limits.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Sep 6, 2025
|
||||
public enum FCFlameStenoTongue {
|
||||
|
||||
FC6 (0x000000, 0x00003F),
|
||||
FC6_PLUS (0x000000, 0x0003F3), // 63 > auto esc to fc6
|
||||
FC18 (0x000000, 0x03FFFF),
|
||||
FC18_ADULT (0x0003F4, 0x03FFFF), // no candy for adults
|
||||
// XDBX18 (0x000000, 0x03FFFF),
|
||||
// XDBX18_ADULT (0x0003F4, 0x03FFFF), // no candy for adults
|
||||
FC6 (FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.FC_CDC1604_P6.getStop()),
|
||||
FC6_PLUS (FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.FC_PIE9D_27.getStop()), // 63 > auto esc to fc6
|
||||
FC18 (FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.FC_CDC1604_P6.getStop()),
|
||||
FC18_ADULT (FourCornerDotCake.FC_CLK1K_Z.getStop() + 1, FourCornerDotCake.FC_CDC1604_P6.getStop()), // no candy for adults
|
||||
;
|
||||
|
||||
private static final FCFlameStenoTongue[] VALUES = values();
|
||||
private final int cakePointMin;
|
||||
private final int cakePointMax;
|
||||
|
||||
|
|
@ -57,10 +58,14 @@ public enum FCFlameStenoTongue {
|
|||
}
|
||||
|
||||
public boolean limitAdult() {
|
||||
return this == FC18_ADULT; // || this == XDBX18_ADULT;
|
||||
return this == FC18_ADULT;
|
||||
}
|
||||
|
||||
// public boolean isXDBX18() {
|
||||
// return this == XDBX18 || this == XDBX18_ADULT;
|
||||
// }
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCFlameStenoTongue valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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.fc18.zion7.flame4;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/// The spoken languages supported by the word.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Sep 7, 2025
|
||||
public enum FCFlameWordDish {
|
||||
|
||||
APPETIZER (FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.FC_CDC1604_P6.getStop()),
|
||||
CANDY_BAR (FourCornerDotCake.FC_LUA0127_P7A.getStart(), FourCornerDotCake.FC_BYD0127_P7G.getStop()),
|
||||
CANDY_PIE (FourCornerDotCake.FC_PIE9C_01.getStart(), FourCornerDotCake.FC_PIE9D_27.getStop()),
|
||||
KANJI_MEAT (FourCornerDotCake.FC_WORDS_0000.getStart(), FourCornerDotCake.FC_EXTRA_1100.getStop()),
|
||||
CLOCK_SAUCE (FourCornerDotCake.FC_CLK1K_A.getStart(), FourCornerDotCake.FC_CLK1K_Z.getStop()),
|
||||
;
|
||||
|
||||
private static final FCFlameWordDish[] VALUES = values();
|
||||
private final int cakePointMin;
|
||||
private final int cakePointMax;
|
||||
|
||||
private FCFlameWordDish(int cakePointMin, int cakePointMax) {
|
||||
this.cakePointMin = cakePointMin;
|
||||
this.cakePointMax = cakePointMax;
|
||||
}
|
||||
|
||||
public int cakePointMin() {
|
||||
return cakePointMin;
|
||||
}
|
||||
|
||||
public int cakePointMax() {
|
||||
return cakePointMax;
|
||||
}
|
||||
|
||||
public int washFromCakePoint(int cakePoint) {
|
||||
if (cakePoint < cakePointMin()) {
|
||||
throw new IllegalArgumentException("Cake point it to small: " + cakePoint);
|
||||
}
|
||||
if (cakePoint > cakePointMax()) {
|
||||
throw new IllegalArgumentException("Cake point it to large: " + cakePoint);
|
||||
}
|
||||
return cakePoint - cakePointMin();
|
||||
}
|
||||
|
||||
public int serveToCakePoint(int offset) {
|
||||
if (offset < 0) {
|
||||
throw new IllegalArgumentException("Offset index it to small: " + offset);
|
||||
}
|
||||
int cakePoint = cakePointMin() + offset;
|
||||
if (cakePoint > cakePointMax()) {
|
||||
throw new IllegalArgumentException("Offset index is to large: " + offset);
|
||||
}
|
||||
return cakePoint;
|
||||
}
|
||||
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCFlameWordDish valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ import org.x4o.fc18.octal8.PrimordialOctalSound;
|
|||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameNumberTaste;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameWordDish;
|
||||
|
||||
/**
|
||||
* Tests four corner grapher parts.
|
||||
|
|
@ -53,10 +54,10 @@ public class StenoGrapherTest {
|
|||
@Test
|
||||
public void testStenoTongueLimits() throws Exception {
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerZionStenoGrapher.writerX06(new ArrayList<>()).strobeTheWord(0x040000);
|
||||
FourCornerZionStenoGrapher.writerX06(new ArrayList<>()).strobeTheWord(FCFlameWordDish.APPETIZER, 0x040000);
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerZionStenoGrapher.writerX18(new ArrayList<>()).strobeTheWord(0x040000);
|
||||
FourCornerZionStenoGrapher.writerX18(new ArrayList<>()).strobeTheWord(FCFlameWordDish.APPETIZER, 0x040000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -64,8 +65,8 @@ public class StenoGrapherTest {
|
|||
public void testStenoAutoFC6Plus() throws Exception {
|
||||
List<Integer> out = new ArrayList<>();
|
||||
FourCornerZion7Bereshit writerFC06 = FourCornerZionStenoGrapher.writerX06(out);
|
||||
writerFC06.strobeTheWord(0x00012D);
|
||||
writerFC06.strobeTheWord(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex());
|
||||
writerFC06.strobeTheWord(FCFlameWordDish.CANDY_PIE, 0x00012D);
|
||||
writerFC06.strobeTheWord(FCFlameWordDish.APPETIZER, FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex());
|
||||
Assertions.assertEquals(7, out.size());
|
||||
Iterator<Integer> outTest = out.iterator();
|
||||
Assertions.assertEquals(2, outTest.next());
|
||||
|
|
@ -106,7 +107,7 @@ public class StenoGrapherTest {
|
|||
for (int x = 1; x <= 1025 /*_999999*/; x++) {
|
||||
BigInteger v = BigInteger.valueOf(x);
|
||||
writerX18.strobeNumberChocoPigRational(FCFlameNumberTaste.NUMBER_POSITIVE, FCFlameNumberTaste.NUMBER_POSITIVE, BigInteger.ONE, v);
|
||||
writerX18.strobeTheWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex());
|
||||
writerX18.strobeTheWord(FCFlameWordDish.CLOCK_SAUCE, FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex());
|
||||
}
|
||||
writerX18.strobeDocumentOmega();
|
||||
PrimordialOctalOrangeString str = PrimordialOctalOrangeString.ioSmurfReadListX18(outX18);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import java.util.List;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.FourCornerUnicodeDisplay;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameFremanLegoBase2;
|
||||
import org.x4o.fc18.zion7.flame4.FCFlameFremanSignedBase2;
|
||||
|
||||
|
|
@ -39,7 +40,16 @@ import org.x4o.fc18.zion7.flame4.FCFlameFremanSignedBase2;
|
|||
* @version 1.0 Aug 24, 2025
|
||||
*/
|
||||
public class StenoNumberBase2Test {
|
||||
|
||||
|
||||
@Test
|
||||
public void testBASE2Lego123456789FC6() throws Exception {
|
||||
List<Integer> out = new ArrayList<>();
|
||||
FourCornerZion7Bereshit writer = FourCornerZionStenoGrapher.writerX06(out);
|
||||
writer.strobeNumberBASE2Lego(FCFlameFremanLegoBase2.LEGO_0032, BigInteger.valueOf(123456789));
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(out);
|
||||
Assertions.assertEquals("123456789", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBASE2Lego123() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -85,4 +85,13 @@ public class StenoNumberBase8Test {
|
|||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("1393796574908163946345982392040522594123775", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBASE8ChocoLargeFC6() throws Exception {
|
||||
List<Integer> out = new ArrayList<>();
|
||||
FourCornerZion7Bereshit writer = FourCornerZionStenoGrapher.writerX18(out);
|
||||
writer.strobeNumberBASE8Choco(FCFlameFremanChocoBase8.CHOCO_0144, FCFlameNumberTaste.NUMBER_POSITIVE, new BigInteger("1393796574908163946345982392040522594123775", 10));
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(out);
|
||||
Assertions.assertEquals("1393796574908163946345982392040522594123775", resX18);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue