FC18: Made NCR zero based
This commit is contained in:
parent
355ac835be
commit
53a162d232
4 changed files with 148 additions and 170 deletions
|
|
@ -126,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,
|
||||
|
||||
|
|
|
|||
|
|
@ -78,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));
|
||||
|
|
@ -86,121 +87,99 @@ public class FourCornerZionStenoGrapher {
|
|||
|
||||
@Override
|
||||
public void strobeNCR1632(BigInteger numerator, BigInteger denominator) {
|
||||
if (denominator.equals(BigInteger.ZERO)) {
|
||||
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 (numerator.equals(BigInteger.ZERO)) { // TODO: rm this and make both zero based, 0/1 = zero
|
||||
throw new IllegalArgumentException("The numerator value ZERO is not allowed.");
|
||||
}
|
||||
//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(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||
}
|
||||
if (numerator.compareTo(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) { // fixme: this is still one off...
|
||||
if (numerator.compareTo(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) {
|
||||
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
||||
}
|
||||
BigInteger denominatorZero = denominator.subtract(BigInteger.ONE);
|
||||
BigInteger numeratorZero = numerator.subtract(BigInteger.ONE);
|
||||
if (denominator.compareTo(FourCornerZion7Petroglyphs.NCR1632_VALUE_MAX) > 0) {
|
||||
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||
}
|
||||
|
||||
if (isSixBit) {
|
||||
out.addAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence());
|
||||
if (denominatorZero.equals(BigInteger.ZERO)) {
|
||||
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());
|
||||
} else {
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = denominatorZero.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.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);
|
||||
}
|
||||
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(FourCornerZion7Petroglyphs.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);
|
||||
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;
|
||||
}
|
||||
|
||||
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(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 0) {
|
||||
continue;
|
||||
}
|
||||
int cakePoint = FourCornerDotCake.FC_NCR1632_DEN.getStart() + bankValue + (i * 512);
|
||||
out.add(cakePoint);
|
||||
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);
|
||||
}
|
||||
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(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (bankValue == 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -52,8 +51,8 @@ public class FourCornerZionStenoLexer {
|
|||
private final boolean handlerEscape;
|
||||
private final FourCornerZion7Candlelier handler;
|
||||
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;
|
||||
|
|
@ -66,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;
|
||||
|
||||
|
|
@ -190,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(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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,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 {
|
||||
|
|
@ -333,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());
|
||||
|
|
@ -344,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;
|
||||
|
|
@ -643,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
|
||||
|
|
@ -668,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,17 +61,15 @@ public class StenoLexerNCRTest {
|
|||
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 StenoLexerNCRTest {
|
|||
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 StenoLexerNCRTest {
|
|||
@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