Compare commits
4 commits
6c0ee56272
...
53a162d232
| Author | SHA1 | Date | |
|---|---|---|---|
| 53a162d232 | |||
| 355ac835be | |||
| 4c7355b65d | |||
| 586b5f9fe3 |
12 changed files with 430 additions and 459 deletions
|
|
@ -24,22 +24,13 @@ package org.x4o.fc18;
|
|||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
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.FCDotPIE9CDash11;
|
||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
import org.x4o.fc18.zion7.FourCornerZion7SalahSequence;
|
||||
|
||||
/// Holds different lookup and conversion maps towards four corner int18 cake points.
|
||||
///
|
||||
|
|
@ -47,266 +38,9 @@ import org.x4o.fc18.zion7.FourCornerZion7SalahSequence;
|
|||
/// @version 1.0 Jan 09, 2025
|
||||
final public class FourCornerRecipe {
|
||||
|
||||
public static final BigInteger NCR1632_MASK_PAGE = BigInteger.valueOf(0x1FF);
|
||||
public static final BigInteger NCR1632_VALUE_MAX = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
public static final List<Integer> SAND_WORM_SIGN = List.of(24,48,72,96,120,144,168,192);
|
||||
|
||||
private FourCornerRecipe() {
|
||||
}
|
||||
|
||||
static public List<Integer> embedSalahSequenceX06(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
return embedSalahSequence(new ArrayList<>(), type, arguments, true);
|
||||
}
|
||||
|
||||
static public List<Integer> embedSalahSequenceX18(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
return embedSalahSequence(new ArrayList<>(), type, arguments, false);
|
||||
}
|
||||
|
||||
static public List<Integer> embedSalahSequenceX06(List<Integer> out, FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
return embedSalahSequence(out, type, arguments, true);
|
||||
}
|
||||
|
||||
static public List<Integer> embedSalahSequenceX18(List<Integer> out, FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
return embedSalahSequence(out, type, arguments, false);
|
||||
}
|
||||
|
||||
static private List<Integer> embedSalahSequence(List<Integer> out, FourCornerZion7SalahSequence type, List<List<Integer>> arguments, boolean isSixBit) {
|
||||
Objects.requireNonNull(type);
|
||||
Objects.requireNonNull(arguments);
|
||||
if (FourCornerZion7SalahSequence.ESC_VT06.equals(type)) {
|
||||
if (isSixBit) {
|
||||
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.baklavaPointSequence());
|
||||
} else {
|
||||
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.cakePointSequence());
|
||||
}
|
||||
} else {
|
||||
if (isSixBit) {
|
||||
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).baklavaPointSequence());
|
||||
} else {
|
||||
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).cakePointSequence());
|
||||
}
|
||||
}
|
||||
Iterator<List<Integer>> argu = arguments.iterator();
|
||||
while (argu.hasNext()) {
|
||||
List<Integer> arguValue = argu.next();
|
||||
out.addAll(arguValue); // TODO: add range check
|
||||
if (argu.hasNext()) {
|
||||
out.add(FCDotCDC1604DashP6._RAKA_QUESTION.baklavaPointDotIndex());
|
||||
}
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex());
|
||||
return out;
|
||||
}
|
||||
|
||||
static public List<Integer> embedSandWalker(List<PrimordialOctal> rhythm) {
|
||||
return embedSandWalker(new ArrayList<>(), rhythm);
|
||||
}
|
||||
|
||||
static public List<Integer> embedSandWalker(List<Integer> out, List<PrimordialOctal> rhythm) {
|
||||
Objects.requireNonNull(rhythm);
|
||||
if (!FourCornerRecipe.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||
throw new IllegalArgumentException("Sand walker rhythm is not 72 bit aligned: " + rhythm.size());
|
||||
}
|
||||
out.add(FCDotDEC2701DashPX0.ESC_SAND_WALKER.cakePointDotIndex());
|
||||
for (int i = 192 - 1; i >= 0; i--) {
|
||||
if (rhythm.size() <= i) {
|
||||
continue;
|
||||
}
|
||||
PrimordialOctal octal = rhythm.get(i);
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
return out;
|
||||
}
|
||||
|
||||
static public List<Integer> embedSandWormX06(List<PrimordialOctal> spice) {
|
||||
return embedSandWormX06(new ArrayList<>(), spice);
|
||||
}
|
||||
|
||||
static public List<Integer> embedSandWormX06(List<Integer> out, List<PrimordialOctal> spice) {
|
||||
Objects.requireNonNull(spice);
|
||||
out.add(FCDotDEC2701DashPX0.ESC68_SAND_WORM.cakePointDotIndex());
|
||||
for (int i = spice.size(); i >= 0; i--) {
|
||||
PrimordialOctal octal = spice.get(i);
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
return out;
|
||||
}
|
||||
|
||||
static public List<Integer> embedSandWormX18(List<PrimordialOctal> spice) {
|
||||
return embedSandWormX18(new ArrayList<>(), spice);
|
||||
}
|
||||
|
||||
static public List<Integer> embedSandWormX18(List<Integer> out, List<PrimordialOctal> spice) {
|
||||
Objects.requireNonNull(spice);
|
||||
Iterator<PrimordialOctal> spiceItr = spice.iterator();
|
||||
while (spiceItr.hasNext()) {
|
||||
PrimordialOctal octal4 = spiceItr.next();
|
||||
PrimordialOctal octal3 = spiceItr.next();
|
||||
PrimordialOctal octal2 = spiceItr.next();
|
||||
PrimordialOctal octal1 = spiceItr.next();
|
||||
PrimordialOctal octal0 = spiceItr.next();
|
||||
int bitValue15 = 0;
|
||||
bitValue15 += (octal4.ordinal() << 12);
|
||||
bitValue15 += (octal3.ordinal() << 9);
|
||||
bitValue15 += (octal2.ordinal() << 6);
|
||||
bitValue15 += (octal1.ordinal() << 3);
|
||||
bitValue15 += (octal0.ordinal() << 0);
|
||||
out.add(FourCornerDotCake.FC_SANDWORM_15.getStart() + bitValue15);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static public List<Integer> embedNCR1632FractionX06(BigInteger denominator, BigInteger numerator) {
|
||||
return embedNCR1632FractionX18(new ArrayList<>(), denominator, numerator);
|
||||
}
|
||||
|
||||
static public List<Integer> embedNCR1632FractionX06(List<Integer> out, BigInteger denominator, BigInteger numerator) {
|
||||
if (denominator.equals(BigInteger.ZERO)) {
|
||||
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
||||
}
|
||||
if (numerator.equals(BigInteger.ZERO)) {
|
||||
throw new IllegalArgumentException("The numerator value ZERO is not allowed.");
|
||||
}
|
||||
//if (denominator.signum() == -1) {
|
||||
// // TODO: check if we need one octal for pos/neg/qNaN/sNaN/pos_inf/neg_inf/free/free options
|
||||
//}
|
||||
if (denominator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||
}
|
||||
if (numerator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
||||
}
|
||||
|
||||
out.addAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence());
|
||||
// NX01-NX08 are octals
|
||||
// DEN: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
||||
// NUM: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
||||
|
||||
BigInteger denominatorZero = denominator.subtract(BigInteger.ONE);
|
||||
BigInteger numeratorZero = numerator.subtract(BigInteger.ONE);
|
||||
if (denominatorZero.equals(BigInteger.ZERO)) {
|
||||
out.add(FCDotCDC1604DashP6.NY05_BAR_VERTICAL.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex());
|
||||
} else {
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = denominatorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0) {
|
||||
continue;
|
||||
}
|
||||
int pageMSB = (i >> 3) & 0b111;
|
||||
int pageLSB = (i >> 0) & 0b111;
|
||||
int valueMSB = (bankValue >> 6) & 0b111;
|
||||
int valueCSB = (bankValue >> 3) & 0b111;
|
||||
int valueLSB = (bankValue >> 0) & 0b111;
|
||||
if (pageMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY01_AT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||
}
|
||||
if (pageLSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||
}
|
||||
if (valueMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY03_BAR_V_LEFT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||
}
|
||||
if (valueCSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY04_BAR_UNDER.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6.NY05_BAR_VERTICAL.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||
}
|
||||
}
|
||||
if (numeratorZero.equals(BigInteger.ZERO)) {
|
||||
out.add(FCDotCDC1604DashP6.NY10_CARET.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex());
|
||||
} else {
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = numeratorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0) {
|
||||
continue;
|
||||
}
|
||||
int pageMSB = (i >> 3) & 0b111;
|
||||
int pageLSB = (i >> 0) & 0b111;
|
||||
int valueMSB = (bankValue >> 6) & 0b111;
|
||||
int valueCSB = (bankValue >> 3) & 0b111;
|
||||
int valueLSB = (bankValue >> 0) & 0b111;
|
||||
if (pageMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY06_PERCENT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||
}
|
||||
if (pageLSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY07_DOLLAR.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||
}
|
||||
if (valueMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY08_HASH.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||
}
|
||||
if (valueCSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY09_EQUALS.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6.NY10_CARET.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||
}
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
return out;
|
||||
}
|
||||
|
||||
static public List<Integer> embedNCR1632FractionX18(BigInteger denominator, BigInteger numerator) {
|
||||
return embedNCR1632FractionX18(new ArrayList<>(), denominator, numerator);
|
||||
}
|
||||
|
||||
static public List<Integer> embedNCR1632FractionX18(List<Integer> out, BigInteger denominator, BigInteger numerator) {
|
||||
if (denominator.equals(BigInteger.ZERO)) {
|
||||
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
||||
}
|
||||
if (numerator.equals(BigInteger.ZERO)) {
|
||||
throw new IllegalArgumentException("The numerator value ZERO is not allowed.");
|
||||
}
|
||||
//if (denominator.signum() == -1) {
|
||||
// // TODO: check if we need one octal for pos/neg/qNaN/sNaN/pos_inf/neg_inf/free/free options
|
||||
//}
|
||||
if (denominator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||
}
|
||||
if (numerator.compareTo(NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
||||
}
|
||||
BigInteger denominatorZero = denominator.subtract(BigInteger.ONE);
|
||||
BigInteger numeratorZero = numerator.subtract(BigInteger.ONE);
|
||||
if (denominatorZero.equals(BigInteger.ZERO)) {
|
||||
out.add(FourCornerDotCake.FC_NCR1632_DEN.getStart());
|
||||
} else {
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = denominatorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0) {
|
||||
continue;
|
||||
}
|
||||
int cakePoint = FourCornerDotCake.FC_NCR1632_DEN.getStart() + bankValue + (i * 512);
|
||||
out.add(cakePoint);
|
||||
}
|
||||
}
|
||||
if (numeratorZero.equals(BigInteger.ZERO)) {
|
||||
out.add(FourCornerDotCake.FC_NCR1632_NUM.getStart());
|
||||
} else {
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = numeratorZero.shiftRight(i * 9).and(NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0) {
|
||||
continue;
|
||||
}
|
||||
int cakePoint = FourCornerDotCake.FC_NCR1632_NUM.getStart() + bankValue + (i * 512);
|
||||
out.add(cakePoint);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
static public List<Integer> toScriptSuperX06(int value) {
|
||||
return toScript(new ArrayList<>(), Integer.toString(value), 0, true);
|
||||
}
|
||||
|
|
@ -442,9 +176,10 @@ final public class FourCornerRecipe {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (isSixBit) {
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex()); // fixme improve: see FourCornerDotCollePie9.baklavaPointsPIE9C
|
||||
}
|
||||
// fixme
|
||||
//if (isSixBit) {
|
||||
// out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex()); // fixme improve: see FourCornerDotCollePie9.baklavaPointsPIE9C
|
||||
//}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class FourCornerUnicodeDisplay {
|
|||
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 boolean wasExternalWord = false;
|
||||
|
|
@ -237,7 +237,7 @@ public class FourCornerUnicodeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||
public void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
|
||||
List<Integer> math = new ArrayList<>();
|
||||
FourCornerRecipe.toScriptSuperX18(math, numerator);
|
||||
math.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal());
|
||||
|
|
|
|||
|
|
@ -69,6 +69,16 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
|||
__ESC_RESERVED_A8,
|
||||
|
||||
/// _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,
|
||||
|
||||
// =========== Internal escape sequence, to embed symbols,fractions and adult texts.
|
||||
|
|
@ -116,8 +126,8 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
|||
/// _ESC6_X2 _ESC6_X3 _ESC6_X2 = 17
|
||||
/// Select packed new counting rods fraction for 6 and 8 bit systems.
|
||||
/// NX01-NX08 are octal values
|
||||
/// DEN: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
||||
/// NUM: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
||||
/// NUM: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
||||
/// DEN: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
||||
/// and and and must end with !
|
||||
ESC68_NCR,
|
||||
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@ package org.x4o.fc18.zion7;
|
|||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 11, 2025
|
||||
public interface FourCornerZion7AlphaOmega extends FourCornerZion7Candlelier {
|
||||
public interface FourCornerZion7AlphaOmega {
|
||||
|
||||
void strobeDocumentAlpha();
|
||||
|
||||
void strobeDocumentOmega();
|
||||
|
||||
interface Adapter extends FourCornerZion7AlphaOmega, FourCornerZion7Candlelier.Adapter {
|
||||
interface Adapter extends FourCornerZion7AlphaOmega {
|
||||
|
||||
@Override
|
||||
default void strobeDocumentAlpha() {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.x4o.fc18.octal8.PrimordialOctal;
|
|||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 09, 2025
|
||||
public interface FourCornerZion7Candlelier {
|
||||
public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
|
||||
|
||||
/// Single word cake point.
|
||||
void strobeWord(int cakePoint);
|
||||
|
|
@ -39,8 +39,12 @@ public interface FourCornerZion7Candlelier {
|
|||
/// Block of word cake points.
|
||||
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.
|
||||
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
||||
void strobeNCR1632(BigInteger numerator, BigInteger denominator);
|
||||
|
||||
/// Octal sand walker, with an 72 to 576 bit mime-type rhythm header.
|
||||
void strobeSandWalker(List<PrimordialOctal> rhythm);
|
||||
|
|
@ -51,7 +55,7 @@ public interface FourCornerZion7Candlelier {
|
|||
/// Handles the lexer salah sequence strobes
|
||||
void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments);
|
||||
|
||||
interface Adapter extends FourCornerZion7Candlelier {
|
||||
interface Adapter extends FourCornerZion7Candlelier, FourCornerZion7AlphaOmega.Adapter {
|
||||
|
||||
@Override
|
||||
default void strobeWord(int cakePoint) {
|
||||
|
|
@ -62,7 +66,7 @@ public interface FourCornerZion7Candlelier {
|
|||
}
|
||||
|
||||
@Override
|
||||
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||
default void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
/// Rock carvings of special variables.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Aug 24, 2025
|
||||
public final class FourCornerZion7Petroglyphs {
|
||||
|
||||
public static final BigInteger NCR1632_MASK_PAGE = BigInteger.valueOf(0x1FF);
|
||||
public static final BigInteger NCR1632_VALUE_MAX = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
public static final List<Integer> SAND_WORM_SIGN = List.of(24,48,72,96,120,144,168,192);
|
||||
|
||||
private FourCornerZion7Petroglyphs() {
|
||||
}
|
||||
}
|
||||
|
|
@ -23,10 +23,13 @@
|
|||
package org.x4o.fc18.zion7;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.fc18.FourCornerRecipe;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice;
|
||||
|
||||
|
|
@ -36,15 +39,15 @@ import org.x4o.fc18.octal8.PrimordialOctalOrangeJuice;
|
|||
/// @version 1.0 Jan 11, 2025
|
||||
public class FourCornerZionStenoGrapher {
|
||||
|
||||
static public FourCornerWriter writerX06(List<Integer> out) {
|
||||
static public FourCornerZion7Candlelier writerX06(List<Integer> out) {
|
||||
return new FourCornerWriter(out, true);
|
||||
}
|
||||
|
||||
static public FourCornerWriter writerX18(List<Integer> out) {
|
||||
static public FourCornerZion7TempleScrolls writerX18(List<Integer> out) {
|
||||
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 boolean isSixBit;
|
||||
|
|
@ -75,6 +78,7 @@ public class FourCornerZionStenoGrapher {
|
|||
|
||||
@Override
|
||||
public void strobeWords(List<Integer> cakePoints) {
|
||||
Objects.requireNonNull(cakePoints);
|
||||
int cakeSize = cakePoints.size();
|
||||
for (int i = 0; i < cakeSize; i++) {
|
||||
strobeWord(cakePoints.get(i));
|
||||
|
|
@ -82,37 +86,180 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||
public void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
|
||||
Objects.requireNonNull(numerator);
|
||||
Objects.requireNonNull(denominator);
|
||||
if (denominator.equals(BigInteger.ZERO)) { // 0/1 = zero but 1/0 is NaN
|
||||
throw new IllegalArgumentException("The denominator value ZERO is not allowed.");
|
||||
}
|
||||
//if (denominator.signum() == -1) {
|
||||
// // TODO: check if we need one octal for pos/neg/qNaN/sNaN/pos_inf/neg_inf/free/free options
|
||||
//}
|
||||
if (numerator.compareTo(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) {
|
||||
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
||||
}
|
||||
if (denominator.compareTo(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) {
|
||||
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||
}
|
||||
|
||||
if (isSixBit) {
|
||||
FourCornerRecipe.embedNCR1632FractionX06(out, denominator, numerator);
|
||||
} else {
|
||||
FourCornerRecipe.embedNCR1632FractionX18(out, denominator, numerator);
|
||||
out.addAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence());
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = numerator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0 && i > 0) {
|
||||
continue;
|
||||
}
|
||||
int pageMSB = (i >> 3) & 0b111;
|
||||
int pageLSB = (i >> 0) & 0b111;
|
||||
int valueMSB = (bankValue >> 6) & 0b111;
|
||||
int valueCSB = (bankValue >> 3) & 0b111;
|
||||
int valueLSB = (bankValue >> 0) & 0b111;
|
||||
if (pageMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY01_AT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||
}
|
||||
if (pageLSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||
}
|
||||
if (valueMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY03_BAR_V_LEFT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||
}
|
||||
if (valueCSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY04_BAR_UNDER.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6.NY05_BAR_VERTICAL.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||
}
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = denominator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0 && i > 0) {
|
||||
continue;
|
||||
}
|
||||
int pageMSB = (i >> 3) & 0b111;
|
||||
int pageLSB = (i >> 0) & 0b111;
|
||||
int valueMSB = (bankValue >> 6) & 0b111;
|
||||
int valueCSB = (bankValue >> 3) & 0b111;
|
||||
int valueLSB = (bankValue >> 0) & 0b111;
|
||||
if (pageMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY06_PERCENT.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||
}
|
||||
if (pageLSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY07_DOLLAR.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||
}
|
||||
if (valueMSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY08_HASH.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||
}
|
||||
if (valueCSB > 0) {
|
||||
out.add(FCDotCDC1604DashP6.NY09_EQUALS.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6.NY10_CARET.baklavaPointDotIndex());
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
return;
|
||||
}
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = numerator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0 && i > 0) {
|
||||
continue;
|
||||
}
|
||||
int cakePoint = FourCornerDotCake.FC_NCR1632_NUM.getStart() + bankValue + (i * 512);
|
||||
out.add(cakePoint);
|
||||
}
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = denominator.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0 && i > 0) {
|
||||
continue;
|
||||
}
|
||||
int cakePoint = FourCornerDotCake.FC_NCR1632_DEN.getStart() + bankValue + (i * 512);
|
||||
out.add(cakePoint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||
FourCornerRecipe.embedSandWalker(out, rhythm);
|
||||
Objects.requireNonNull(rhythm);
|
||||
//if (isSixBit) {
|
||||
if (!FourCornerZion7Petroglyphs.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||
throw new IllegalArgumentException("Sand walker rhythm is not 72 bit aligned: " + rhythm.size());
|
||||
}
|
||||
out.add(FCDotDEC2701DashPX0.ESC_SAND_WALKER.cakePointDotIndex());
|
||||
for (int i = 192 - 1; i >= 0; i--) {
|
||||
if (rhythm.size() <= i) {
|
||||
continue;
|
||||
}
|
||||
PrimordialOctal octal = rhythm.get(i);
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
return;
|
||||
//}
|
||||
// todo bring back native 18 bit sand walking if space allow (for adult rule)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWorm(List<PrimordialOctal> spice) {
|
||||
Objects.requireNonNull(spice);
|
||||
if (isSixBit) {
|
||||
FourCornerRecipe.embedSandWormX06(out, spice);
|
||||
} else {
|
||||
FourCornerRecipe.embedSandWormX18(out, spice);
|
||||
out.add(FCDotDEC2701DashPX0.ESC68_SAND_WORM.cakePointDotIndex());
|
||||
for (int i = spice.size(); i >= 0; i--) {
|
||||
PrimordialOctal octal = spice.get(i);
|
||||
out.add(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
return;
|
||||
}
|
||||
Iterator<PrimordialOctal> spiceItr = spice.iterator();
|
||||
while (spiceItr.hasNext()) {
|
||||
PrimordialOctal octal4 = spiceItr.next();
|
||||
PrimordialOctal octal3 = spiceItr.next();
|
||||
PrimordialOctal octal2 = spiceItr.next();
|
||||
PrimordialOctal octal1 = spiceItr.next();
|
||||
PrimordialOctal octal0 = spiceItr.next();
|
||||
int bitValue15 = 0;
|
||||
bitValue15 += (octal4.ordinal() << 12);
|
||||
bitValue15 += (octal3.ordinal() << 9);
|
||||
bitValue15 += (octal2.ordinal() << 6);
|
||||
bitValue15 += (octal1.ordinal() << 3);
|
||||
bitValue15 += (octal0.ordinal() << 0);
|
||||
out.add(FourCornerDotCake.FC_SANDWORM_15.getStart() + bitValue15);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
if (isSixBit) {
|
||||
FourCornerRecipe.embedSalahSequenceX06(out, type, arguments);
|
||||
Objects.requireNonNull(type);
|
||||
Objects.requireNonNull(arguments);
|
||||
if (FourCornerZion7SalahSequence.ESC_VT06.equals(type)) {
|
||||
if (isSixBit) {
|
||||
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.baklavaPointSequence());
|
||||
} else {
|
||||
out.addAll(FCDotDEC2701DashPX0.ESC_VT06.cakePointSequence());
|
||||
}
|
||||
} else {
|
||||
FourCornerRecipe.embedSalahSequenceX18(out, type, arguments);
|
||||
if (isSixBit) {
|
||||
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).baklavaPointSequence());
|
||||
} else {
|
||||
out.addAll(FCDotDEC2701DashPX0.valueOf(type.ordinal()).cakePointSequence());
|
||||
}
|
||||
}
|
||||
Iterator<List<Integer>> argu = arguments.iterator();
|
||||
while (argu.hasNext()) {
|
||||
List<Integer> arguValue = argu.next();
|
||||
out.addAll(arguValue); // TODO: add range check
|
||||
if (argu.hasNext()) {
|
||||
out.add(FCDotCDC1604DashP6._RAKA_QUESTION.baklavaPointDotIndex());
|
||||
}
|
||||
}
|
||||
out.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.x4o.fc18.FourCornerRecipe;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.flag4.FCDotF4TTY0001DashNL;
|
||||
import org.x4o.fc18.cake2.flag4.FCDotF4TXT0001DashSP;
|
||||
|
|
@ -46,16 +45,14 @@ import org.x4o.fc18.octal8.PrimordialOctal;
|
|||
/// @version 1.0 Jan 09, 2025
|
||||
public class FourCornerZionStenoLexer {
|
||||
|
||||
private final static FourCornerZion7AlphaOmega CLEAN_BIBLE = new FourCornerZion7AlphaOmega.Adapter() {};
|
||||
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 boolean handlerEscape;
|
||||
private final FourCornerZion7Candlelier handler;
|
||||
private final FourCornerZion7AlphaOmega handlerDocument;
|
||||
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 numeratorBank[] = new int[denominatorBank.length];
|
||||
private final int numeratorBank[] = new int[64]; // <== is the terminator select are 6 bit of banks with 9 bit of values.
|
||||
private final int denominatorBank[] = new int[numeratorBank.length];
|
||||
private List<Integer> input;
|
||||
private int inputIndex = 0;
|
||||
private int currLine = 0;
|
||||
|
|
@ -68,10 +65,10 @@ public class FourCornerZionStenoLexer {
|
|||
private int cdcDECModePie = 0;
|
||||
private Boolean cdcDECModePieAlt = null;
|
||||
private int cdcDECModeNCR68Select = 0;
|
||||
private int cdcDECModeNCR68DenPage = 0;
|
||||
private int cdcDECModeNCR68DenValue = 0;
|
||||
private int cdcDECModeNCR68NumPage = 0;
|
||||
private int cdcDECModeNCR68NumValue = 0;
|
||||
private int cdcDECModeNCR68DenPage = 0;
|
||||
private int cdcDECModeNCR68DenValue = 0;
|
||||
private FourCornerZionStenoLexerSmoke smokeSignals = CLEAN_SMOKE;
|
||||
private FourCornerZionStenoLexerFire fireSignals = CLEAN_FIRE;
|
||||
|
||||
|
|
@ -110,11 +107,6 @@ public class FourCornerZionStenoLexer {
|
|||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) {
|
||||
this.handler = Objects.requireNonNull(handler);
|
||||
this.handlerEscape = handlerEscape;
|
||||
if (handler instanceof FourCornerZion7AlphaOmega) {
|
||||
this.handlerDocument = FourCornerZion7AlphaOmega.class.cast(handler);
|
||||
} else {
|
||||
this.handlerDocument = CLEAN_BIBLE;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7TempleScrolls) {
|
||||
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
||||
} else {
|
||||
|
|
@ -151,7 +143,7 @@ public class FourCornerZionStenoLexer {
|
|||
currLine = 0;
|
||||
currCol = 0; // allow reuse of lexer
|
||||
decModeReset();
|
||||
handlerDocument.strobeDocumentAlpha();
|
||||
handler.strobeDocumentAlpha();
|
||||
do {
|
||||
ScanResult run = readTokens();
|
||||
if (run.isEOF()) {
|
||||
|
|
@ -161,7 +153,7 @@ public class FourCornerZionStenoLexer {
|
|||
smokeSignals.burnLexerReservedCakePoint(currLine, currCol, input.get(inputIndex));
|
||||
}
|
||||
} while (safeNext());
|
||||
handlerDocument.strobeDocumentOmega();
|
||||
handler.strobeDocumentOmega();
|
||||
}
|
||||
|
||||
private ScanResult readTokens() {
|
||||
|
|
@ -197,19 +189,17 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private void ncrBankFire() {
|
||||
BigInteger denominator = BigInteger.ONE;
|
||||
for (int i = 0; i < denominatorBank.length; i++) {
|
||||
denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 9));
|
||||
}
|
||||
BigInteger numerator = BigInteger.ONE;
|
||||
BigInteger numerator = BigInteger.ZERO;
|
||||
BigInteger denominator = BigInteger.ZERO;
|
||||
for (int i = 0; i < numeratorBank.length; i++) {
|
||||
numerator = numerator.add(BigInteger.valueOf(numeratorBank[i]).shiftLeft(i * 9));
|
||||
denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 9));
|
||||
}
|
||||
handler.strobeNCR1632(denominator, numerator);
|
||||
handler.strobeNCR1632(numerator, denominator);
|
||||
// reset the bank after each fire
|
||||
for (int i = 0; i < denominatorBank.length; i++) {
|
||||
denominatorBank[i] = 0;
|
||||
for (int i = 0; i < numeratorBank.length; i++) {
|
||||
numeratorBank[i] = 0;
|
||||
denominatorBank[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -220,10 +210,10 @@ public class FourCornerZionStenoLexer {
|
|||
cdcDECModePie = 0;
|
||||
cdcDECModePieAlt = null;
|
||||
cdcDECModeNCR68Select = 0;
|
||||
cdcDECModeNCR68DenPage = 0;
|
||||
cdcDECModeNCR68DenValue = 0;
|
||||
cdcDECModeNCR68NumPage = 0;
|
||||
cdcDECModeNCR68NumValue = 0;
|
||||
cdcDECModeNCR68DenPage = 0;
|
||||
cdcDECModeNCR68DenValue = 0;
|
||||
}
|
||||
|
||||
abstract static private class StenoScanner {
|
||||
|
|
@ -340,7 +330,7 @@ public class FourCornerZionStenoLexer {
|
|||
|
||||
static class StenoScannerNCR18 extends StenoScanner {
|
||||
|
||||
static private final int CAKEPOINT_BANK0_END = FourCornerDotCake.FC_NCR1632_NUM.getStart() + 512;
|
||||
static private final int CAKEPOINT_BANK0_END = FourCornerDotCake.FC_NCR1632_DEN.getStart() + 512;
|
||||
|
||||
public StenoScannerNCR18() {
|
||||
super(FourCornerDotCake.FC_NCR1632_DEN.getStart(), FourCornerDotCake.FC_NCR1632_NUM.getStop());
|
||||
|
|
@ -351,14 +341,14 @@ public class FourCornerZionStenoLexer {
|
|||
boolean missingSparkler = true;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
if (cakePoint >= FourCornerDotCake.FC_NCR1632_DEN.getStart() && cakePoint <= FourCornerDotCake.FC_NCR1632_DEN.getStop()) {
|
||||
int denominatorX = cakePoint - FourCornerDotCake.FC_NCR1632_DEN.getStart();
|
||||
lexer.denominatorBank[denominatorX / 512] = denominatorX % 512;
|
||||
if (cakePoint >= FourCornerDotCake.FC_NCR1632_NUM.getStart() && cakePoint <= FourCornerDotCake.FC_NCR1632_NUM.getStop()) {
|
||||
int numeratorX = cakePoint - FourCornerDotCake.FC_NCR1632_NUM.getStart();
|
||||
lexer.numeratorBank[numeratorX / 512] = numeratorX % 512;
|
||||
missingSparkler = true;
|
||||
continue;
|
||||
}
|
||||
int numeratorX = cakePoint - FourCornerDotCake.FC_NCR1632_NUM.getStart();
|
||||
lexer.numeratorBank[numeratorX / 512] = numeratorX % 512;
|
||||
int denominatorX = cakePoint - FourCornerDotCake.FC_NCR1632_DEN.getStart();
|
||||
lexer.denominatorBank[denominatorX / 512] = denominatorX % 512;
|
||||
|
||||
if (cakePoint > CAKEPOINT_BANK0_END) {
|
||||
missingSparkler = true;
|
||||
|
|
@ -650,10 +640,6 @@ public class FourCornerZionStenoLexer {
|
|||
|
||||
private boolean handleNCR(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
// NX01-NX08 are octals
|
||||
// DEN: NY01 = page MSB, NY02 = page LSB, NY03 = value MSB, NY04 = value CSB, NY05 = value LSB
|
||||
// NUM: NY06 = page MSB, NY07 = page LSB, NY08 = value MSB, NY09 = value CSB, NY10 = value LSB
|
||||
|
||||
if (cdcPoint == FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() || cdcPoint == FCDotCDC1604DashP6._RAKA_QUESTION.ordinal()) {
|
||||
lexer.decModeReset();
|
||||
return true; // eat salah and end mode
|
||||
|
|
@ -675,50 +661,52 @@ public class FourCornerZionStenoLexer {
|
|||
return false; // print char
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY01_AT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenPage = (octalValue << 3) + (lexer.cdcDECModeNCR68DenPage & 0b111);
|
||||
lexer.cdcDECModeNCR68NumPage = (octalValue << 3) + (lexer.cdcDECModeNCR68NumPage & 0b000111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenPage = (lexer.cdcDECModeNCR68DenPage & 0b111000) + octalValue;
|
||||
lexer.cdcDECModeNCR68NumPage = (octalValue << 0) + (lexer.cdcDECModeNCR68NumPage & 0b111000);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY03_BAR_V_LEFT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 6) + (lexer.cdcDECModeNCR68DenValue & 0b111111);
|
||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 6) + (lexer.cdcDECModeNCR68NumValue & 0b000111111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY04_BAR_UNDER.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 3) + (lexer.cdcDECModeNCR68DenValue & 0b111000111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY05_BAR_VERTICAL.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenValue = (lexer.cdcDECModeNCR68DenValue & 0b111111000) + octalValue;
|
||||
lexer.denominatorBank[lexer.cdcDECModeNCR68DenPage] = lexer.cdcDECModeNCR68DenValue;
|
||||
lexer.cdcDECModeNCR68DenPage = 0;
|
||||
lexer.cdcDECModeNCR68DenValue = 0;
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY06_PERCENT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumPage = (octalValue << 3) + (lexer.cdcDECModeNCR68NumPage & 0b111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY07_DOLLAR.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumPage = (lexer.cdcDECModeNCR68NumPage & 0b111000) + octalValue;
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY08_HASH.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 6) + (lexer.cdcDECModeNCR68NumValue & 0b111111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY09_EQUALS.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 3) + (lexer.cdcDECModeNCR68NumValue & 0b111000111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY10_CARET.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumValue = (lexer.cdcDECModeNCR68NumValue & 0b111111000) + octalValue;
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY05_BAR_VERTICAL.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 0) + (lexer.cdcDECModeNCR68NumValue & 0b111111000);
|
||||
lexer.numeratorBank[lexer.cdcDECModeNCR68NumPage] = lexer.cdcDECModeNCR68NumValue;
|
||||
lexer.cdcDECModeNCR68NumPage = 0;
|
||||
lexer.cdcDECModeNCR68NumValue = 0;
|
||||
lexer.ncrBankFire();
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY06_PERCENT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenPage = (octalValue << 3) + (lexer.cdcDECModeNCR68DenPage & 0b000111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY07_DOLLAR.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenPage = (octalValue << 0) + (lexer.cdcDECModeNCR68DenPage & 0b111000);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY08_HASH.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 6) + (lexer.cdcDECModeNCR68DenValue & 0b000111111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY09_EQUALS.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 3) + (lexer.cdcDECModeNCR68DenValue & 0b111000111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY10_CARET.ordinal()) {
|
||||
lexer.cdcDECModeNCR68DenValue = (octalValue << 0) + (lexer.cdcDECModeNCR68DenValue & 0b111111000);
|
||||
lexer.denominatorBank[lexer.cdcDECModeNCR68DenPage] = lexer.cdcDECModeNCR68DenValue;
|
||||
if (lexer.cdcDECModeNCR68DenPage == 0) {
|
||||
lexer.ncrBankFire();
|
||||
}
|
||||
lexer.cdcDECModeNCR68DenPage = 0;
|
||||
lexer.cdcDECModeNCR68DenValue = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -771,7 +759,7 @@ public class FourCornerZionStenoLexer {
|
|||
return true;
|
||||
}
|
||||
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() == cdcPoint) {
|
||||
if (!FourCornerRecipe.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||
if (!FourCornerZion7Petroglyphs.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||
lexer.smokeSignals.burnSandWalkerStepUnaligned(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
} else {
|
||||
lexer.handler.strobeSandWalker(rhythm);
|
||||
|
|
|
|||
|
|
@ -22,14 +22,6 @@
|
|||
*/
|
||||
package org.x4o.fc18;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
|
||||
/**
|
||||
* Tests FourCornerRecipe methods.
|
||||
*
|
||||
|
|
@ -38,73 +30,4 @@ import org.x4o.fc18.octal8.PrimordialOctal;
|
|||
*/
|
||||
public class FourCornerRecipeTest {
|
||||
|
||||
@Test
|
||||
public void testSandWalker() throws Exception {
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerRecipe.embedSandWalker(cdc, List.of(PrimordialOctal.PART_1));
|
||||
});
|
||||
List<PrimordialOctal> octalMine = new ArrayList<>();
|
||||
for (int i=0;i<24;i++) {
|
||||
octalMine.add(PrimordialOctal.PART_1);
|
||||
}
|
||||
FourCornerRecipe.embedSandWalker(cdc, octalMine);
|
||||
String res = FourCornerUnicodeDisplay.text().renderFromInt18(cdc);
|
||||
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRValues() throws Exception {
|
||||
List<Integer> cdcX06 = new ArrayList<>();
|
||||
List<Integer> cdcX18 = new ArrayList<>();
|
||||
BigInteger v1 = BigInteger.valueOf(123);
|
||||
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v1, BigInteger.ONE);
|
||||
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v1, BigInteger.ONE);
|
||||
BigInteger v2 = BigInteger.valueOf(12345);
|
||||
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v2, BigInteger.ONE);
|
||||
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v2, BigInteger.ONE);
|
||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX06);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX18);
|
||||
Assertions.assertEquals(resX18, resX06);
|
||||
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅", resX06);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRCount1024() throws Exception {
|
||||
List<Integer> cdcX06 = new ArrayList<>();
|
||||
List<Integer> cdcX18 = new ArrayList<>();
|
||||
for (int x = 1; x <= 1025; x++) {
|
||||
BigInteger v = BigInteger.valueOf(x);
|
||||
FourCornerRecipe.embedNCR1632FractionX06(cdcX06, v, BigInteger.ONE);
|
||||
FourCornerRecipe.embedNCR1632FractionX18(cdcX18, v, BigInteger.ONE);
|
||||
}
|
||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX06);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(cdcX18);
|
||||
Assertions.assertEquals(resX18, resX06);
|
||||
Assertions.assertTrue(resX06.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX06);
|
||||
Assertions.assertTrue(resX06.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX06);
|
||||
Assertions.assertTrue(resX06.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX06);
|
||||
Assertions.assertTrue(resX18.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX18);
|
||||
Assertions.assertTrue(resX18.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX18);
|
||||
Assertions.assertTrue(resX18.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRMaxValue() throws Exception {
|
||||
BigInteger maxValue = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
FourCornerRecipe.embedNCR1632FractionX06(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerRecipe.embedNCR1632FractionX06(maxValue.add(BigInteger.ONE), maxValue);
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerRecipe.embedNCR1632FractionX06(maxValue, maxValue.add(BigInteger.ONE));
|
||||
});
|
||||
FourCornerRecipe.embedNCR1632FractionX18(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerRecipe.embedNCR1632FractionX18(maxValue.add(BigInteger.ONE), maxValue);
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
FourCornerRecipe.embedNCR1632FractionX18(maxValue, maxValue.add(BigInteger.ONE));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
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.octal8.PrimordialOctal;
|
||||
|
||||
/**
|
||||
* Tests four corner grapher parts.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 24, 2025
|
||||
*/
|
||||
public class StenoGrapherTest {
|
||||
|
||||
@Test
|
||||
public void testSandWalker() throws Exception {
|
||||
List<Integer> out = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(out);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeSandWalker(List.of(PrimordialOctal.PART_1));
|
||||
});
|
||||
List<PrimordialOctal> octalMine = new ArrayList<>();
|
||||
for (int i=0;i<24;i++) {
|
||||
octalMine.add(PrimordialOctal.PART_1);
|
||||
}
|
||||
writerX06.strobeSandWalker(octalMine);
|
||||
String res = FourCornerUnicodeDisplay.text().renderFromInt18(out);
|
||||
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRValues() throws Exception {
|
||||
List<Integer> outX06 = new ArrayList<>();
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
BigInteger v1 = BigInteger.valueOf(123);
|
||||
writerX06.strobeNCR1632(BigInteger.ONE, v1);
|
||||
writerX18.strobeNCR1632(BigInteger.ONE, v1);
|
||||
BigInteger v2 = BigInteger.valueOf(12345);
|
||||
writerX06.strobeNCR1632(BigInteger.ONE, v2);
|
||||
writerX18.strobeNCR1632(BigInteger.ONE, v2);
|
||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals(resX18, resX06);
|
||||
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅", resX06);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRCount1024() throws Exception {
|
||||
List<Integer> outX06 = new ArrayList<>();
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
for (int x = 1; x <= 1025; x++) {
|
||||
BigInteger v = BigInteger.valueOf(x);
|
||||
writerX06.strobeNCR1632(BigInteger.ONE, v);
|
||||
writerX18.strobeNCR1632(BigInteger.ONE, v);
|
||||
}
|
||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals(resX18, resX06);
|
||||
Assertions.assertTrue(resX06.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX06);
|
||||
Assertions.assertTrue(resX06.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX06);
|
||||
Assertions.assertTrue(resX06.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX06);
|
||||
Assertions.assertTrue(resX18.startsWith("¹/₁¹/₂¹/₃"), "missing " + resX18);
|
||||
Assertions.assertTrue(resX18.contains("¹/₅₁₂¹/₅₁₃¹/₅₁₄"), "missing " + resX18);
|
||||
Assertions.assertTrue(resX18.endsWith("¹/₁₀₂₃¹/₁₀₂₄¹/₁₀₂₅"), "missing " + resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRMaxValue() throws Exception {
|
||||
List<Integer> outX06 = new ArrayList<>();
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(outX06);
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
BigInteger maxValue = new BigInteger("FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
writerX06.strobeNCR1632(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
||||
});
|
||||
writerX18.strobeNCR1632(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX18.strobeNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX18.strobeNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 4, 2025
|
||||
*/
|
||||
public class LexerInvalidTest {
|
||||
public class StenoLexerInvalidTest {
|
||||
|
||||
@Test
|
||||
public void testInvalid18Plus() throws Exception {
|
||||
|
|
@ -38,7 +38,7 @@ import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class LexerNCRTest {
|
||||
public class StenoLexerNCRTest {
|
||||
|
||||
@Test
|
||||
public void testNCRSmokeSignals() throws Exception {
|
||||
|
|
@ -61,17 +61,15 @@ public class LexerNCRTest {
|
|||
Assertions.assertEquals(2, smokeReader.pipeSmokeClouds);
|
||||
|
||||
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.cakePointSequence()); // the print above auto value + next test (normal bank reset)
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() - 1 + 11);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 11);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + (512*3) + 12);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*4) + 13);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*5) + 14);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart()); // and one which prints
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStop());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStop()); // embedded bank reset
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // normal NXX_123
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 123); // normal NXX_123
|
||||
smokeReader.reset();
|
||||
lexer.read(cdc);
|
||||
String res = "[0:1:burnNCR1632MissingBankSparkler]¹²³/₁₃₄₂₁₇₇₂₉[0:8:burnNCR1632MissingBankSparkler]⁴⁹³⁴⁷⁴⁵⁶²⁴⁴¹²¹⁷/₁₆₁₀₆₁₂₇₄₇²⁴⁶⁸⁴⁷³³⁴²⁸²⁷²⁷³⁷⁶⁷⁶⁷⁴¹⁵⁶⁰²⁰³³²⁸⁰⁶⁹¹⁶¹⁷⁰⁹³⁹⁸³¹⁸⁴⁹⁹⁸⁵³⁵⁵³⁹²³⁰⁹⁰¹⁶⁸⁶⁴⁶⁵⁷⁸⁵²¹³⁷⁴⁵⁶⁷²¹¹⁷²⁴⁹³⁷⁶⁸⁴⁰⁴²⁰³⁰⁴⁶⁶⁷³⁵²³⁶³⁴⁷⁴⁰¹²²⁰¹⁵⁶⁷²⁰⁴¹⁹⁴³⁹⁹⁴⁷⁴¹²⁰⁸³⁶⁵¹⁰⁵⁷⁸²⁹¹⁵¹⁷⁷⁰⁹⁷⁸²⁸²³⁰¹⁹⁶⁴⁹⁵⁴⁶⁸⁴⁶³³¹/₁";
|
||||
String res = "[0:1:burnNCR1632MissingBankSparkler][0:8:burnNCR1632MissingBankSparkler]¹³⁷⁴³⁸⁹⁵³⁵⁹⁴/₁₃₄₂₁₇₇₃₉[0:16:burnNCR1632MissingBankSparkler]";
|
||||
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
|
||||
|
|
@ -80,17 +78,23 @@ public class LexerNCRTest {
|
|||
List<Integer> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotCDC1604DashP6.NX24_X.ordinal()); // = X
|
||||
cdc.add(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 11); // NXX_011
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart()); // T001
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart()); // NXX_001
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() - 1 + 15); // T015
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 14); // NXX_014
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() - 1 + 1); // one
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 512 + 2); // T1024 + one
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // NXX_123
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 4); // NXX_004 (/1 as above 123 resets bank)
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 11);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 14);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 15);
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 123);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 512 + 2); // 1024
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1); // +1 = 1025
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 4);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
||||
cdc.add(FCDotCDC1604DashP6.NY14_SEMICOLON.ordinal());
|
||||
//cdc.add(FCDotCDC1604DashP6._NEWLINE.ordinal());
|
||||
|
||||
Assertions.assertEquals("X=¹¹/₁¹/₁¹⁴/₁₅¹²³/₁₀₂₅⁴/₁;", FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
|
|
@ -98,14 +102,14 @@ public class LexerNCRTest {
|
|||
@Test
|
||||
public void testNCRLargestF576() throws Exception {
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
for (int i = FourCornerDotCake.FC_NCR1632_DEN.getStop(); i >= FourCornerDotCake.FC_NCR1632_DEN.getStart(); i = i - 512) {
|
||||
cdc.add(i);
|
||||
}
|
||||
for (int i = FourCornerDotCake.FC_NCR1632_NUM.getStop(); i >= FourCornerDotCake.FC_NCR1632_NUM.getStart(); i = i - 512) {
|
||||
cdc.add(i);
|
||||
}
|
||||
String resSuper = "²⁴⁷³³⁰⁴⁰¹⁴⁷³¹⁰⁴⁵³⁴⁰⁶⁰⁵⁰²⁵²¹⁰¹⁹⁶⁴⁷¹⁹⁰⁰³⁵¹³¹³⁴⁹¹⁰¹²¹¹⁸³⁹⁹¹⁴⁰⁶³⁰⁵⁶⁰⁹²⁸⁹⁷²²⁵¹⁰⁶⁵³¹⁸⁶⁷¹⁷⁰³¹⁶⁴⁰¹⁰⁶¹²⁴³⁰⁴⁴⁹⁸⁹⁵⁹⁷⁶⁷¹⁴²⁶⁰¹⁶¹³⁹³³⁹³⁵¹³⁶⁵⁰³⁴³⁰⁶⁷⁵¹²⁰⁹⁹⁶⁷⁵⁴⁶¹⁵⁵¹⁰¹⁸⁹³¹⁶⁷⁹¹⁶⁶⁰⁶⁷⁷²¹⁴⁸⁶⁹⁹¹³⁶";
|
||||
String resSuber = "₂₄₇₃₃₀₄₀₁₄₇₃₁₀₄₅₃₄₀₆₀₅₀₂₅₂₁₀₁₉₆₄₇₁₉₀₀₃₅₁₃₁₃₄₉₁₀₁₂₁₁₈₃₉₉₁₄₀₆₃₀₅₆₀₉₂₈₉₇₂₂₅₁₀₆₅₃₁₈₆₇₁₇₀₃₁₆₄₀₁₀₆₁₂₄₃₀₄₄₉₈₉₅₉₇₆₇₁₄₂₆₀₁₆₁₃₉₃₃₉₃₅₁₃₆₅₀₃₄₃₀₆₇₅₁₂₀₉₉₆₇₅₄₆₁₅₅₁₀₁₈₉₃₁₆₇₉₁₆₆₀₆₇₇₂₁₄₈₆₉₉₁₃₆";
|
||||
for (int i = FourCornerDotCake.FC_NCR1632_DEN.getStop(); i >= FourCornerDotCake.FC_NCR1632_DEN.getStart(); i = i - 512) {
|
||||
cdc.add(i);
|
||||
}
|
||||
String resSuper = "²⁴⁷³³⁰⁴⁰¹⁴⁷³¹⁰⁴⁵³⁴⁰⁶⁰⁵⁰²⁵²¹⁰¹⁹⁶⁴⁷¹⁹⁰⁰³⁵¹³¹³⁴⁹¹⁰¹²¹¹⁸³⁹⁹¹⁴⁰⁶³⁰⁵⁶⁰⁹²⁸⁹⁷²²⁵¹⁰⁶⁵³¹⁸⁶⁷¹⁷⁰³¹⁶⁴⁰¹⁰⁶¹²⁴³⁰⁴⁴⁹⁸⁹⁵⁹⁷⁶⁷¹⁴²⁶⁰¹⁶¹³⁹³³⁹³⁵¹³⁶⁵⁰³⁴³⁰⁶⁷⁵¹²⁰⁹⁹⁶⁷⁵⁴⁶¹⁵⁵¹⁰¹⁸⁹³¹⁶⁷⁹¹⁶⁶⁰⁶⁷⁷²¹⁴⁸⁶⁹⁹¹³⁵";
|
||||
String resSuber = "₂₄₇₃₃₀₄₀₁₄₇₃₁₀₄₅₃₄₀₆₀₅₀₂₅₂₁₀₁₉₆₄₇₁₉₀₀₃₅₁₃₁₃₄₉₁₀₁₂₁₁₈₃₉₉₁₄₀₆₃₀₅₆₀₉₂₈₉₇₂₂₅₁₀₆₅₃₁₈₆₇₁₇₀₃₁₆₄₀₁₀₆₁₂₄₃₀₄₄₉₈₉₅₉₇₆₇₁₄₂₆₀₁₆₁₃₉₃₃₉₃₅₁₃₆₅₀₃₄₃₀₆₇₅₁₂₀₉₉₆₇₅₄₆₁₅₅₁₀₁₈₉₃₁₆₇₉₁₆₆₀₆₇₇₂₁₄₈₆₉₉₁₃₅";
|
||||
Assertions.assertEquals(resSuper + "/" + resSuber, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue