FC18: Redone binary number encodings
This commit is contained in:
parent
46d305b5aa
commit
e790e89dd7
18 changed files with 1271 additions and 914 deletions
|
|
@ -56,7 +56,7 @@ public class FCDocPageWriterNCR implements MaisDocPageWriter, FCDocSegmentWriter
|
|||
public void writePageContent(MaisDocWriteEvent<MaisDocPage> e) throws IOException {
|
||||
MaisDocContentWriter writer = e.getWriter();
|
||||
try (ContentCloseable content = writer.docPageContent()) {
|
||||
try (ContentCloseable table = writer.docTable(FourCornerDotCake.FC_NCR1632_DEN.nameSpec().replaceAll("XD", "baklava"), null, MaisDocContentCss.overviewSummary)) {
|
||||
try (ContentCloseable table = writer.docTable(FourCornerDotCake.FC_NCR1632_BANK.nameSpec().replaceAll("BANK", "baklava"), null, MaisDocContentCss.overviewSummary)) {
|
||||
writeTableBoxHeaderNumeric(writer, 28);
|
||||
writePIN(writer);
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ public class FCDocPageWriterNCR implements MaisDocPageWriter, FCDocSegmentWriter
|
|||
continue;
|
||||
}
|
||||
List<Integer> piNum = new ArrayList<>();
|
||||
piNum.addAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence());
|
||||
//piNum.addAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence()); // TODO: use write for 18 bit NCR
|
||||
piNum.add(FCDotCDC1604DashP6.NX01_A.ordinal() + t);
|
||||
piNum.add(FCDotCDC1604DashP6.NX01_A.ordinal() + i);
|
||||
String char18Str = FourCornerUnicodeDisplay.text().renderFromInt18(piNum);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class FCDocSegmentWriterCake implements FCDocSegmentWriter {
|
|||
private static final String[] FC_FEATURES = new String[] {
|
||||
"Text format design to write computer code and abstract file/resource names",
|
||||
"Code from chinees child can be extended by indian child or spanish child in local local",
|
||||
"VT-06 terminal control for CDC1604(1960) 6 bit main frames",
|
||||
//"VT-06 terminal control for CDC1604(1960) 6 bit main frames",
|
||||
"Has underscored letters to migrate EBCDIC(1963) APL code from z/OS",
|
||||
"Program with (local) words not with lettersssss",
|
||||
"New Counting Rods, 1152 bit fractions with two 576 bit numbers",
|
||||
|
|
|
|||
|
|
@ -40,8 +40,10 @@ import org.x4o.fc18.cake2.pie9d.FCDotPIE9DDash09;
|
|||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
import org.x4o.fc18.zion7.FourCornerZion7Candlelier;
|
||||
import org.x4o.fc18.zion7.FourCornerZion7FremanBase8;
|
||||
import org.x4o.fc18.zion7.FourCornerZion7NumberGram;
|
||||
import org.x4o.fc18.zion7.FourCornerZion7SalahSequence;
|
||||
import org.x4o.fc18.zion7.FourCornerZion7FremanBase2;
|
||||
import org.x4o.fc18.zion7.FourCornerZionStenoLexer;
|
||||
import org.x4o.fc18.zion7.FourCornerZionStenoLexerSmoke;
|
||||
|
||||
|
|
@ -176,14 +178,7 @@ public class FourCornerUnicodeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeWords(List<Integer> cakePoints) {
|
||||
for (int i = 0; i < cakePoints.size(); i++) {
|
||||
strobeWord(cakePoints.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeWord(int cakePoint) {
|
||||
public void strobeTheWord(int cakePoint) {
|
||||
|
||||
// TODO: remove slice here;
|
||||
Optional<FourCornerDotCake> sliceOpt = FourCornerDotCake.valueFromCakePoint(cakePoint);
|
||||
|
|
@ -241,6 +236,50 @@ public class FourCornerUnicodeDisplay {
|
|||
output.append("#");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeTheWords(List<Integer> cakePoints) {
|
||||
for (int i = 0; i < cakePoints.size(); i++) {
|
||||
strobeTheWord(cakePoints.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberBASE2(FourCornerZion7FremanBase2 type, BigInteger value) {
|
||||
List<Integer> numberCandy = new ArrayList<>();
|
||||
//numberCandy.add(FCDotCDC1604DashP6.NX15_O.ordinal());
|
||||
//numberCandy.add(FCDotCDC1604DashP6.NX24_X.ordinal());
|
||||
//FourCornerRecipe.toDecimalsX18(numberCandy, type.bytes());
|
||||
//numberCandy.add(FCDotCDC1604DashP6.NY15_COLON.ordinal());
|
||||
FourCornerRecipe.toDecimalsX18(numberCandy, value);
|
||||
renderFromInt18(numberCandy, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberBASE8(FourCornerZion7FremanBase8 type, BigInteger value) {
|
||||
List<Integer> numberCandy = new ArrayList<>();
|
||||
//numberCandy.add(FCDotCDC1604DashP6.NX15_O.ordinal());
|
||||
//numberCandy.add(FCDotCDC1604DashP6.NX24_X.ordinal());
|
||||
//FourCornerRecipe.toDecimalsX18(numberCandy, type.octals());
|
||||
//numberCandy.add(FCDotCDC1604DashP6.NY15_COLON.ordinal());
|
||||
FourCornerRecipe.toDecimalsX18(numberCandy, value);
|
||||
renderFromInt18(numberCandy, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWorm(List<PrimordialOctal> sandWalk, List<PrimordialOctal> sandSpice) {
|
||||
// todo; select plugin for renderer
|
||||
sandWalk.forEach(v -> output.append(v.name()));
|
||||
sandSpice.forEach(v -> output.append(v.name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
Consumer<List<List<Integer>>> handler = escHandlers.get(type);
|
||||
if (handler != null) {
|
||||
handler.accept(arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberGrams(FourCornerZion7NumberGram gram, List<Integer> values) {
|
||||
// todo use external words
|
||||
|
|
@ -252,14 +291,16 @@ public class FourCornerUnicodeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberINT144(BigInteger value) {
|
||||
public void strobeNumberNCR1632(BigInteger numerator, BigInteger denominator) {
|
||||
List<Integer> numberCandy = new ArrayList<>();
|
||||
FourCornerRecipe.toDecimalsX18(numberCandy, value);
|
||||
FourCornerRecipe.toScriptSuperX18(numberCandy, numerator);
|
||||
numberCandy.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal());
|
||||
FourCornerRecipe.toScriptSubX18(numberCandy, denominator);
|
||||
renderFromInt18(numberCandy, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberDEC144(BigInteger coefficient, int exponent) {
|
||||
public void strobeNumberDEC576(BigInteger coefficient, BigInteger exponent) {
|
||||
List<Integer> numberCandy = new ArrayList<>();
|
||||
FourCornerRecipe.toDecimalsX18(numberCandy, coefficient);
|
||||
numberCandy.add(FCDotCDC1604DashP6.NY18_ASTERISK.ordinal());
|
||||
|
|
@ -270,7 +311,7 @@ public class FourCornerUnicodeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberFP144(boolean sign, int exponent, BigInteger significand) {
|
||||
public void strobeNumberE503M72(boolean sign, BigInteger exponent, BigInteger significand) {
|
||||
List<Integer> numberCandy = new ArrayList<>();
|
||||
numberCandy.add(FCDotCDC1604DashP6.NY25_ROUND_LEFT.ordinal());
|
||||
numberCandy.add(FCDotCDC1604DashP6.NY19_MINUS.ordinal());
|
||||
|
|
@ -288,26 +329,6 @@ public class FourCornerUnicodeDisplay {
|
|||
renderFromInt18(numberCandy, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberNCR1632(BigInteger numerator, BigInteger denominator) {
|
||||
List<Integer> math = new ArrayList<>();
|
||||
FourCornerRecipe.toScriptSuperX18(math, numerator);
|
||||
math.add(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal());
|
||||
FourCornerRecipe.toScriptSubX18(math, denominator);
|
||||
renderFromInt18(math, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||
// todo; select plugin for renderer
|
||||
rhythm.forEach(v -> output.append(v.name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWorm(List<PrimordialOctal> spice) {
|
||||
spice.forEach(v -> output.append(v.name()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void burnMonoPipe(int line, int col, String pipeError) {
|
||||
StringBuilder errBuf = new StringBuilder();
|
||||
|
|
@ -324,13 +345,5 @@ public class FourCornerUnicodeDisplay {
|
|||
output.append("]");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
Consumer<List<List<Integer>>> handler = escHandlers.get(type);
|
||||
if (handler != null) {
|
||||
handler.accept(arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,50 +308,149 @@ public enum FourCornerDotCake {
|
|||
FC_CLK1K_Y(131072 + (1024*24), 1024, FCDotCLK1KDashY.values()),
|
||||
FC_CLK1K_Z(131072 + (1024*25), 1024, FCDotCLK1KDashZ.values()),
|
||||
|
||||
// =========== Define digital numbers and document structures and sandworms
|
||||
// =========== Define digital document structures
|
||||
|
||||
/// Number signed 144 bit integer
|
||||
FC_NUM_INT144(0x026800, 384, "Number of 144 bit integer"),
|
||||
/// Number signed 144 bit base 10 decimal
|
||||
FC_NUM_DEC144(0x026980, 384, "Number of 144 bit base 10 decimal"),
|
||||
/// Number signed 144 bit base 2 float
|
||||
FC_NUM_FP144(0x026B00, 384, "Number of 144 bit base 2 float"),
|
||||
//FC_TXTBLK_64 <== LAST cake slice to have "external" defined words for display
|
||||
// - FC_F4TXT0001_SP
|
||||
// - commentTXT start + stop + comment to end of line ?
|
||||
// - commentDOC start + stop + anno ???
|
||||
// - decimal seperator (. or ,)
|
||||
// - number group seperator (_)
|
||||
// - number neg sign (-)
|
||||
// - ??? tag start (<) + tag (>) + etc for custom xdbx textual view with "external" words
|
||||
/// but char in CDC will also use CJK symbols, than we don't need this but only for;'
|
||||
// - etc so that adult mode can use pie-- letters, see SourceGlyph.java
|
||||
|
||||
// mmm move F4 flags here ? as SP is "external" but NL is not, (todo: add SP+NL white space display words)
|
||||
|
||||
/// Reserved Flag4 Structures
|
||||
__RESERVED_F4(0x026C80, 0x026DBE - 0x026C80, "Reserved for F4 structures"),
|
||||
__RESERVED_F4(0x026800, 0x026DBE - 0x026800, "Reserved for F4 structures"),
|
||||
|
||||
/// Tele Type Ytructure00 zero one Nether Line
|
||||
FC_F4TTY0001_NL(0x026DBE, 1, FCDotF4TTY0001DashNL.values(), "Flag4 TTY00 zero one Nether Line"),
|
||||
|
||||
/// Tele teXt Terminator zero one Spanish Peace
|
||||
/// The "normal" space, An undefined UWU points to here, as that is a custom space like tab space.
|
||||
/// See: https://www.ibm.com/docs/en/db2/11.5?topic=uce-code-page-coded-character-set-identifier-ccsid-numbers-unicode-graphic-data
|
||||
FC_F4TXT0001_SP(0x026DBF, 1, FCDotF4TXT0001DashSP.values(), "Flag4 TXT00 zero one Spanish Peace"),
|
||||
|
||||
__F4_FREE(0x026DC0, 0x02CC00 - 0x026DC0),
|
||||
|
||||
/// free
|
||||
__RESERVED_XDBX(0x026DC0, 64, "free"),
|
||||
__RESERVED_XDBX(0x02CC00, 512, "free"),
|
||||
//FC_XDBX0064_DOC(0x026DC0, 64, "Flag4 Doctype usage header flags."),
|
||||
|
||||
/// XML4 has fixed size limits to have stable complexity
|
||||
FC_XDBX0512_NS(0x026E00, 512, "XML4 StringID of Namespace"),
|
||||
FC_XDBX2048_ATTR(0x027000, 2048, "XML4 StringID of Attribute"),
|
||||
FC_XDBX2048_TAG(0x027800, 2048, "XML4 StringID of Element"),
|
||||
FC_XDBX0512_NS(0x02CE00, 512, "XML4 StringID of Namespace"),
|
||||
FC_XDBX2048_ATTR(0x02D000, 4096, "XML4 StringID of Attribute"),
|
||||
FC_XDBX2048_TAG(0x02E000, 4096, "XML4 StringID of Element"),
|
||||
|
||||
// =========== Allow big sand worms and sand dunes filled the freman
|
||||
|
||||
/// Sand walk steps for calling up a sand worm
|
||||
FC_SANDWALK_12(0x02F000, 4096, "Sand walk octals to call the olgoi khorkhoi"),
|
||||
/// Sand worm embedded 15 bit octal data stream
|
||||
/// To escape the question of undefined behavior, we define it as dark nether space, so we can see it in C++
|
||||
/// Undefined octal data which are packed big indian octals per 5, which is a 15 bit data gram in one 18 bit cake point.
|
||||
/// This can encode sand worm text data like icons, bitmap images or vector images and unicode4D/etc like HolyC of TempleOS.
|
||||
/// With the ESC_SAND_WALKER preamble the binary octal mime-type information must be send first.
|
||||
FC_SANDWORM_15(0x28000, 32768, "Sand octals of olgoi khorkhoi"),
|
||||
FC_SANDWORM_15(0x030000, 32768, "Sand octal spice of the olgoi khorkhoi"),
|
||||
|
||||
/// 16x256=4096+1020 cake points to embed base2 number types
|
||||
FC_BA2U0016_SEL0(0x038000, 2, "Embed number unsiged 16 bit select"),
|
||||
FC_BA2U0016_BANK(0x038002, 256, "Embed number unsiged 16 bit bank"),
|
||||
FC_BA2U0032_SEL0(0x038102, 4, "Embed number unsiged 32 bit select"),
|
||||
FC_BA2U0032_BANK(0x038106, 256, "Embed number unsiged 32 bit bank"),
|
||||
FC_BA2U0064_SEL0(0x038206, 8, "Embed number unsiged 64 bit select"),
|
||||
FC_BA2U0064_BANK(0x03820E, 256, "Embed number unsiged 64 bit bank"),
|
||||
FC_BA2U0128_SEL0(0x03830E, 16, "Embed number unsiged 128 bit select"),
|
||||
FC_BA2U0128_BANK(0x03831E, 256, "Embed number unsiged 128 bit bank"),
|
||||
FC_BA2U0256_SEL0(0x03841E, 32, "Embed number unsiged 256 bit select"),
|
||||
FC_BA2U0256_BANK(0x03843E, 256, "Embed number unsiged 256 bit bank"),
|
||||
FC_BA2U0512_SEL0(0x03853E, 64, "Embed number unsiged 512 bit select"),
|
||||
FC_BA2U0512_BANK(0x03857E, 256, "Embed number unsiged 512 bit bank"),
|
||||
FC_BA2U1024_SEL0(0x03867E, 128, "Embed number unsiged 1024 bit select"),
|
||||
FC_BA2U1024_BANK(0x0386FE, 256, "Embed number unsiged 1024 bit bank"),
|
||||
FC_BA2U2048_SEL0(0x0387FE, 256, "Embed number unsiged 2048 bit select"),
|
||||
FC_BA2U2048_BANK(0x0388FE, 256, "Embed number unsiged 2048 bit bank"),
|
||||
FC_BA2I0016_SEL0(0x0389FE, 2, "Embed number siged 16 bit select"),
|
||||
FC_BA2I0016_BANK(0x038A00, 256, "Embed number siged 16 bit bank"),
|
||||
FC_BA2I0032_SEL0(0x038B00, 4, "Embed number siged 32 bit select"),
|
||||
FC_BA2I0032_BANK(0x038B04, 256, "Embed number siged 32 bit bank"),
|
||||
FC_BA2I0064_SEL0(0x038C04, 8, "Embed number siged 64 bit select"),
|
||||
FC_BA2I0064_BANK(0x038C0C, 256, "Embed number siged 64 bit bank"),
|
||||
FC_BA2I0128_SEL0(0x038D0C, 16, "Embed number siged 128 bit select"),
|
||||
FC_BA2I0128_BANK(0x038D1C, 256, "Embed number siged 128 bit bank"),
|
||||
FC_BA2I0256_SEL0(0x038E1C, 32, "Embed number siged 256 bit select"),
|
||||
FC_BA2I0256_BANK(0x038E3C, 256, "Embed number siged 256 bit bank"),
|
||||
FC_BA2I0512_SEL0(0x038F3C, 64, "Embed number siged 512 bit select"),
|
||||
FC_BA2I0512_BANK(0x038F7C, 256, "Embed number siged 512 bit bank"),
|
||||
FC_BA2I1024_SEL0(0x03907C, 128, "Embed number siged 1024 bit select"),
|
||||
FC_BA2I1024_BANK(0x0390FC, 256, "Embed number siged 1024 bit bank"),
|
||||
FC_BA2I2048_SEL0(0x0391FC, 256, "Embed number siged 2048 bit select"),
|
||||
FC_BA2I2048_BANK(0x0392FC, 256, "Embed number siged 2048 bit bank"),
|
||||
|
||||
/// 16x512=8192+1020 cake points to embed base8 number types
|
||||
FC_BA8U0018_SEL0(0x0393FC, 2, "Embed number unsiged 18 bit select"),
|
||||
FC_BA8U0018_BANK(0x0393FE, 512, "Embed number unsiged 18 bit bank"),
|
||||
FC_BA8U0036_SEL0(0x0395FE, 4, "Embed number unsiged 36 bit select"),
|
||||
FC_BA8U0036_BANK(0x039602, 512, "Embed number unsiged 36 bit bank"),
|
||||
FC_BA8U0072_SEL0(0x039802, 8, "Embed number unsiged 72 bit select"),
|
||||
FC_BA8U0072_BANK(0x03980A, 512, "Embed number unsiged 72 bit bank"),
|
||||
FC_BA8U0144_SEL0(0x039A0A, 16, "Embed number unsiged 144 bit select"),
|
||||
FC_BA8U0144_BANK(0x039A1A, 512, "Embed number unsiged 144 bit bank"),
|
||||
FC_BA8U0288_SEL0(0x039C1A, 32, "Embed number unsiged 288 bit select"),
|
||||
FC_BA8U0288_BANK(0x039C3A, 512, "Embed number unsiged 288 bit bank"),
|
||||
FC_BA8U0576_SEL0(0x039E3A, 64, "Embed number unsiged 576 bit select"),
|
||||
FC_BA8U0576_BANK(0x039E7A, 512, "Embed number unsiged 576 bit bank"),
|
||||
FC_BA8U1152_SEL0(0x03A07A, 128, "Embed number unsiged 1152 bit select"),
|
||||
FC_BA8U1152_BANK(0x03A0FA, 512, "Embed number unsiged 1152 bit bank"),
|
||||
FC_BA8U2304_SEL0(0x03A2FA, 256, "Embed number unsiged 2304 bit select"),
|
||||
FC_BA8U2304_BANK(0x03A3FA, 512, "Embed number unsiged 2304 bit bank"),
|
||||
FC_BA8I0018_SEL0(0x03A5FA, 2, "Embed number siged 18 bit select"),
|
||||
FC_BA8I0018_BANK(0x03A5FC, 512, "Embed number siged 18 bit bank"),
|
||||
FC_BA8I0036_SEL0(0x03A7FC, 4, "Embed number siged 36 bit select"),
|
||||
FC_BA8I0036_BANK(0x03A800, 512, "Embed number siged 36 bit bank"),
|
||||
FC_BA8I0072_SEL0(0x03AA00, 8, "Embed number siged 72 bit select"),
|
||||
FC_BA8I0072_BANK(0x03AA08, 512, "Embed number siged 72 bit bank"),
|
||||
FC_BA8I0144_SEL0(0x03AC08, 16, "Embed number siged 144 bit select"),
|
||||
FC_BA8I0144_BANK(0x03AC18, 512, "Embed number siged 144 bit bank"),
|
||||
FC_BA8I0288_SEL0(0x03AE18, 32, "Embed number siged 288 bit select"),
|
||||
FC_BA8I0288_BANK(0x03AE38, 512, "Embed number siged 288 bit bank"),
|
||||
FC_BA8I0576_SEL0(0x03B038, 64, "Embed number siged 576 bit select"),
|
||||
FC_BA8I0576_BANK(0x03B078, 512, "Embed number siged 576 bit bank"),
|
||||
FC_BA8I1152_SEL0(0x03B278, 128, "Embed number siged 1152 bit select"),
|
||||
FC_BA8I1152_BANK(0x03B2F8, 512, "Embed number siged 1152 bit bank"),
|
||||
FC_BA8I2304_SEL0(0x03B4F8, 256, "Embed number siged 2304 bit select"),
|
||||
FC_BA8I2304_BANK(0x03B5F8, 512, "Embed number siged 2304 bit bank"),
|
||||
|
||||
// =========== Allow big terminators to learn a computer math
|
||||
|
||||
/// New Counting Rods, Select an 9 bit denominator to use.
|
||||
/// Divided in 64 nine bit banks, to select up to 576 bit denominator.
|
||||
FC_NCR1632_DEN(0x30000, 32768, "New Counting Rods Denominator"),
|
||||
/// New Counting Rods, Use one or more 9 bit numerator values.
|
||||
/// Divided in 64 nine bit banks, to select up to 576 bit numerator.
|
||||
/// NOTE: Every lowest (512) numerator trigger a fraction.
|
||||
FC_NCR1632_NUM(0x38000, 32768, "New Counting Rods Numerator"),
|
||||
/// New Counting Rods, Select one of 48 numerator pages to use.
|
||||
FC_NCR1632_SEL0N(0x03B7F8, 48, "New Counting Rods Numerator Select"),
|
||||
/// New Counting Rods, Select one of 48 denominator pages to use.
|
||||
FC_NCR1632_SEL1D(0x03B828, 48, "New Counting Rods Denominator Select"),
|
||||
/// New Counting Rods fractions of two 576 bit numbers
|
||||
/// Divided in 48 paged banks of 12 bit
|
||||
FC_NCR1632_BANK(0x03B858, 4096, "New Counting Rods Page octals"),
|
||||
|
||||
/// Number signed 576 bit base 10 decimal select
|
||||
FC_DEC576_SEL0(0x03C858, 48, "Number of 576 bit base 10 decimal select"),
|
||||
/// Number signed 576 bit base 10 decimal
|
||||
FC_DEC576_BANK(0x03C888, 4096, "Number of 576 bit base 10 decimal octals"),
|
||||
|
||||
/// Number signed 576 bit base 2 float select
|
||||
FC_E503M72_SEL0(0x03D888, 48, "Number of 576 bit base 10 decimal select"),
|
||||
/// Number signed 576 bit base 2 float
|
||||
FC_E503M72_BANK(0x03D8B8, 4096, "Number of 576 bit base 10 decimal octals"),
|
||||
|
||||
|
||||
|
||||
__RESERVED_FREE(0x03E8B8, 0x3F000 - 0x03E8B8),
|
||||
|
||||
__RESERVED_ESC(0x03F000, 4096),
|
||||
|
||||
// // 4096
|
||||
//FC_DEC2701_PX0
|
||||
;
|
||||
private static final FourCornerDotCake[] VALUES = values();
|
||||
private final int start;
|
||||
|
|
@ -436,6 +535,9 @@ public enum FourCornerDotCake {
|
|||
|
||||
public boolean isExternWord() {
|
||||
int idx = ordinal();
|
||||
if (idx == FC_F4TXT0001_SP.ordinal()) {
|
||||
return true;
|
||||
}
|
||||
if (idx <= FC_PIE9D_27.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,14 +70,12 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
|||
|
||||
/// _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)
|
||||
/// * FC6 pure mainframe mode + VT06
|
||||
/// * FC6+ has candy
|
||||
/// * FC18 Candlelier
|
||||
/// * FC18 Candlelier adult mode (zero FC6+)
|
||||
/// * FC18 TempleScrolls
|
||||
/// * FC18 TempleScrolls adult mode (zero FC6+)
|
||||
//ESC_PROLOG_DOCTYPE
|
||||
__ESC_RESERVED_A9,
|
||||
|
||||
|
|
@ -124,12 +122,7 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
|||
ESC68_INC0801_P8,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X3 _ESC6_X2 = 17
|
||||
/// Select packed new counting rods fraction for 6 and 8 bit systems.
|
||||
/// NX01-NX08 are octal values
|
||||
/// 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,
|
||||
__ESC_RESERVED_B8,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X3 _ESC6_X3 = 18
|
||||
__ESC_RESERVED_B9,
|
||||
|
|
@ -153,8 +146,7 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
|||
__ESC_RESERVED_C5,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X2 _ESC6_X3 = 24
|
||||
/// Command for octal mime-type information sequence of sand walker.
|
||||
ESC_SAND_WALKER,
|
||||
__ESC_RESERVED_C6,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X3 _ESC6_X1 = 25
|
||||
/// Command for embedded octal sand worm for 6 or 8 bit systems.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
|
||||
/// Handles the main four corner cake strobes.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 09, 2025
|
||||
public interface FourCornerZion7Bereshit extends FourCornerZion7AlphaOmega {
|
||||
|
||||
/// Single word cake point.
|
||||
void strobeTheWord(int cakePoint);
|
||||
|
||||
/// Block of word cake points.
|
||||
void strobeTheWords(List<Integer> cakePoints);
|
||||
|
||||
//void strobeStructSpacePastor(); // DOC: esc seq, in 6 bit display char-ROM use ZERO for space, as _NUL is not a candy letter but a control data character string terminator code.
|
||||
//void strobeStructNunLine();
|
||||
|
||||
/// Embed a retro computer number.
|
||||
void strobeNumberBASE2(FourCornerZion7FremanBase2 type, BigInteger value);
|
||||
|
||||
/// Embed a dune of octals sand.
|
||||
void strobeNumberBASE8(FourCornerZion7FremanBase8 type, BigInteger value);
|
||||
|
||||
/// Embed sand spice using a sand walk to call the identified great sand worm which leaves the spice in the sand.
|
||||
void strobeSandWorm(List<PrimordialOctal> sandWalk, List<PrimordialOctal> sandSpice);
|
||||
|
||||
/// The external supported salah sequence strobes.
|
||||
void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments);
|
||||
|
||||
interface Adapter extends FourCornerZion7Bereshit, FourCornerZion7AlphaOmega.Adapter {
|
||||
|
||||
@Override
|
||||
default void strobeTheWord(int cakePoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeTheWords(List<Integer> cakePoints) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeNumberBASE2(FourCornerZion7FremanBase2 type, BigInteger value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeNumberBASE8(FourCornerZion7FremanBase8 type, BigInteger value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeSandWorm(List<PrimordialOctal> sandWalk, List<PrimordialOctal> sandSpice) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,84 +25,43 @@ package org.x4o.fc18.zion7;
|
|||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.octal8.PrimordialOctal;
|
||||
|
||||
/// Handles the main lexer four corner cake strobes.
|
||||
/// Handles the big numbers in four corner cake strobes.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 09, 2025
|
||||
public interface FourCornerZion7Candlelier extends FourCornerZion7AlphaOmega {
|
||||
|
||||
/// Single word cake point.
|
||||
void strobeWord(int cakePoint);
|
||||
|
||||
/// Block of word cake points.
|
||||
void strobeWords(List<Integer> cakePoints);
|
||||
public interface FourCornerZion7Candlelier extends FourCornerZion7Bereshit {
|
||||
|
||||
/// Block of one of more number grams of given base.
|
||||
void strobeNumberGrams(FourCornerZion7NumberGram gram, List<Integer> values);
|
||||
|
||||
/// Embedded signed integer up to 144 bit.
|
||||
void strobeNumberINT144(BigInteger value);
|
||||
|
||||
/// Embedded signed decimal up to 144 bit. (s126+s18)
|
||||
void strobeNumberDEC144(BigInteger coefficient, int exponent);
|
||||
|
||||
/// Embedded signed float up to 144 bit. (u1+u17+u126)
|
||||
void strobeNumberFP144(boolean sign, int exponent, BigInteger significand);
|
||||
|
||||
/// Embedded signed fractions up to 1152 bit of two 576 bit numbers.
|
||||
void strobeNumberNCR1632(BigInteger numerator, BigInteger denominator);
|
||||
|
||||
/// Embedded sand walker, with an 72 to 576 bit mime-type rhythm header.
|
||||
void strobeSandWalker(List<PrimordialOctal> rhythm);
|
||||
/// Embedded signed decimal up to 576 bit. (s504+s72)
|
||||
void strobeNumberDEC576(BigInteger coefficient, BigInteger exponent);
|
||||
|
||||
/// Embedded sand worm spice.
|
||||
void strobeSandWorm(List<PrimordialOctal> spice);
|
||||
/// Embedded E503M72 floating point number. (s+u503+u72)
|
||||
void strobeNumberE503M72(boolean negative, BigInteger exponent, BigInteger significand);
|
||||
|
||||
/// The external supported salah sequence strobes.
|
||||
void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments);
|
||||
//void strobeStructBlockRemark(boolean beginOrEnd, boolean textOrDoc);
|
||||
//void strobeStruct...(...);
|
||||
|
||||
interface Adapter extends FourCornerZion7Candlelier, FourCornerZion7AlphaOmega.Adapter {
|
||||
|
||||
@Override
|
||||
default void strobeWord(int cakePoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeWords(List<Integer> cakePoints) {
|
||||
}
|
||||
interface Adapter extends FourCornerZion7Candlelier, FourCornerZion7Bereshit.Adapter {
|
||||
|
||||
@Override
|
||||
default void strobeNumberGrams(FourCornerZion7NumberGram gram, List<Integer> values) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeNumberINT144(BigInteger value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeNumberDEC144(BigInteger coefficient, int exponent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeNumberFP144(boolean sign, int exponent, BigInteger significand) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeNumberNCR1632(BigInteger numerator, BigInteger denominator) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||
default void strobeNumberDEC576(BigInteger coefficient, BigInteger exponent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeSandWorm(List<PrimordialOctal> spice) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
default void strobeNumberE503M72(boolean sign, BigInteger exponent, BigInteger significand) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/// The supported sand man bait marks.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Aug 30, 2025
|
||||
public enum FourCornerZion7FremanBase2 {
|
||||
|
||||
UNSIGNED_0016(2, FourCornerDotCake.FC_BA2U0016_BANK),
|
||||
UNSIGNED_0032(4, FourCornerDotCake.FC_BA2U0032_BANK),
|
||||
UNSIGNED_0064(8, FourCornerDotCake.FC_BA2U0064_BANK),
|
||||
UNSIGNED_0128(16, FourCornerDotCake.FC_BA2U0128_BANK),
|
||||
UNSIGNED_0256(32, FourCornerDotCake.FC_BA2U0256_BANK),
|
||||
UNSIGNED_0512(64, FourCornerDotCake.FC_BA2U0512_BANK),
|
||||
UNSIGNED_1024(128, FourCornerDotCake.FC_BA2U1024_BANK),
|
||||
UNSIGNED_2048(256, FourCornerDotCake.FC_BA2U2048_BANK),
|
||||
|
||||
SIGNED_0016(2, FourCornerDotCake.FC_BA2I0016_BANK),
|
||||
SIGNED_0032(4, FourCornerDotCake.FC_BA2I0032_BANK),
|
||||
SIGNED_0064(8, FourCornerDotCake.FC_BA2I0064_BANK),
|
||||
SIGNED_0128(16, FourCornerDotCake.FC_BA2I0128_BANK),
|
||||
SIGNED_0256(32, FourCornerDotCake.FC_BA2I0256_BANK),
|
||||
SIGNED_0512(64, FourCornerDotCake.FC_BA2I0512_BANK),
|
||||
SIGNED_1024(128, FourCornerDotCake.FC_BA2I1024_BANK),
|
||||
SIGNED_2048(256, FourCornerDotCake.FC_BA2I2048_BANK),
|
||||
;
|
||||
private static final FourCornerZion7FremanBase2[] VALUES = values();
|
||||
private final int cakeOffsetSel0;
|
||||
private final int cakeOffsetBank;
|
||||
private final int bytes;
|
||||
|
||||
private FourCornerZion7FremanBase2(int bytes, FourCornerDotCake cakeSlice) {
|
||||
this.bytes = bytes;
|
||||
this.cakeOffsetSel0 = cakeSlice.getStart() - bytes;
|
||||
this.cakeOffsetBank = cakeSlice.getStart();
|
||||
}
|
||||
|
||||
public int cakeOffsetSel0() {
|
||||
return cakeOffsetSel0;
|
||||
}
|
||||
|
||||
public int cakeOffsetBank() {
|
||||
return cakeOffsetBank;
|
||||
}
|
||||
|
||||
public int bytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public boolean isSigned() {
|
||||
return ordinal() >= SIGNED_0016.ordinal();
|
||||
}
|
||||
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FourCornerZion7FremanBase2 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;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/// The supported sand dune formations.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Aug 28, 2025
|
||||
public enum FourCornerZion7FremanBase8 {
|
||||
|
||||
UNSIGNED_0018(6, FourCornerDotCake.FC_BA8U0018_BANK),
|
||||
UNSIGNED_0036(12, FourCornerDotCake.FC_BA8U0036_BANK),
|
||||
UNSIGNED_0072(24, FourCornerDotCake.FC_BA8U0072_BANK),
|
||||
UNSIGNED_0144(48, FourCornerDotCake.FC_BA8U0144_BANK),
|
||||
UNSIGNED_0288(96, FourCornerDotCake.FC_BA8U0288_BANK),
|
||||
UNSIGNED_0576(192, FourCornerDotCake.FC_BA8U0576_BANK),
|
||||
UNSIGNED_1152(384, FourCornerDotCake.FC_BA8U1152_BANK),
|
||||
UNSIGNED_2304(768, FourCornerDotCake.FC_BA8U2304_BANK),
|
||||
|
||||
SIGNED_0018(6, FourCornerDotCake.FC_BA8I0018_BANK),
|
||||
SIGNED_0036(12, FourCornerDotCake.FC_BA8I0036_BANK),
|
||||
SIGNED_0072(24, FourCornerDotCake.FC_BA8I0072_BANK),
|
||||
SIGNED_0144(48, FourCornerDotCake.FC_BA8I0144_BANK),
|
||||
SIGNED_0288(96, FourCornerDotCake.FC_BA8I0288_BANK),
|
||||
SIGNED_0576(192, FourCornerDotCake.FC_BA8I0576_BANK),
|
||||
SIGNED_1152(384, FourCornerDotCake.FC_BA8I1152_BANK),
|
||||
SIGNED_2304(768, FourCornerDotCake.FC_BA8I2304_BANK),
|
||||
;
|
||||
private static final FourCornerZion7FremanBase8[] VALUES = values();
|
||||
private final int cakeOffsetSel0;
|
||||
private final int cakeOffsetBank;
|
||||
private final int octals;
|
||||
|
||||
private FourCornerZion7FremanBase8(int octals, FourCornerDotCake cakeSlice) {
|
||||
this.octals = octals;
|
||||
this.cakeOffsetSel0 = cakeSlice.getStart() - (octals/3);
|
||||
this.cakeOffsetBank = cakeSlice.getStart();
|
||||
}
|
||||
|
||||
public int cakeOffsetSel0() {
|
||||
return cakeOffsetSel0;
|
||||
}
|
||||
|
||||
public int cakeOffsetBank() {
|
||||
return cakeOffsetBank;
|
||||
}
|
||||
|
||||
public int octals() {
|
||||
return octals;
|
||||
}
|
||||
|
||||
public boolean isSigned() {
|
||||
return ordinal() >= SIGNED_0018.ordinal();
|
||||
}
|
||||
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FourCornerZion7FremanBase8 valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
@ -31,18 +31,20 @@ import java.util.List;
|
|||
/// @version 1.0 Aug 24, 2025
|
||||
public final class FourCornerZion7Petroglyphs {
|
||||
|
||||
public static final int OCTAL_MASK_INT = 0b111;
|
||||
public static final BigInteger OCTAL_MASK_BIG = BigInteger.valueOf(OCTAL_MASK_INT);
|
||||
public static final BigInteger MASK_BITS_3 = new BigInteger("7", 16);
|
||||
public static final BigInteger MASK_BITS_8 = new BigInteger("FF", 16);
|
||||
public static final BigInteger MASK_BITS_9 = new BigInteger("1FF", 16);
|
||||
public static final BigInteger MASK_BITS_12 = new BigInteger("FFF", 16);
|
||||
|
||||
public static final BigInteger INT144_VALUE_MAX = new BigInteger("7FFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
public static final BigInteger DEC144_COEFFICIENT_MAX = new BigInteger("3FFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFF", 16);
|
||||
public static final int DEC144_EXPONENT_MAX = 0x1FFFF;
|
||||
public static final BigInteger FP144_SIGNIFICAND_MAX = DEC144_COEFFICIENT_MAX;
|
||||
public static final int FP144_EXPONENT_MAX = 0x1FFFF;
|
||||
public static final BigInteger INT576_SIGNED_MAX = new BigInteger("7FFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
|
||||
public static final BigInteger NCR1632_MASK_PAGE = BigInteger.valueOf(0x1FF);
|
||||
public static final BigInteger NCR1632_VALUE_MAX = new BigInteger("7FFFFFFFFFFFFFFFFF"+"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);
|
||||
public static final BigInteger DEC576_COEFFICIENT_MAX = new BigInteger("7FFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
public static final BigInteger DEC576_EXPONENT_MAX = new BigInteger("7FFFFFFFFFFFFFFFFF", 16);
|
||||
|
||||
public static final BigInteger E503M72_SIGNIFICAND_MAX = new BigInteger("3FFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
public static final BigInteger E503M72_EXPONENT_MAX = new BigInteger("FFFFFFFFFFFFFFFFFF", 16);
|
||||
|
||||
public static final List<Integer> SAND_WORM_SIGNS = List.of(24,48,72,96,120,144,168,192);
|
||||
|
||||
private FourCornerZion7Petroglyphs() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public interface FourCornerZion7TempleScrolls extends FourCornerZion7Candlelier
|
|||
STRING_ID(FCDotCDC1604DashP6.NX09_I),
|
||||
*/
|
||||
/*
|
||||
|
||||
void strobeDocumentStart();
|
||||
|
||||
void strobeDocumentEnd();
|
||||
|
|
|
|||
|
|
@ -45,14 +45,43 @@ import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
|||
/// @version 1.0 Jan 11, 2025
|
||||
public class FourCornerZionStenoGrapher {
|
||||
|
||||
static public FourCornerZion7Candlelier writerX06(List<Integer> out) {
|
||||
static public FourCornerZion7Bereshit writerX06(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, true);
|
||||
}
|
||||
|
||||
static public FourCornerZion7TempleScrolls writerX18(List<Integer> out) {
|
||||
static public FourCornerZion7Candlelier writerX18(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, false);
|
||||
}
|
||||
|
||||
static public FourCornerZion7TempleScrolls writerXDBX18(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, false);
|
||||
}
|
||||
/*
|
||||
static public FourCornerZion7Bereshit writerFC6(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, true);
|
||||
}
|
||||
|
||||
static public FourCornerZion7Bereshit writerFC6Plus(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, true);
|
||||
}
|
||||
|
||||
static public FourCornerZion7Candlelier writerFC18(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, false);
|
||||
}
|
||||
|
||||
static public FourCornerZion7Candlelier writerFC18Adult(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, false);
|
||||
}
|
||||
|
||||
static public FourCornerZion7TempleScrolls writerXDBX18(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, false);
|
||||
}
|
||||
|
||||
static public FourCornerZion7TempleScrolls writerXDBX18Adult(List<Integer> out) {
|
||||
return new FourCornerWriter(v -> out.add(v), () -> {}, false);
|
||||
}s
|
||||
*/
|
||||
|
||||
/*
|
||||
static public FourCornerZion7TempleScrolls writerX18PackedX8(OutputStream out) {
|
||||
class FourCornerPackedX8Encoder implements IntConsumer, Runnable {
|
||||
|
|
@ -119,7 +148,7 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeWord(int cakePoint) {
|
||||
public void strobeTheWord(int cakePoint) {
|
||||
if (isSixBit && cakePoint > 63) {
|
||||
throw new IllegalArgumentException("Cake point is larger than baklave point limit: 0x" + Integer.toHexString(cakePoint));
|
||||
}
|
||||
|
|
@ -130,302 +159,122 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeWords(List<Integer> cakePoints) {
|
||||
public void strobeTheWords(List<Integer> cakePoints) {
|
||||
Objects.requireNonNull(cakePoints);
|
||||
int cakeSize = cakePoints.size();
|
||||
for (int i = 0; i < cakeSize; i++) {
|
||||
strobeWord(cakePoints.get(i));
|
||||
strobeTheWord(cakePoints.get(i));
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberGrams(FourCornerZion7NumberGram gram, List<Integer> values) {
|
||||
Objects.requireNonNull(gram);
|
||||
Objects.requireNonNull(values);
|
||||
if (isSixBit) {
|
||||
// TODO
|
||||
}
|
||||
int gramCount = values.size();
|
||||
for (int i = 0; i < gramCount; i++) {
|
||||
int gramValue = values.get(i);
|
||||
if (gramValue < 0) {
|
||||
throw new IllegalArgumentException("Gram value is smaller than zero");
|
||||
}
|
||||
if (gramValue > gram.cutCount()) {
|
||||
throw new IllegalArgumentException("Gram value is greater than cut count: " + gram.cutCount());
|
||||
}
|
||||
outAdd(gram.cutZeroCakePoint() + gramValue);
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberINT144(BigInteger value) {
|
||||
public void strobeNumberBASE2(FourCornerZion7FremanBase2 type, BigInteger value) {
|
||||
Objects.requireNonNull(type);
|
||||
Objects.requireNonNull(value);
|
||||
if (value.compareTo(FourCornerZion7Petroglyphs.INT144_VALUE_MAX) > 0) {
|
||||
throw new IllegalArgumentException("INT144 value is larger than 144 bit: " + value);
|
||||
}
|
||||
BigInteger valuePos = value;
|
||||
boolean negative = false;
|
||||
if (value.signum() == -1) {
|
||||
valuePos = value.negate();
|
||||
negative = true;
|
||||
}
|
||||
for (int i = 47; i >= 0; i--) {
|
||||
int bankValue = valuePos.shiftRight(i * 3).and(FourCornerZion7Petroglyphs.OCTAL_MASK_BIG).intValue();
|
||||
if (i == 47 && negative) {
|
||||
bankValue = (bankValue & 0b011) + 4;
|
||||
if (type.isSigned() == false && negative) {
|
||||
throw new IllegalArgumentException("Unsiged value can't be negative: " + value);
|
||||
}
|
||||
boolean strobePage = true;
|
||||
int bankStart = type.bytes() - 1;
|
||||
for (int i = bankStart; i >= 0; i--) {
|
||||
int bankValue = valuePos.shiftRight(i * 8).and(FourCornerZion7Petroglyphs.MASK_BITS_8).intValue();
|
||||
if (i == bankStart && negative) {
|
||||
bankValue = (bankValue & 0x7F) + 0x80;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
strobePage = true;
|
||||
continue;
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NUM_INT144.getStart() + bankValue + (i * 8));
|
||||
if (strobePage) {
|
||||
strobePage = false;
|
||||
outAdd(type.cakeOffsetSel0() + i);
|
||||
}
|
||||
//TODO if (isSixBit) {
|
||||
outAdd(type.cakeOffsetBank() + bankValue);
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberDEC144(BigInteger coefficient, int exponent) {
|
||||
Objects.requireNonNull(coefficient);
|
||||
if (coefficient.compareTo(FourCornerZion7Petroglyphs.DEC144_COEFFICIENT_MAX) > 0) {
|
||||
throw new IllegalArgumentException("DEC144 coefficient is larger than 126 bit: " + coefficient);
|
||||
}
|
||||
if (exponent > FourCornerZion7Petroglyphs.DEC144_EXPONENT_MAX) {
|
||||
throw new IllegalArgumentException("DEC144 exponent is larger than 17 bit: " + exponent);
|
||||
}
|
||||
BigInteger valuePos = coefficient;
|
||||
public void strobeNumberBASE8(FourCornerZion7FremanBase8 type, BigInteger value) {
|
||||
Objects.requireNonNull(type);
|
||||
Objects.requireNonNull(value);
|
||||
BigInteger valuePos = value;
|
||||
boolean negative = false;
|
||||
if (coefficient.signum() == -1) {
|
||||
valuePos = coefficient.negate();
|
||||
if (value.signum() == -1) {
|
||||
valuePos = value.negate();
|
||||
negative = true;
|
||||
}
|
||||
for (int i = 47; i >= 6; i--) {
|
||||
int bankValue = valuePos.shiftRight((i-6) * 3).and(FourCornerZion7Petroglyphs.OCTAL_MASK_BIG).intValue();
|
||||
if (i == 47 /*&& negative*/) {
|
||||
bankValue = (bankValue & 0b011) + (negative?4:0); // TODO check if max value....
|
||||
}
|
||||
if (bankValue == 0) {
|
||||
continue;
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NUM_DEC144.getStart() + bankValue + (i * 8));
|
||||
if (type.isSigned() == false && negative) {
|
||||
throw new IllegalArgumentException("Unsiged value can't be negative: " + value);
|
||||
}
|
||||
int exponentPos = exponent;
|
||||
negative = exponent < 0;
|
||||
if (negative) {
|
||||
exponentPos = 0 - exponent;
|
||||
}
|
||||
for (int i = 5; i >= 0; i--) {
|
||||
int bankValue = (exponentPos >> (i * 3)) & FourCornerZion7Petroglyphs.OCTAL_MASK_INT;
|
||||
if (i == 5 && negative) {
|
||||
bankValue = (bankValue & 0b011) + 4;
|
||||
boolean strobePage = true;
|
||||
int bankStart = type.octals()/3 - 1;
|
||||
for (int i = bankStart; i >= 0; i--) {
|
||||
int bankValue = valuePos.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.MASK_BITS_9).intValue();
|
||||
if (i == bankStart && negative) {
|
||||
bankValue = (bankValue & 0xFF) + 0x100;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
strobePage = true;
|
||||
continue;
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NUM_DEC144.getStart() + bankValue + (i * 8));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberFP144(boolean sign, int exponent, BigInteger significand) {
|
||||
Objects.requireNonNull(significand);
|
||||
if (significand.compareTo(FourCornerZion7Petroglyphs.FP144_SIGNIFICAND_MAX) > 0) {
|
||||
throw new IllegalArgumentException("FP144 significand is larger than 126 bit: " + significand);
|
||||
}
|
||||
if (significand.signum() == -1) {
|
||||
throw new IllegalArgumentException("FP144 significand is smaller than zero: " + significand);
|
||||
}
|
||||
if (exponent > FourCornerZion7Petroglyphs.FP144_EXPONENT_MAX) {
|
||||
throw new IllegalArgumentException("FP144 exponent is larger than 17 bit: " + exponent);
|
||||
}
|
||||
if (exponent < 0) {
|
||||
throw new IllegalArgumentException("FP144 exponent is smaller than zero: " + exponent);
|
||||
}
|
||||
for (int i = 47; i >= 42; i--) {
|
||||
int bankValue = (exponent >> ((i-42) * 3)) & FourCornerZion7Petroglyphs.OCTAL_MASK_INT;
|
||||
if (i == 47 && sign) {
|
||||
bankValue = (bankValue & 0b011) + 4;
|
||||
if (strobePage) {
|
||||
strobePage = false;
|
||||
outAdd(type.cakeOffsetSel0() + i);
|
||||
}
|
||||
if (bankValue == 0) {
|
||||
continue;
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NUM_FP144.getStart() + bankValue + (i * 8));
|
||||
}
|
||||
for (int i = 41; i >= 0; i--) {
|
||||
int bankValue = significand.shiftRight(i * 3).and(FourCornerZion7Petroglyphs.OCTAL_MASK_BIG).intValue();
|
||||
if (bankValue == 0 && i > 0) {
|
||||
continue;
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NUM_FP144.getStart() + bankValue + (i * 8));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberNCR1632(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 (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);
|
||||
}
|
||||
BigInteger numeratorPos = numerator;
|
||||
boolean numeratorNegative = false;
|
||||
if (numerator.signum() == -1) {
|
||||
numeratorPos = numerator.negate();
|
||||
numeratorNegative = true;
|
||||
}
|
||||
BigInteger denominatorPos = denominator;
|
||||
boolean denominatorNegative = false;
|
||||
if (denominator.signum() == -1) {
|
||||
denominatorPos = denominator.negate();
|
||||
denominatorNegative = true;
|
||||
}
|
||||
if (isSixBit) {
|
||||
outAddAll(FCDotDEC2701DashPX0.ESC68_NCR.baklavaPointSequence());
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = numeratorPos.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (i == 63 && numeratorNegative) {
|
||||
bankValue = (bankValue & 0b011) + 4;
|
||||
}
|
||||
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) {
|
||||
outAdd(FCDotCDC1604DashP6.NY01_AT.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||
}
|
||||
if (pageLSB > 0) {
|
||||
outAdd(FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||
}
|
||||
if (valueMSB > 0) {
|
||||
outAdd(FCDotCDC1604DashP6.NY03_BAR_V_LEFT.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||
}
|
||||
if (valueCSB > 0) {
|
||||
outAdd(FCDotCDC1604DashP6.NY04_BAR_UNDER.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||
}
|
||||
outAdd(FCDotCDC1604DashP6.NY05_BAR_VERTICAL.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||
}
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = denominatorPos.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (i == 63 && denominatorNegative) {
|
||||
bankValue = (bankValue & 0b011) + 4;
|
||||
}
|
||||
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) {
|
||||
outAdd(FCDotCDC1604DashP6.NY06_PERCENT.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageMSB);
|
||||
}
|
||||
if (pageLSB > 0) {
|
||||
outAdd(FCDotCDC1604DashP6.NY07_DOLLAR.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + pageLSB);
|
||||
}
|
||||
if (valueMSB > 0) {
|
||||
outAdd(FCDotCDC1604DashP6.NY08_HASH.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueMSB);
|
||||
}
|
||||
if (valueCSB > 0) {
|
||||
outAdd(FCDotCDC1604DashP6.NY09_EQUALS.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueCSB);
|
||||
}
|
||||
outAdd(FCDotCDC1604DashP6.NY10_CARET.baklavaPointDotIndex());
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.baklavaPointDotIndex() + valueLSB);
|
||||
}
|
||||
outAdd(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
outFlush();
|
||||
return;
|
||||
}
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = numeratorPos.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (i == 63 && numeratorNegative) {
|
||||
bankValue = (bankValue & 0b011) + 4;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
continue;
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NCR1632_NUM.getStart() + bankValue + (i * 512));
|
||||
}
|
||||
for (int i = 63; i >= 0; i--) {
|
||||
int bankValue = denominatorPos.shiftRight(i * 9).and(FourCornerZion7Petroglyphs.NCR1632_MASK_PAGE).intValue();
|
||||
if (i == 63 && denominatorNegative) {
|
||||
bankValue = (bankValue & 0b011) + 4;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
continue;
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NCR1632_DEN.getStart() + bankValue + (i * 512));
|
||||
//TODO if (isSixBit) {
|
||||
outAdd(type.cakeOffsetBank() + bankValue);
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWalker(List<PrimordialOctal> 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());
|
||||
}
|
||||
outAdd(FCDotDEC2701DashPX0.ESC_SAND_WALKER.cakePointDotIndex());
|
||||
for (int i = 192 - 1; i >= 0; i--) {
|
||||
if (rhythm.size() <= i) {
|
||||
continue;
|
||||
}
|
||||
PrimordialOctal octal = rhythm.get(i);
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||
}
|
||||
outAdd(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
outFlush();
|
||||
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);
|
||||
public void strobeSandWorm(List<PrimordialOctal> sandWalk, List<PrimordialOctal> sandSpice) {
|
||||
Objects.requireNonNull(sandWalk);
|
||||
Objects.requireNonNull(sandSpice);
|
||||
if (!FourCornerZion7Petroglyphs.SAND_WORM_SIGNS.contains(sandWalk.size())) {
|
||||
throw new IllegalArgumentException("Sand walk rhythm is not 72 bit aligned: " + sandWalk.size());
|
||||
}
|
||||
if (0 != (sandSpice.size() % 5)) {
|
||||
throw new IllegalArgumentException("Sand spice is not 15 bit aligned: " + sandSpice.size());
|
||||
}
|
||||
Iterator<PrimordialOctal> walkItr = sandWalk.iterator();
|
||||
Iterator<PrimordialOctal> spiceItr = sandSpice.iterator();
|
||||
if (isSixBit) {
|
||||
outAdd(FCDotDEC2701DashPX0.ESC68_SAND_WORM.cakePointDotIndex());
|
||||
for (int i = spice.size(); i >= 0; i--) {
|
||||
PrimordialOctal octal = spice.get(i);
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + octal.ordinal());
|
||||
while (walkItr.hasNext()) {
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + walkItr.next().ordinal());
|
||||
}
|
||||
outAdd(FCDotCDC1604DashP6._RAKA_QUESTION.cakePointDotIndex());
|
||||
while (spiceItr.hasNext()) {
|
||||
outAdd(FCDotCDC1604DashP6.NX01_A.cakePointDotIndex() + spiceItr.next().ordinal());
|
||||
}
|
||||
outAdd(FCDotCDC1604DashP6._SALAH_EXCLAMATION.cakePointDotIndex());
|
||||
return;
|
||||
}
|
||||
Iterator<PrimordialOctal> spiceItr = spice.iterator();
|
||||
while (walkItr.hasNext()) {
|
||||
int bitValue12 = 0;
|
||||
bitValue12 += (walkItr.next().ordinal() << 9);
|
||||
bitValue12 += (walkItr.next().ordinal() << 6);
|
||||
bitValue12 += (walkItr.next().ordinal() << 3);
|
||||
bitValue12 += (walkItr.next().ordinal() << 0);
|
||||
outAdd(FourCornerDotCake.FC_SANDWALK_12.getStart() + bitValue12);
|
||||
}
|
||||
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);
|
||||
bitValue15 += (spiceItr.next().ordinal() << 12);
|
||||
bitValue15 += (spiceItr.next().ordinal() << 9);
|
||||
bitValue15 += (spiceItr.next().ordinal() << 6);
|
||||
bitValue15 += (spiceItr.next().ordinal() << 3);
|
||||
bitValue15 += (spiceItr.next().ordinal() << 0);
|
||||
outAdd(FourCornerDotCake.FC_SANDWORM_15.getStart() + bitValue15);
|
||||
}
|
||||
outFlush();
|
||||
|
|
@ -435,6 +284,20 @@ public class FourCornerZionStenoGrapher {
|
|||
public void strobeSalahSequence(FourCornerZion7SalahSequence type, List<List<Integer>> arguments) {
|
||||
Objects.requireNonNull(type);
|
||||
Objects.requireNonNull(arguments);
|
||||
int arguSize = arguments.size();
|
||||
for (int y = 0; y < arguSize; y++) {
|
||||
List<Integer> arguValue = arguments.get(y);
|
||||
int listSize = arguValue.size();
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
int value = arguValue.get(i);
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException("Value below zero: " + value);
|
||||
}
|
||||
if (value > 63) {
|
||||
throw new IllegalArgumentException("Value above 63: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (FourCornerZion7SalahSequence.ESC_VT06.equals(type)) {
|
||||
if (isSixBit) {
|
||||
outAddAll(FCDotDEC2701DashPX0.ESC_VT06.baklavaPointSequence());
|
||||
|
|
@ -450,8 +313,7 @@ public class FourCornerZionStenoGrapher {
|
|||
}
|
||||
Iterator<List<Integer>> argu = arguments.iterator();
|
||||
while (argu.hasNext()) {
|
||||
List<Integer> arguValue = argu.next();
|
||||
outAddAll(arguValue); // TODO: add range check
|
||||
outAddAll(argu.next());
|
||||
if (argu.hasNext()) {
|
||||
outAdd(FCDotCDC1604DashP6._RAKA_QUESTION.baklavaPointDotIndex());
|
||||
}
|
||||
|
|
@ -459,6 +321,172 @@ public class FourCornerZionStenoGrapher {
|
|||
outAdd(FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex());
|
||||
outFlush();
|
||||
}
|
||||
|
||||
// ----------------------------- END FC6
|
||||
|
||||
@Override
|
||||
public void strobeNumberGrams(FourCornerZion7NumberGram gram, List<Integer> values) {
|
||||
Objects.requireNonNull(gram);
|
||||
Objects.requireNonNull(values);
|
||||
int gramCount = values.size();
|
||||
for (int i = 0; i < gramCount; i++) {
|
||||
int gramValue = values.get(i);
|
||||
if (gramValue < 0) {
|
||||
throw new IllegalArgumentException("Gram value is smaller than zero");
|
||||
}
|
||||
if (gramValue > gram.cutCount()) {
|
||||
throw new IllegalArgumentException("Gram value is greater than cut count: " + gram.cutCount());
|
||||
}
|
||||
outAdd(gram.cutZeroCakePoint() + gramValue);
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberNCR1632(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 (numerator.compareTo(FourCornerZion7Petroglyphs.INT576_SIGNED_MAX) > 0) {
|
||||
throw new IllegalArgumentException("Value numerator is larger than 576 bit: " + numerator);
|
||||
}
|
||||
if (denominator.compareTo(FourCornerZion7Petroglyphs.INT576_SIGNED_MAX) > 0) {
|
||||
throw new IllegalArgumentException("Value denominator is larger than 576 bit: " + denominator);
|
||||
}
|
||||
BigInteger numeratorPos = numerator;
|
||||
boolean numeratorNegative = false;
|
||||
if (numerator.signum() == -1) {
|
||||
numeratorPos = numerator.negate();
|
||||
numeratorNegative = true;
|
||||
}
|
||||
BigInteger denominatorPos = denominator;
|
||||
boolean denominatorNegative = false;
|
||||
if (denominator.signum() == -1) {
|
||||
denominatorPos = denominator.negate();
|
||||
denominatorNegative = true;
|
||||
}
|
||||
boolean strobePage = true;
|
||||
for (int i = 47; i >= 0; i--) {
|
||||
int bankValue = numeratorPos.shiftRight(i * 12).and(FourCornerZion7Petroglyphs.MASK_BITS_12).intValue();
|
||||
if (i == 47 && numeratorNegative) {
|
||||
bankValue = (bankValue & 0x7FF) + 0x800;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
strobePage = true; // skip zero values, so page again
|
||||
continue;
|
||||
}
|
||||
if (strobePage) {
|
||||
strobePage = false; // auto-- per value
|
||||
outAdd(FourCornerDotCake.FC_NCR1632_SEL0N.getStart() + i);
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NCR1632_BANK.getStart() + bankValue);
|
||||
}
|
||||
strobePage = true;
|
||||
for (int i = 47; i >= 0; i--) {
|
||||
int bankValue = denominatorPos.shiftRight(i * 12).and(FourCornerZion7Petroglyphs.MASK_BITS_12).intValue();
|
||||
if (i == 47 && denominatorNegative) {
|
||||
bankValue = (bankValue & 0x7FF) + 0x800;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
strobePage = true;
|
||||
continue;
|
||||
}
|
||||
if (strobePage) {
|
||||
strobePage = false;
|
||||
outAdd(FourCornerDotCake.FC_NCR1632_SEL1D.getStart() + i);
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_NCR1632_BANK.getStart() + bankValue);
|
||||
}
|
||||
outFlush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberDEC576(BigInteger coefficient, BigInteger exponent) {
|
||||
Objects.requireNonNull(coefficient);
|
||||
if (coefficient.compareTo(FourCornerZion7Petroglyphs.DEC576_COEFFICIENT_MAX) > 0) {
|
||||
throw new IllegalArgumentException("DEC144 coefficient is larger than 503 bit: " + coefficient);
|
||||
}
|
||||
if (exponent.compareTo(FourCornerZion7Petroglyphs.DEC576_EXPONENT_MAX) > 0) {
|
||||
throw new IllegalArgumentException("DEC144 exponent is larger than 71 bit: " + exponent);
|
||||
}
|
||||
BigInteger coefficientPos = coefficient;
|
||||
boolean coefficientNegative = false;
|
||||
if (coefficient.signum() == -1) {
|
||||
coefficientPos = coefficient.negate();
|
||||
coefficientNegative = true;
|
||||
}
|
||||
BigInteger exponentPos = exponent;
|
||||
boolean exponentNegative = false;
|
||||
if (exponent.signum() == -1) {
|
||||
exponentPos = exponent.negate();
|
||||
exponentNegative = true;
|
||||
}
|
||||
boolean strobePage = true;
|
||||
for (int i = 47; i >= 0; i--) {
|
||||
int bankValue = 0;
|
||||
if (i > 5) {
|
||||
bankValue = coefficientPos.shiftRight((i - 6) * 12).and(FourCornerZion7Petroglyphs.MASK_BITS_12).intValue();
|
||||
} else {
|
||||
bankValue = exponentPos.shiftRight(i * 12).and(FourCornerZion7Petroglyphs.MASK_BITS_12).intValue();
|
||||
}
|
||||
if (i == 47 && coefficientNegative) {
|
||||
bankValue = (bankValue & 0x7FF) + 0x800;
|
||||
}
|
||||
if (i == 5 && exponentNegative) {
|
||||
bankValue = (bankValue & 0x7FF) + 0x800;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
strobePage = true; // skip zero values, so page again
|
||||
continue;
|
||||
}
|
||||
if (strobePage) {
|
||||
strobePage = false; // auto-- per value
|
||||
outAdd(FourCornerDotCake.FC_DEC576_SEL0.getStart() + i);
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_DEC576_BANK.getStart() + bankValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNumberE503M72(boolean negative, BigInteger exponent, BigInteger significand) {
|
||||
Objects.requireNonNull(exponent);
|
||||
Objects.requireNonNull(significand);
|
||||
if (exponent.compareTo(FourCornerZion7Petroglyphs.E503M72_EXPONENT_MAX) > 0) {
|
||||
throw new IllegalArgumentException("E503M72 exponent is larger than 72 bit: " + exponent);
|
||||
}
|
||||
if (exponent.signum() == -1) {
|
||||
throw new IllegalArgumentException("E503M72 exponent is smaller than zero: " + exponent);
|
||||
}
|
||||
if (significand.compareTo(FourCornerZion7Petroglyphs.E503M72_SIGNIFICAND_MAX) > 0) {
|
||||
throw new IllegalArgumentException("E503M72 significand is larger than 503 bit: " + significand);
|
||||
}
|
||||
if (significand.signum() == -1) {
|
||||
throw new IllegalArgumentException("E503M72 significand is smaller than zero: " + significand);
|
||||
}
|
||||
boolean strobePage = true;
|
||||
for (int i = 47; i >= 0; i--) {
|
||||
int bankValue = 0;
|
||||
if (i > 41) {
|
||||
bankValue = exponent.shiftRight((i - 42) * 12).and(FourCornerZion7Petroglyphs.MASK_BITS_12).intValue();
|
||||
} else {
|
||||
bankValue = significand.shiftRight(i * 12).and(FourCornerZion7Petroglyphs.MASK_BITS_12).intValue();
|
||||
}
|
||||
if (i == 47 && negative) {
|
||||
bankValue = (bankValue & 0x7FF) + 0x800;
|
||||
}
|
||||
if (bankValue == 0 && i > 0) {
|
||||
strobePage = true; // skip zero values, so page again
|
||||
continue;
|
||||
}
|
||||
if (strobePage) {
|
||||
strobePage = false; // auto-- per value
|
||||
outAdd(FourCornerDotCake.FC_E503M72_SEL0.getStart() + i);
|
||||
}
|
||||
outAdd(FourCornerDotCake.FC_E503M72_BANK.getStart() + bankValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -24,6 +24,7 @@ package org.x4o.fc18.zion7;
|
|||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
|
@ -52,7 +53,7 @@ public class FourCornerZionStenoLexer {
|
|||
private final boolean handlerEscape;
|
||||
private final FourCornerZion7Candlelier handler;
|
||||
private final FourCornerZion7TempleScrolls handlerTempleScrolls;
|
||||
private final int numeratorBank[] = new int[64]; // <== is the terminator select are 6 bit of banks with 9 bit of values.
|
||||
private final int numeratorBank[] = new int[48];
|
||||
private final int denominatorBank[] = new int[numeratorBank.length];
|
||||
private List<Integer> input;
|
||||
private int inputIndex = 0;
|
||||
|
|
@ -65,15 +66,12 @@ public class FourCornerZionStenoLexer {
|
|||
private FCDotDEC0801DashE10 cdcDECModeE10 = null;
|
||||
private int cdcDECModePie = 0;
|
||||
private Boolean cdcDECModePieAlt = null;
|
||||
private int cdcDECModeNCR68Select = 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;
|
||||
|
||||
static {
|
||||
Iterator<FourCornerZion7FremanBase2> fremanBase2Itr = Arrays.asList(FourCornerZion7FremanBase2.values()).iterator();
|
||||
Iterator<FourCornerZion7FremanBase8> fremanBase8Itr = Arrays.asList(FourCornerZion7FremanBase8.values()).iterator();
|
||||
for (FourCornerDotCake cakeSlice : FourCornerDotCake.values()) {
|
||||
if (cakeSlice.name().startsWith("__")) {
|
||||
continue; // can't handle reserved, we be reported as
|
||||
|
|
@ -84,24 +82,55 @@ public class FourCornerZionStenoLexer {
|
|||
if (FourCornerDotCake.FC_DEC2701_PX0.equals(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_NUM_INT144.equals(cakeSlice)) {
|
||||
if (FourCornerDotCake.FC_NCR1632_SEL0N.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_NUM_DEC144.equals(cakeSlice)) {
|
||||
if (FourCornerDotCake.FC_NCR1632_SEL1D.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_NUM_FP144.equals(cakeSlice)) {
|
||||
if (FourCornerDotCake.FC_NCR1632_BANK.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_NCR1632_DEN.equals(cakeSlice)) {
|
||||
if (FourCornerDotCake.FC_DEC576_SEL0.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_NCR1632_NUM.equals(cakeSlice)) {
|
||||
if (FourCornerDotCake.FC_DEC576_BANK.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_E503M72_SEL0.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (FourCornerDotCake.FC_E503M72_BANK.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
if (cakeSlice.name().startsWith("FC_BA") && cakeSlice.name().endsWith("_SEL0")) {
|
||||
continue; // done by bank slices below
|
||||
}
|
||||
if (cakeSlice.name().contains("BA2") && cakeSlice.name().contains("BANK")) {
|
||||
FourCornerDotCake cakeSliceSel = FourCornerDotCake.valueOf(cakeSlice.ordinal() - 1);
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberBase2(cakeSliceSel, cakeSlice, fremanBase2Itr.next()));
|
||||
continue;
|
||||
}
|
||||
if (cakeSlice.name().contains("BA8") && cakeSlice.name().contains("BANK")) {
|
||||
FourCornerDotCake cakeSliceSel = FourCornerDotCake.valueOf(cakeSlice.ordinal() - 1);
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberBase8(cakeSliceSel, cakeSlice, fremanBase8Itr.next()));
|
||||
continue;
|
||||
}
|
||||
if (FourCornerDotCakeTower.TXT_GRAMS.equals(cakeSlice.tower())) {
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberGramSlice(cakeSlice));
|
||||
continue;
|
||||
|
|
@ -109,11 +138,10 @@ public class FourCornerZionStenoLexer {
|
|||
CAKE_SLICE_EATERS.add(new StenoScannerWordCakeSlice(cakeSlice));
|
||||
}
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerCDCDEC());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumINT144());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumDEC144());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumFP144());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNCR18());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerSandWorm());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberNCR1632());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberDEC576());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNumberE503M72());
|
||||
ArrayList.class.cast(CAKE_SLICE_EATERS).trimToSize();
|
||||
}
|
||||
|
||||
|
|
@ -208,19 +236,19 @@ public class FourCornerZionStenoLexer {
|
|||
private void ncrBankFire() {
|
||||
boolean numeratorNegetive = false;
|
||||
boolean denominatorNegetive = false;
|
||||
if ((numeratorBank[47] & 0x800) == 0x800) {
|
||||
numeratorNegetive = true;
|
||||
numeratorBank[47] = numeratorBank[47] & 0x7FF;
|
||||
}
|
||||
if ((denominatorBank[47] & 0x800) == 0x800) {
|
||||
denominatorNegetive = true;
|
||||
denominatorBank[47] = denominatorBank[47] & 0x7FF;
|
||||
}
|
||||
BigInteger numerator = BigInteger.ZERO;
|
||||
BigInteger denominator = BigInteger.ZERO;
|
||||
for (int i = 0; i < numeratorBank.length; i++) {
|
||||
if (i == 63 && (numeratorBank[i] & 0b100) == 4) {
|
||||
numeratorNegetive = true;
|
||||
numeratorBank[i] = numeratorBank[i] & 0b011;
|
||||
}
|
||||
if (i == 63 && (denominatorBank[i] & 0b100) == 4) {
|
||||
denominatorNegetive = true;
|
||||
denominatorBank[i] = denominatorBank[i] & 0b011;
|
||||
}
|
||||
numerator = numerator.add(BigInteger.valueOf(numeratorBank[i]).shiftLeft(i * 9));
|
||||
denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 9));
|
||||
numerator = numerator.add(BigInteger.valueOf(numeratorBank[i]).shiftLeft(i * 12));
|
||||
denominator = denominator.add(BigInteger.valueOf(denominatorBank[i]).shiftLeft(i * 12));
|
||||
}
|
||||
if (numeratorNegetive) {
|
||||
numerator = numerator.negate();
|
||||
|
|
@ -242,11 +270,6 @@ public class FourCornerZionStenoLexer {
|
|||
cdcDECModeE10 = null;
|
||||
cdcDECModePie = 0;
|
||||
cdcDECModePieAlt = null;
|
||||
cdcDECModeNCR68Select = 0;
|
||||
cdcDECModeNCR68NumPage = 0;
|
||||
cdcDECModeNCR68NumValue = 0;
|
||||
cdcDECModeNCR68DenPage = 0;
|
||||
cdcDECModeNCR68DenValue = 0;
|
||||
}
|
||||
|
||||
abstract static private class StenoScanner {
|
||||
|
|
@ -294,22 +317,168 @@ public class FourCornerZionStenoLexer {
|
|||
abstract void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast);
|
||||
}
|
||||
|
||||
static class StenoScannerWordCakeSlice extends StenoScanner {
|
||||
|
||||
static final class StenoScannerWordCakeSlice extends StenoScanner {
|
||||
|
||||
public StenoScannerWordCakeSlice(FourCornerDotCake cakeSlice) {
|
||||
super(cakeSlice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
lexer.handler.strobeWords(lexer.input.subList(idxFirst, idxLast + 1));
|
||||
if (idxFirst == idxLast) {
|
||||
lexer.handler.strobeTheWord(lexer.input.get(idxFirst));
|
||||
} else {
|
||||
lexer.handler.strobeTheWords(lexer.input.subList(idxFirst, idxLast + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class StenoScannerNumberGramSlice extends StenoScanner {
|
||||
|
||||
static final class StenoScannerNumberBase2 extends StenoScanner {
|
||||
|
||||
private final FourCornerDotCake cakeSliceSel;
|
||||
private final FourCornerZion7FremanBase2 numberFreman;
|
||||
private final int numberFremanBankMax;
|
||||
|
||||
public StenoScannerNumberBase2(FourCornerDotCake cakeSliceSel, FourCornerDotCake cakeSliceBank, FourCornerZion7FremanBase2 numberFreman) {
|
||||
super(cakeSliceSel.getStart(), cakeSliceBank.getStop());
|
||||
this.cakeSliceSel = cakeSliceSel;
|
||||
this.numberFreman = numberFreman;
|
||||
this.numberFremanBankMax = numberFreman.bytes() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
int valueBank[] = new int[256]; // TODO: move to lexer
|
||||
int valueBankIndex = numberFremanBankMax;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
if (cakePoint >= cakeSliceSel.getStart() && cakePoint <= cakeSliceSel.getStop()) {
|
||||
valueBankIndex = cakePoint - cakeSliceSel.getStart();
|
||||
continue;
|
||||
}
|
||||
valueBank[valueBankIndex] = cakePoint - (cakeSliceSel.getStop() + 1);
|
||||
valueBankIndex--;
|
||||
if (valueBankIndex < 0) {
|
||||
valueBankIndex = numberFremanBankMax;
|
||||
boolean valueNegative = false;
|
||||
if (numberFreman.isSigned() && (valueBank[numberFremanBankMax] & 0x80) == 0x80) {
|
||||
valueNegative = true;
|
||||
valueBank[numberFremanBankMax] = valueBank[numberFremanBankMax] & 0x7F;
|
||||
}
|
||||
BigInteger valueNumber = BigInteger.ZERO;
|
||||
for (int ii = numberFremanBankMax; ii >= 0; ii--) {
|
||||
valueNumber = valueNumber.add(BigInteger.valueOf(valueBank[ii]).shiftLeft(ii * 8));
|
||||
}
|
||||
if (valueNegative) {
|
||||
valueNumber = valueNumber.negate();
|
||||
}
|
||||
lexer.handler.strobeNumberBASE2(numberFreman, valueNumber);
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueBank[ii] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final class StenoScannerNumberBase8 extends StenoScanner {
|
||||
|
||||
private final FourCornerDotCake cakeSliceSel;
|
||||
private final FourCornerZion7FremanBase8 numberFreman;
|
||||
private final int numberFremanBankMax;
|
||||
|
||||
public StenoScannerNumberBase8(FourCornerDotCake cakeSliceSel, FourCornerDotCake cakeSliceBank, FourCornerZion7FremanBase8 numberFreman) {
|
||||
super(cakeSliceSel.getStart(), cakeSliceBank.getStop());
|
||||
this.cakeSliceSel = cakeSliceSel;
|
||||
this.numberFreman = numberFreman;
|
||||
this.numberFremanBankMax = (numberFreman.octals()/3) - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
int valueBank[] = new int[256]; // TODO: move to lexer
|
||||
int valueBankIndex = numberFremanBankMax;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
if (cakePoint >= cakeSliceSel.getStart() && cakePoint <= cakeSliceSel.getStop()) {
|
||||
valueBankIndex = cakePoint - cakeSliceSel.getStart();
|
||||
continue;
|
||||
}
|
||||
valueBank[valueBankIndex] = cakePoint - (cakeSliceSel.getStop() + 1);
|
||||
valueBankIndex--;
|
||||
if (valueBankIndex < 0) {
|
||||
valueBankIndex = numberFremanBankMax;
|
||||
boolean valueNegative = false;
|
||||
if (numberFreman.isSigned() && (valueBank[numberFremanBankMax] & 0x100) == 0x100) {
|
||||
valueNegative = true;
|
||||
valueBank[numberFremanBankMax] = valueBank[numberFremanBankMax] & 0xFF;
|
||||
}
|
||||
BigInteger valueNumber = BigInteger.ZERO;
|
||||
for (int ii = numberFremanBankMax; ii >= 0; ii--) {
|
||||
valueNumber = valueNumber.add(BigInteger.valueOf(valueBank[ii]).shiftLeft(ii * 9));
|
||||
}
|
||||
if (valueNegative) {
|
||||
valueNumber = valueNumber.negate();
|
||||
}
|
||||
lexer.handler.strobeNumberBASE8(numberFreman, valueNumber);
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueBank[ii] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final class StenoScannerSandWorm extends StenoScanner {
|
||||
|
||||
public StenoScannerSandWorm() {
|
||||
super(FourCornerDotCake.FC_SANDWALK_12.getStart(), FourCornerDotCake.FC_SANDWORM_15.getStop());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
List<Integer> sandWalk12 = new ArrayList<>();
|
||||
List<Integer> sandSpice15 = new ArrayList<>();
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
if (cakePoint >= FourCornerDotCake.FC_SANDWALK_12.getStart() && cakePoint <= FourCornerDotCake.FC_SANDWALK_12.getStop()) {
|
||||
sandWalk12.add(cakePoint);
|
||||
} else {
|
||||
sandSpice15.add(cakePoint);
|
||||
}
|
||||
}
|
||||
List<PrimordialOctal> sandWalk = new ArrayList<>();
|
||||
Iterator<Integer> i12 = sandWalk12.iterator();
|
||||
while (i12.hasNext()) {
|
||||
int bitValue12 = i12.next();
|
||||
sandWalk.add(PrimordialOctal.valueOf((bitValue12 >> 9) & 0b111));
|
||||
sandWalk.add(PrimordialOctal.valueOf((bitValue12 >> 6) & 0b111));
|
||||
sandWalk.add(PrimordialOctal.valueOf((bitValue12 >> 3) & 0b111));
|
||||
sandWalk.add(PrimordialOctal.valueOf((bitValue12 >> 0) & 0b111));
|
||||
}
|
||||
|
||||
List<PrimordialOctal> sandSpice = new ArrayList<>();
|
||||
Iterator<Integer> i15 = sandSpice15.iterator();
|
||||
while (i15.hasNext()) {
|
||||
int bitValue15 = i15.next();
|
||||
sandSpice.add(PrimordialOctal.valueOf((bitValue15 >> 12) & 0b111));
|
||||
sandSpice.add(PrimordialOctal.valueOf((bitValue15 >> 9) & 0b111));
|
||||
sandSpice.add(PrimordialOctal.valueOf((bitValue15 >> 6) & 0b111));
|
||||
sandSpice.add(PrimordialOctal.valueOf((bitValue15 >> 3) & 0b111));
|
||||
sandSpice.add(PrimordialOctal.valueOf((bitValue15 >> 0) & 0b111));
|
||||
}
|
||||
if (!FourCornerZion7Petroglyphs.SAND_WORM_SIGNS.contains(sandWalk.size())) {
|
||||
lexer.smokeSignals.burnSandWalkerStepUnaligned(lexer.currLine, lexer.currCol, -1); // TODO: fixme
|
||||
} else {
|
||||
lexer.handler.strobeSandWorm(sandWalk, sandSpice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final class StenoScannerNumberGramSlice extends StenoScanner {
|
||||
|
||||
private final FourCornerZion7NumberGram numberGram;
|
||||
|
||||
|
||||
public StenoScannerNumberGramSlice(FourCornerDotCake cakeSlice) {
|
||||
super(cakeSlice);
|
||||
this.numberGram = FourCornerZion7NumberGram.valueByCutCount(cakeSlice.getStop() - cakeSlice.getStart());
|
||||
|
|
@ -325,228 +494,46 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
}
|
||||
|
||||
static class StenoScannerSandWorm extends StenoScanner {
|
||||
static final class StenoScannerNumberNCR1632 extends StenoScanner {
|
||||
|
||||
public StenoScannerSandWorm() {
|
||||
super(FourCornerDotCake.FC_SANDWORM_15);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
List<Integer> wormBody15 = lexer.input.subList(idxFirst, idxLast + 1);
|
||||
List<PrimordialOctal> wormSpice = new ArrayList<>();
|
||||
Iterator<Integer> i15 = wormBody15.iterator();
|
||||
while (i15.hasNext()) {
|
||||
int bitValue15 = i15.next();
|
||||
int octal4 = 0;
|
||||
int octal3 = 0;
|
||||
int octal2 = 0;
|
||||
int octal1 = 0;
|
||||
int octal0 = 0;
|
||||
octal4 += ((bitValue15 >> 14) & 0b1) << 2;
|
||||
octal4 += ((bitValue15 >> 13) & 0b1) << 1;
|
||||
octal4 += ((bitValue15 >> 12) & 0b1) << 0;
|
||||
octal3 += ((bitValue15 >> 11) & 0b1) << 2;
|
||||
octal3 += ((bitValue15 >> 10) & 0b1) << 1;
|
||||
octal3 += ((bitValue15 >> 9) & 0b1) << 0;
|
||||
octal2 += ((bitValue15 >> 8) & 0b1) << 2;
|
||||
octal2 += ((bitValue15 >> 7) & 0b1) << 1;
|
||||
octal2 += ((bitValue15 >> 6) & 0b1) << 0;
|
||||
octal1 += ((bitValue15 >> 5) & 0b1) << 2;
|
||||
octal1 += ((bitValue15 >> 4) & 0b1) << 1;
|
||||
octal1 += ((bitValue15 >> 3) & 0b1) << 0;
|
||||
octal0 += ((bitValue15 >> 2) & 0b1) << 2;
|
||||
octal0 += ((bitValue15 >> 1) & 0b1) << 1;
|
||||
octal0 += ((bitValue15 >> 0) & 0b1) << 0;
|
||||
wormSpice.add(PrimordialOctal.valueOf(octal4));
|
||||
wormSpice.add(PrimordialOctal.valueOf(octal3));
|
||||
wormSpice.add(PrimordialOctal.valueOf(octal2));
|
||||
wormSpice.add(PrimordialOctal.valueOf(octal1));
|
||||
wormSpice.add(PrimordialOctal.valueOf(octal0));
|
||||
}
|
||||
lexer.handler.strobeSandWorm(wormSpice);
|
||||
}
|
||||
}
|
||||
|
||||
static class StenoScannerNumINT144 extends StenoScanner {
|
||||
|
||||
static private final int CAKEPOINT_BANK0_END = FourCornerDotCake.FC_NUM_INT144.getStart() + 8;
|
||||
|
||||
public StenoScannerNumINT144() {
|
||||
super(FourCornerDotCake.FC_NUM_INT144);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
int valueBank[] = new int[48];
|
||||
boolean negetive = false;
|
||||
boolean missingSparkler = true;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
int valueOffset = cakePoint - FourCornerDotCake.FC_NUM_INT144.getStart();
|
||||
int bankSelect = valueOffset / 8;
|
||||
int bankValue = valueOffset % 8;
|
||||
if (bankSelect == 47 && (bankValue & 0b100) == 4) {
|
||||
negetive = true;
|
||||
bankValue = bankValue & 0b011;
|
||||
}
|
||||
valueBank[bankSelect] = bankValue;
|
||||
if (cakePoint > CAKEPOINT_BANK0_END) {
|
||||
missingSparkler = true;
|
||||
continue;
|
||||
}
|
||||
BigInteger valueNumber = BigInteger.ZERO;
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueNumber = valueNumber.add(BigInteger.valueOf(valueBank[ii]).shiftLeft(ii * 3));
|
||||
}
|
||||
if (negetive) {
|
||||
valueNumber = valueNumber.negate();
|
||||
}
|
||||
lexer.handler.strobeNumberINT144(valueNumber);
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueBank[ii] = 0;
|
||||
}
|
||||
missingSparkler = false;
|
||||
}
|
||||
if (missingSparkler) {
|
||||
lexer.smokeSignals.burnNumberINT144MissingSparkler(lexer.currLine, lexer.currCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class StenoScannerNumDEC144 extends StenoScanner {
|
||||
|
||||
static private final int CAKEPOINT_BANK0_END = FourCornerDotCake.FC_NUM_DEC144.getStart() + 8;
|
||||
|
||||
public StenoScannerNumDEC144() {
|
||||
super(FourCornerDotCake.FC_NUM_DEC144);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
int valueBank[] = new int[48];
|
||||
boolean negative = false;
|
||||
boolean missingSparkler = true;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
int valueOffset = cakePoint - FourCornerDotCake.FC_NUM_DEC144.getStart();
|
||||
int bankSelect = valueOffset / 8;
|
||||
int bankValue = valueOffset % 8;
|
||||
if (bankSelect == 47 && (bankValue & 0b100) == 4) {
|
||||
negative = true;
|
||||
bankValue = bankValue & 0b011;
|
||||
}
|
||||
valueBank[bankSelect] = bankValue;
|
||||
if (cakePoint > CAKEPOINT_BANK0_END) {
|
||||
missingSparkler = true;
|
||||
continue;
|
||||
}
|
||||
int exponent = 0;
|
||||
exponent += (valueBank[5] & 0b011) << 15;
|
||||
exponent += valueBank[4] << 12;
|
||||
exponent += valueBank[3] << 9;
|
||||
exponent += valueBank[2] << 6;
|
||||
exponent += valueBank[1] << 3;
|
||||
exponent += valueBank[0] << 0;
|
||||
BigInteger valueNumber = BigInteger.ZERO;
|
||||
for (int ii = 6; ii < 48; ii++) {
|
||||
valueNumber = valueNumber.add(BigInteger.valueOf(valueBank[ii]).shiftLeft((ii-6) * 3));
|
||||
}
|
||||
if (negative) {
|
||||
valueNumber = valueNumber.negate();
|
||||
}
|
||||
if ((valueBank[5] & 0b100) == 4) {
|
||||
exponent = 0 - exponent;
|
||||
}
|
||||
lexer.handler.strobeNumberDEC144(valueNumber, exponent);
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueBank[ii] = 0;
|
||||
}
|
||||
missingSparkler = false;
|
||||
}
|
||||
if (missingSparkler) {
|
||||
lexer.smokeSignals.burnNumberFP144MissingSparkler(lexer.currLine, lexer.currCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class StenoScannerNumFP144 extends StenoScanner {
|
||||
|
||||
static private final int CAKEPOINT_BANK0_END = FourCornerDotCake.FC_NUM_FP144.getStart() + 8;
|
||||
|
||||
public StenoScannerNumFP144() {
|
||||
super(FourCornerDotCake.FC_NUM_FP144);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
int valueBank[] = new int[48];
|
||||
boolean negative = false;
|
||||
boolean missingSparkler = true;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
int valueOffset = cakePoint - FourCornerDotCake.FC_NUM_FP144.getStart();
|
||||
int bankSelect = valueOffset / 8;
|
||||
int bankValue = valueOffset % 8;
|
||||
if (bankSelect == 47 && (bankValue & 0b100) == 4) {
|
||||
negative = true;
|
||||
bankValue = bankValue & 0b011;
|
||||
}
|
||||
valueBank[bankSelect] = bankValue;
|
||||
if (cakePoint > CAKEPOINT_BANK0_END) {
|
||||
missingSparkler = true;
|
||||
continue;
|
||||
}
|
||||
int exponent = 0;
|
||||
exponent += (valueBank[47] & 0b011) << 15;
|
||||
exponent += valueBank[46] << 12;
|
||||
exponent += valueBank[45] << 9;
|
||||
exponent += valueBank[44] << 6;
|
||||
exponent += valueBank[43] << 3;
|
||||
exponent += valueBank[42] << 0;
|
||||
BigInteger valueNumber = BigInteger.ZERO;
|
||||
for (int ii = 0; ii < 42; ii++) {
|
||||
valueNumber = valueNumber.add(BigInteger.valueOf(valueBank[ii]).shiftLeft(ii * 3));
|
||||
}
|
||||
lexer.handler.strobeNumberFP144(negative, exponent, valueNumber);
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueBank[ii] = 0;
|
||||
}
|
||||
missingSparkler = false;
|
||||
}
|
||||
if (missingSparkler) {
|
||||
lexer.smokeSignals.burnNumberFP144MissingSparkler(lexer.currLine, lexer.currCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class StenoScannerNCR18 extends StenoScanner {
|
||||
|
||||
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());
|
||||
public StenoScannerNumberNCR1632() {
|
||||
super(FourCornerDotCake.FC_NCR1632_SEL0N.getStart(), FourCornerDotCake.FC_NCR1632_BANK.getStop());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
boolean missingSparkler = true;
|
||||
boolean numOrDen = true;
|
||||
int pageX = -1;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
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;
|
||||
if (cakePoint >= FourCornerDotCake.FC_NCR1632_SEL0N.getStart() && cakePoint <= FourCornerDotCake.FC_NCR1632_SEL0N.getStop()) {
|
||||
pageX = cakePoint - FourCornerDotCake.FC_NCR1632_SEL0N.getStart();
|
||||
numOrDen = true;
|
||||
continue;
|
||||
}
|
||||
int denominatorX = cakePoint - FourCornerDotCake.FC_NCR1632_DEN.getStart();
|
||||
lexer.denominatorBank[denominatorX / 512] = denominatorX % 512;
|
||||
|
||||
if (cakePoint > CAKEPOINT_BANK0_END) {
|
||||
if (cakePoint >= FourCornerDotCake.FC_NCR1632_SEL1D.getStart() && cakePoint <= FourCornerDotCake.FC_NCR1632_SEL1D.getStop()) {
|
||||
pageX = cakePoint - FourCornerDotCake.FC_NCR1632_SEL1D.getStart();
|
||||
numOrDen = false;
|
||||
continue;
|
||||
}
|
||||
if (pageX == -1) {
|
||||
// smoke signal
|
||||
continue;
|
||||
}
|
||||
int valueX = cakePoint - FourCornerDotCake.FC_NCR1632_BANK.getStart();
|
||||
if (numOrDen) {
|
||||
lexer.numeratorBank[pageX] = valueX;
|
||||
} else {
|
||||
lexer.denominatorBank[pageX] = valueX;
|
||||
}
|
||||
if (numOrDen || pageX > 0) {
|
||||
pageX--;
|
||||
missingSparkler = true;
|
||||
continue; // Only fire fraction on lowest value select
|
||||
}
|
||||
lexer.ncrBankFire();
|
||||
pageX = -1;
|
||||
missingSparkler = false;
|
||||
}
|
||||
if (missingSparkler) {
|
||||
|
|
@ -555,7 +542,118 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
}
|
||||
|
||||
static class StenoScannerCDCDEC extends StenoScanner {
|
||||
static final class StenoScannerNumberDEC576 extends StenoScanner {
|
||||
|
||||
public StenoScannerNumberDEC576() {
|
||||
super(FourCornerDotCake.FC_DEC576_SEL0.getStart(), FourCornerDotCake.FC_DEC576_BANK.getStop());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
int valueBank[] = new int[48];
|
||||
boolean missingSparkler = true;
|
||||
int pageX = -1;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
if (cakePoint >= FourCornerDotCake.FC_DEC576_SEL0.getStart() && cakePoint <= FourCornerDotCake.FC_DEC576_SEL0.getStop()) {
|
||||
pageX = cakePoint - FourCornerDotCake.FC_DEC576_SEL0.getStart();
|
||||
continue;
|
||||
}
|
||||
if (pageX == -1) {
|
||||
// smoke signal
|
||||
continue;
|
||||
}
|
||||
int valueX = cakePoint - FourCornerDotCake.FC_DEC576_BANK.getStart();
|
||||
valueBank[pageX] = valueX;
|
||||
pageX--;
|
||||
if (pageX > 0) {
|
||||
missingSparkler = true;
|
||||
continue;
|
||||
}
|
||||
BigInteger coefficient = BigInteger.ZERO;
|
||||
BigInteger exponent = BigInteger.ZERO;
|
||||
for (int ii = 47; ii >= 0; ii--) {
|
||||
if (ii > 5) {
|
||||
coefficient = coefficient.add(BigInteger.valueOf(valueBank[ii]).shiftLeft((ii - 6) * 12));
|
||||
} else {
|
||||
exponent = exponent.add(BigInteger.valueOf(valueBank[ii]).shiftLeft(ii * 12));
|
||||
}
|
||||
}
|
||||
if ((valueBank[47] & 0x800) == 0x800) {
|
||||
coefficient = coefficient.negate();
|
||||
}
|
||||
if ((valueBank[5] & 0x800) == 0x800) {
|
||||
exponent = exponent.negate();
|
||||
}
|
||||
lexer.handler.strobeNumberDEC576(coefficient, exponent);
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueBank[ii] = 0;
|
||||
}
|
||||
pageX = -1;
|
||||
missingSparkler = false;
|
||||
}
|
||||
if (missingSparkler) {
|
||||
lexer.smokeSignals.burnNumberDEC576MissingSparkler(lexer.currLine, lexer.currCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final class StenoScannerNumberE503M72 extends StenoScanner {
|
||||
|
||||
public StenoScannerNumberE503M72() {
|
||||
super(FourCornerDotCake.FC_E503M72_SEL0.getStart(), FourCornerDotCake.FC_E503M72_BANK.getStop());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
int valueBank[] = new int[48];
|
||||
boolean missingSparkler = true;
|
||||
int pageX = -1;
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
int cakePoint = lexer.input.get(i);
|
||||
if (cakePoint >= FourCornerDotCake.FC_E503M72_SEL0.getStart() && cakePoint <= FourCornerDotCake.FC_E503M72_SEL0.getStop()) {
|
||||
pageX = cakePoint - FourCornerDotCake.FC_E503M72_SEL0.getStart();
|
||||
continue;
|
||||
}
|
||||
if (pageX == -1) {
|
||||
// smoke signal
|
||||
continue;
|
||||
}
|
||||
int valueX = cakePoint - FourCornerDotCake.FC_E503M72_BANK.getStart();
|
||||
valueBank[pageX] = valueX;
|
||||
pageX--;
|
||||
if (pageX > 0) {
|
||||
missingSparkler = true;
|
||||
continue;
|
||||
}
|
||||
boolean negative = false;
|
||||
if ((valueBank[47] & 0x800) == 0x800) {
|
||||
negative = true;
|
||||
valueBank[47] = valueBank[47] & 0x7FF;
|
||||
}
|
||||
BigInteger exponent = BigInteger.ZERO;
|
||||
BigInteger significand = BigInteger.ZERO;
|
||||
for (int ii = 47; ii >= 0; ii--) {
|
||||
if (ii > 41) {
|
||||
exponent = exponent.add(BigInteger.valueOf(valueBank[ii]).shiftLeft((ii - 42) * 12));
|
||||
} else {
|
||||
significand = significand.add(BigInteger.valueOf(valueBank[ii]).shiftLeft(ii * 12));
|
||||
}
|
||||
}
|
||||
lexer.handler.strobeNumberE503M72(negative, exponent, significand);
|
||||
for (int ii = 0; ii < valueBank.length; ii++) {
|
||||
valueBank[ii] = 0;
|
||||
}
|
||||
pageX = -1;
|
||||
missingSparkler = false;
|
||||
}
|
||||
if (missingSparkler) {
|
||||
lexer.smokeSignals.burnNumberE503M72MissingSparkler(lexer.currLine, lexer.currCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static final class StenoScannerCDCDEC extends StenoScanner {
|
||||
|
||||
public StenoScannerCDCDEC() {
|
||||
super(FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.FC_DEC2701_PX0.getStop());
|
||||
|
|
@ -574,7 +672,7 @@ public class FourCornerZionStenoLexer {
|
|||
continue;
|
||||
}
|
||||
int cdcDECPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
lexer.handler.strobeWord(cdcDECPoint);
|
||||
lexer.handler.strobeTheWord(cdcDECPoint);
|
||||
// if (FourCornerDotCake.FC_DEC2701_PX0.contains(cdcDECPoint)) {
|
||||
// lexer.handler.strobeWord(FourCornerDotCake.FC_DEC2701_PX0, cdcDECPoint - FourCornerDotCake.FC_DEC2701_PX0.getStart());
|
||||
// } else {
|
||||
|
|
@ -683,18 +781,12 @@ public class FourCornerZionStenoLexer {
|
|||
if (FCDotDEC2701DashPX0.ESC68_CMD5401_2D.equals(cdcDECMode)) {
|
||||
return handleCMD(lexer);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC68_NCR.equals(cdcDECMode)) {
|
||||
return handleNCR(lexer);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC_DEC0801_E10.equals(cdcDECMode)) {
|
||||
return handleE10(lexer);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC68_INC0801_P8.equals(cdcDECMode)) {
|
||||
return handleINC(lexer);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC_SAND_WALKER.equals(cdcDECMode)) {
|
||||
return handleSandWalker(lexer);
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC68_SAND_WORM.equals(cdcDECMode)) {
|
||||
return handleSandWorm68(lexer);
|
||||
}
|
||||
|
|
@ -717,7 +809,7 @@ public class FourCornerZionStenoLexer {
|
|||
return false;
|
||||
}
|
||||
//lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
lexer.handler.strobeWord(displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
lexer.handler.strobeTheWord(displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -744,7 +836,7 @@ public class FourCornerZionStenoLexer {
|
|||
// }
|
||||
|
||||
if (FCDotDEC0801DashE10.E10_CDC1604_P6.equals(lexer.cdcDECModeE10)) {
|
||||
lexer.handler.strobeWord(cdcPoint); // not A based offset here
|
||||
lexer.handler.strobeTheWord(cdcPoint); // not A based offset here
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcPoint); // not A based offset here
|
||||
return true;
|
||||
}
|
||||
|
|
@ -754,7 +846,7 @@ public class FourCornerZionStenoLexer {
|
|||
return false;
|
||||
}
|
||||
//lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
lexer.handler.strobeWord(displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
lexer.handler.strobeTheWord(displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -770,7 +862,7 @@ public class FourCornerZionStenoLexer {
|
|||
if (FCDotCMD5401Dash2D.CMD_F4TXT0001_SP.equals(cmdMode)) {
|
||||
lexer.decModeReset();
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_F4TXT0001_SP, 0); // white space
|
||||
lexer.handler.strobeWord(FCDotF4TXT0001DashSP.SPANISH_PEACE.cakePointDotIndex()); // white space
|
||||
lexer.handler.strobeTheWord(FCDotF4TXT0001DashSP.SPANISH_PEACE.cakePointDotIndex()); // white space
|
||||
return true;
|
||||
}
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TTY0001_NL.equals(cmdMode)) {
|
||||
|
|
@ -779,7 +871,7 @@ public class FourCornerZionStenoLexer {
|
|||
lexer.currCol = 0;
|
||||
lexer.fireSignals.fireStateLine(lexer.currLine);
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_F4TTY0001_NL, 0); // new line
|
||||
lexer.handler.strobeWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex()); // new line
|
||||
lexer.handler.strobeTheWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex()); // new line
|
||||
return true;
|
||||
}
|
||||
lexer.decModeReset();
|
||||
|
|
@ -826,80 +918,7 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
FourCornerDotCake slice = FourCornerDotCake.valueOf(terminatorOffZero + sliceBase); // TODO: remove slice here
|
||||
//lexer.handler.strobeWord(slice, numberIdxOffZero);
|
||||
lexer.handler.strobeWord(slice.getStart() + numberIdxOffZero);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleNCR(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (cdcPoint == FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() || cdcPoint == FCDotCDC1604DashP6._RAKA_QUESTION.ordinal()) {
|
||||
lexer.decModeReset();
|
||||
return true; // eat salah and end mode
|
||||
}
|
||||
if (cdcPoint >= FCDotCDC1604DashP6.NY10_CARET.ordinal() && cdcPoint <= FCDotCDC1604DashP6.NY01_AT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68Select = cdcPoint;
|
||||
return true; // swallow select
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == 0) {
|
||||
lexer.decModeReset(); // exit mode did not start with select
|
||||
return false; // print char
|
||||
}
|
||||
int octalValue = -1;
|
||||
if (cdcPoint >= FCDotCDC1604DashP6.NX01_A.ordinal() && cdcPoint <= FCDotCDC1604DashP6.NX08_H.ordinal()) {
|
||||
octalValue = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal(); // goto relative
|
||||
}
|
||||
if (octalValue == -1) {
|
||||
lexer.decModeReset(); // exit mode out of range
|
||||
return false; // print char
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY01_AT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumPage = (octalValue << 3) + (lexer.cdcDECModeNCR68NumPage & 0b000111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY02_BAR_V_RIGHT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumPage = (octalValue << 0) + (lexer.cdcDECModeNCR68NumPage & 0b111000);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY03_BAR_V_LEFT.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 6) + (lexer.cdcDECModeNCR68NumValue & 0b000111111);
|
||||
return true;
|
||||
}
|
||||
if (lexer.cdcDECModeNCR68Select == FCDotCDC1604DashP6.NY04_BAR_UNDER.ordinal()) {
|
||||
lexer.cdcDECModeNCR68NumValue = (octalValue << 3) + (lexer.cdcDECModeNCR68NumValue & 0b111000111);
|
||||
return true;
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
lexer.handler.strobeTheWord(slice.getStart() + numberIdxOffZero);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -936,48 +955,18 @@ public class FourCornerZionStenoLexer {
|
|||
return false;
|
||||
}
|
||||
|
||||
// TODO: make better
|
||||
private boolean handleSandWalker(FourCornerZionStenoLexer lexer) {
|
||||
List<PrimordialOctal> rhythm = new ArrayList<>();
|
||||
while (lexer.cdcDECScanIndex <= lexer.cdcDECScanIndexEnd) {
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (cdcPoint == FCDotCDC1604DashP6._NUL.ordinal()) {
|
||||
lexer.smokeSignals.burnSalahInvalidCakePoint(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
lexer.cdcDECScanIndex--;
|
||||
return false; // _NUL not allowed here
|
||||
}
|
||||
if (FCDotCDC1604DashP6.isEscape6(cdcPoint)) {
|
||||
lexer.cdcDECScanIndex--;
|
||||
return true;
|
||||
}
|
||||
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() == cdcPoint) {
|
||||
if (!FourCornerZion7Petroglyphs.SAND_WORM_SIGN.contains(rhythm.size())) {
|
||||
lexer.smokeSignals.burnSandWalkerStepUnaligned(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
} else {
|
||||
lexer.handler.strobeSandWalker(rhythm);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
lexer.cdcDECScanIndex++;
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
break;
|
||||
}
|
||||
if (cdcPoint > FCDotCDC1604DashP6.NX08_H.ordinal()) {
|
||||
break;
|
||||
}
|
||||
rhythm.add(PrimordialOctal.valueOf(cdcPoint - FCDotCDC1604DashP6.NX01_A.cakePointDotIndex()));
|
||||
}
|
||||
lexer.cdcDECScanIndex--;
|
||||
lexer.smokeSignals.burnSandWalkerOutOfRhythm(lexer.currLine, lexer.currCol);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handleSandWorm68(FourCornerZionStenoLexer lexer) {
|
||||
List<PrimordialOctal> sandWorm = new ArrayList<>();
|
||||
List<PrimordialOctal> sandWalk = new ArrayList<>();
|
||||
List<PrimordialOctal> sandSpice = new ArrayList<>();
|
||||
boolean sandWalker = true;
|
||||
while (lexer.cdcDECScanIndex <= lexer.cdcDECScanIndexEnd) {
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (cdcPoint == FCDotCDC1604DashP6._RAKA_QUESTION.ordinal()) {
|
||||
sandWalker = false;
|
||||
continue;
|
||||
}
|
||||
if (cdcPoint == FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal()) {
|
||||
lexer.handler.strobeSandWorm(sandWorm);
|
||||
lexer.handler.strobeSandWorm(sandWalk, sandSpice);
|
||||
return true;
|
||||
}
|
||||
lexer.cdcDECScanIndex++;
|
||||
|
|
@ -987,8 +976,13 @@ public class FourCornerZionStenoLexer {
|
|||
if (cdcPoint > FCDotCDC1604DashP6.NX08_H.ordinal()) {
|
||||
break;
|
||||
}
|
||||
sandWorm.add(PrimordialOctal.valueOf(cdcPoint - FCDotCDC1604DashP6.NX01_A.cakePointDotIndex()));
|
||||
if (sandWalker) {
|
||||
sandWalk.add(PrimordialOctal.valueOf(cdcPoint - FCDotCDC1604DashP6.NX01_A.cakePointDotIndex()));
|
||||
} else {
|
||||
sandSpice.add(PrimordialOctal.valueOf(cdcPoint - FCDotCDC1604DashP6.NX01_A.cakePointDotIndex()));
|
||||
}
|
||||
}
|
||||
// TODO: add signal
|
||||
lexer.cdcDECScanIndex--;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,14 +42,12 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
|
||||
void burnSandWalkerStepUnaligned(int line, int col, int size);
|
||||
|
||||
void burnNumberINT144MissingSparkler(int line, int col);
|
||||
|
||||
void burnNumberDEC144MissingSparkler(int line, int col);
|
||||
|
||||
void burnNumberFP144MissingSparkler(int line, int col);
|
||||
|
||||
void burnNumberNCR1632MissingSparkler(int line, int col);
|
||||
|
||||
void burnNumberDEC576MissingSparkler(int line, int col);
|
||||
|
||||
void burnNumberE503M72MissingSparkler(int line, int col);
|
||||
|
||||
interface Adapter extends FourCornerZionStenoLexerSmoke {
|
||||
|
||||
@Override
|
||||
|
|
@ -76,21 +74,17 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
default void burnSandWalkerStepUnaligned(int line, int col, int size) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberINT144MissingSparkler(int line, int col) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberDEC144MissingSparkler(int line, int col) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberFP144MissingSparkler(int line, int col) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberNCR1632MissingSparkler(int line, int col) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberDEC576MissingSparkler(int line, int col) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberE503M72MissingSparkler(int line, int col) {
|
||||
}
|
||||
}
|
||||
|
||||
interface AdapterMonoPipe extends FourCornerZionStenoLexerSmoke {
|
||||
|
|
@ -127,24 +121,19 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
burnMonoPipe(line, col, "burnSandWalkerStepUnaligned:" + size);
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberINT144MissingSparkler(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnNumberINT144MissingSparkler");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberDEC144MissingSparkler(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnNumberDEC144MissingSparkler");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberFP144MissingSparkler(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnNumberFP144MissingSparkler");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberNCR1632MissingSparkler(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnNumberNCR1632MissingSparkler");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberDEC576MissingSparkler(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnNumberDEC576MissingSparkler");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnNumberE503M72MissingSparkler(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnNumberE503M72MissingSparkler");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@
|
|||
*/
|
||||
package org.x4o.fc18;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
|
@ -36,10 +39,16 @@ public class FourCornerDotCakeTest {
|
|||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
Set<Integer> startPoints = new HashSet<>();
|
||||
for (FourCornerDotCake v : FourCornerDotCake.values()) {
|
||||
Assertions.assertNotNull(v);
|
||||
Assertions.assertNotNull(v.getVidePoints());
|
||||
Assertions.assertNotNull(v.tower());
|
||||
if (startPoints.contains(v.getStart())) {
|
||||
throw new IllegalStateException("Duplicate start cake point: " + Integer.toHexString(v.getStart()) + " in " + v.name());
|
||||
} else {
|
||||
startPoints.add(v.getStart());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,12 @@
|
|||
package org.x4o.fc18.cake2.pie9;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.PrimitiveIterator;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -32,10 +36,10 @@ import org.x4o.fc18.FourCornerUnicodeDisplay;
|
|||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
public class FCDotPIE9Test {
|
||||
|
||||
|
||||
String pieChars;
|
||||
String cakeChars;
|
||||
|
||||
|
||||
public FCDotPIE9Test() {
|
||||
int pieStart = FourCornerDotCake.FC_PIE9C_01.getStart();
|
||||
int pieStop = FourCornerDotCake.FC_PIE9D_27.getStop();
|
||||
|
|
@ -52,7 +56,7 @@ public class FCDotPIE9Test {
|
|||
}
|
||||
cakeChars = disp.renderFromInt18(cakePoints);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUnusedUnicodeMath() throws Exception {
|
||||
int totalMissing = 0;
|
||||
|
|
@ -60,27 +64,21 @@ public class FCDotPIE9Test {
|
|||
String testChar = new StringBuilder().appendCodePoint(i).toString();
|
||||
if (!pieChars.contains(testChar)) {
|
||||
totalMissing++;
|
||||
//System.out.println(totalMissing + ":missing-test-chr: " + testChar);
|
||||
// System.out.println(totalMissing + ":missing-test-chr: " + testChar);
|
||||
}
|
||||
}
|
||||
Assertions.assertTrue(totalMissing < 128, "To many math chars missing....");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUnusedKuTen1And2() throws Exception {
|
||||
// see: https://www.msx.org/wiki/KuTen_-_JIS_-_SJIS_Code_Conversion_Tables
|
||||
String kuTenPage1 = "、 。 , . ・ : ; ? ! ゛ ゜ ´ ` ¨"+
|
||||
"^  ̄ _ ヽ ヾ ゝ ゞ 〃 仝 々 〆 〇 ー ― ‐ / " +
|
||||
"\ ~ ∥ | … ‥ ‘ ’ “ ” ( ) 〔 〕 [ ]" +
|
||||
" } 〈 〉 《 》 「 」 『 』 【 】 + - ± ×" +
|
||||
"÷ = ≠ < > ≦ ≧ ∞ ∴ ♂ ♀ ° ′ ″ ℃ ¥" +
|
||||
"$ ¢ £ % # & * @ § ☆ ★ ○ ● ◎ ◇ ";
|
||||
String kuTenPage2 = "◆ □ ■ △ ▲ ▽ ▼ ※ 〒 → ← ↑ ↓ 〓" +
|
||||
"∈ ∋ ⊆ ⊇ ⊂ ⊃" +
|
||||
"∪ ∩ ∧ ∨ ¬ ⇒ ⇔ ∀ " +
|
||||
"∃ ∠ ⊥ ⌒ ∂ " +
|
||||
"∇ ≡ ≒ ≪ ≫ √ ∽ ∝ ∵ ∫ ∬" +
|
||||
"Å ‰ ♯ ♭ ♪ † ‡ ¶ ◯";
|
||||
String kuTenPage1 = "、。,.・:;?!゛゜´`¨" + "^ ̄_ヽヾゝゞ〃仝々〆〇ー―‐/"
|
||||
+ "\~∥|…‥‘’“”()〔〕[]" + "}〈〉《》「」『』【】+-±×"
|
||||
+ "÷=≠<>≦≧∞∴♂♀°′″℃¥" + "$¢£%#&*@§☆★○●◎◇";
|
||||
String kuTenPage2 = "◆□■△▲▽▼※〒→←↑↓〓" + "∈∋⊆⊇⊂⊃"
|
||||
+ "∪∩∧∨¬⇒⇔∀" + "∃∠⊥⌒∂"
|
||||
+ "∇≡≒≪≫√∽∝∵∫∬" + "ʼn♯♭♪†‡¶◯";
|
||||
String kuTen = (kuTenPage1 + kuTenPage2).replaceAll("\t", "").replaceAll(" ", "");
|
||||
int totalMissing = 0;
|
||||
PrimitiveIterator.OfInt charCheck = kuTen.codePoints().iterator();
|
||||
|
|
@ -88,37 +86,57 @@ public class FCDotPIE9Test {
|
|||
String testChar = new StringBuilder().appendCodePoint(charCheck.next()).toString();
|
||||
if (!cakeChars.contains(testChar)) {
|
||||
totalMissing++;
|
||||
//System.out.println(totalMissing + ":missing-test-chr: " + testChar);
|
||||
// System.out.println(totalMissing + ":missing-test-chr: " + testChar);
|
||||
}
|
||||
}
|
||||
Assertions.assertTrue(totalMissing < 128, "To many kuten chars missing....");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUnusedVGATempleOS() throws Exception {
|
||||
// see: https://github.com/rendello/templeos_font/blob/master/Convert/chars.txt
|
||||
String vgaTOSChars = " !\"#$%&'()*+,-./"+
|
||||
"0123456789:;<=>?" +
|
||||
"@ABCDEFGHIJKLMNO" +
|
||||
"PQRSTUVWXYZ[\\]^_" +
|
||||
"`abcdefghijklmno" +
|
||||
"pqrstuvwxyz{|}~ " +
|
||||
"çüéâäàȧ êëèïîìÄȦ" +
|
||||
"ÉæÆôöòûùÿÖÜ¢£¥ 𝑓" +
|
||||
"áíóú ¿ ½¼¡«»" +
|
||||
"░▒▓│┤╡╢╖╕╣║╗╝╜╛┐" +
|
||||
"└┴┬├─┼╞╟╚╔╩╦╠═╬╧" +
|
||||
"╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀" +
|
||||
"αβΓπΣσμτΦθΩδ∞ ε " +
|
||||
"≡±≤≥ ÷≈ √ⁿ² " +
|
||||
"ВГЁЖЗИЙЛПУФЧШЪЫЭ" +
|
||||
"ЮЯбвгёжзийклмнпт" +
|
||||
"чшъыьэюя „”№ " +
|
||||
" ⅠⅡ↑↓⭰⭲ " +
|
||||
"ДЦЩдф щ ij🔔 " +
|
||||
" ⅓ ¾ §¶ ";
|
||||
String vgaTOSChars = " !\"#$%&'()*+,-./" + "0123456789:;<=>?" + "@ABCDEFGHIJKLMNO" + "PQRSTUVWXYZ[\\]^_" + "`abcdefghijklmno" + "pqrstuvwxyz{|}~ "
|
||||
+ "çüéâäàȧ êëèïîìÄȦ" + "ÉæÆôöòûùÿÖÜ¢£¥ 𝑓" + "áíóú ¿ ½¼¡«»" + "░▒▓│┤╡╢╖╕╣║╗╝╜╛┐" + "└┴┬├─┼╞╟╚╔╩╦╠═╬╧" + "╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀"
|
||||
+ "αβΓπΣσμτΦθΩδ∞ ε " + "≡±≤≥ ÷≈ √ⁿ² " + "ВГЁЖЗИЙЛПУФЧШЪЫЭ" + "ЮЯбвгёжзийклмнпт" + "чшъыьэюя „”№ " + " ⅠⅡ↑↓⭰⭲ "
|
||||
+ "ДЦЩдф щ ij🔔 " + " ⅓ ¾ §¶ ";
|
||||
int totalMissing = 0;
|
||||
PrimitiveIterator.OfInt charCheck = vgaTOSChars.codePoints().iterator();
|
||||
while (charCheck.hasNext()) {
|
||||
String testChar = new StringBuilder().appendCodePoint(charCheck.next()).toString();
|
||||
if (!cakeChars.contains(testChar)) {
|
||||
totalMissing++;
|
||||
// System.out.println(totalMissing + ":missing-test-chr: " + testChar);
|
||||
}
|
||||
}
|
||||
Assertions.assertTrue(totalMissing < 128, "To many temple os chars missing....");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRussianLCGUnification() throws Exception {
|
||||
String russianAlphabetString = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя";
|
||||
Set<Character> russianSet = new HashSet<>();
|
||||
for (char c : russianAlphabetString.toCharArray()) {
|
||||
russianSet.add(c);
|
||||
}
|
||||
// todo missing: Ш (russian) -> W (upper latin W)
|
||||
// todo missing: ш (russian) -> w (small latin w)
|
||||
List<Character> latin = Arrays.asList('А', 'В', 'Е', 'К', 'М', 'Н', 'О', 'Р', 'С', 'Т', 'У', 'Х', 'а', 'е', 'о', 'р', 'с', 'у', 'х');
|
||||
// todo missing: к (russian) -> κ (small greek k)
|
||||
// todo missing: т (russian) -> τ (small greek t)
|
||||
List<Character> greek = Arrays.asList( 'Ф', 'ф', 'П', 'п', 'Л');
|
||||
List<Character> brascii = Arrays.asList( 'Ё', 'ё');
|
||||
russianSet.removeAll( new HashSet<>(latin));
|
||||
russianSet.removeAll( new HashSet<>(greek)); // 42
|
||||
russianSet.removeAll( new HashSet<>(brascii));
|
||||
Assertions.assertEquals(40, russianSet.size()); // need 44
|
||||
|
||||
String russianLCG = russianSet.stream().map(v -> new StringBuilder().append(v)).collect(Collectors.joining());
|
||||
// System.out.println("russianLCG="+russianLCG);
|
||||
// fixme: move some pair to lua like: Йй, Яя, Жж, Ээ, Дд and left over in pie slice
|
||||
// fixme2: move dec27 to end, add one lua more, thus have space for 27 + 17 candy
|
||||
|
||||
int totalMissing = 0;
|
||||
PrimitiveIterator.OfInt charCheck = russianLCG.codePoints().iterator();
|
||||
while (charCheck.hasNext()) {
|
||||
String testChar = new StringBuilder().appendCodePoint(charCheck.next()).toString();
|
||||
if (!cakeChars.contains(testChar)) {
|
||||
|
|
@ -126,6 +144,6 @@ public class FCDotPIE9Test {
|
|||
//System.out.println(totalMissing + ":missing-test-chr: " + testChar);
|
||||
}
|
||||
}
|
||||
Assertions.assertTrue(totalMissing < 128, "To many temple os chars missing....");
|
||||
Assertions.assertTrue(totalMissing < 128, "To many russian chars missing....");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,74 +48,76 @@ import org.x4o.fc18.octal8.PrimordialOctalOrangeString;
|
|||
public class StenoGrapherTest {
|
||||
|
||||
@Test
|
||||
public void testSandWalker() throws Exception {
|
||||
public void testSandWorm() throws Exception {
|
||||
List<Integer> out = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX06 = FourCornerZionStenoGrapher.writerX06(out);
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(out);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeSandWalker(List.of(PrimordialOctal.PART_1));
|
||||
writerX18.strobeSandWorm(List.of(PrimordialOctal.PART_1), 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);
|
||||
writerX18.strobeSandWorm(octalMine, List.of(PrimordialOctal.PART_1, PrimordialOctal.PART_1, PrimordialOctal.PART_1, PrimordialOctal.PART_1, PrimordialOctal.PART_1));
|
||||
String res = FourCornerUnicodeDisplay.text().renderFromInt18(out);
|
||||
Assertions.assertTrue(res.endsWith("PART_1PART_1"), "missing " + res);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testINT144Values() throws Exception {
|
||||
public void testBASE2Values() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
writerX18.strobeNumberINT144(BigInteger.valueOf(123));
|
||||
writerX18.strobeWord(FCDotCDC1604DashP6.NY19_MINUS.ordinal());
|
||||
writerX18.strobeNumberINT144(FourCornerZion7Petroglyphs.INT144_VALUE_MAX);
|
||||
writerX18.strobeNumberINT144(BigInteger.valueOf(-123));
|
||||
writerX18.strobeNumberBASE2(FourCornerZion7FremanBase2.SIGNED_0032, BigInteger.valueOf(123));
|
||||
writerX18.strobeTheWord(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
writerX18.strobeNumberBASE2(FourCornerZion7FremanBase2.SIGNED_0128, BigInteger.valueOf(-123));
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("123=-123", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBASE8Values() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
writerX18.strobeNumberBASE8(FourCornerZion7FremanBase8.SIGNED_0144, BigInteger.valueOf(123));
|
||||
writerX18.strobeTheWord(FCDotCDC1604DashP6.NY19_MINUS.ordinal());
|
||||
writerX18.strobeNumberBASE8(FourCornerZion7FremanBase8.SIGNED_0144, new BigInteger("11150372599265311570767859136324180752990207", 10));
|
||||
writerX18.strobeNumberBASE8(FourCornerZion7FremanBase8.SIGNED_0144, BigInteger.valueOf(-123));
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("123-11150372599265311570767859136324180752990207-123", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDEC144Values() throws Exception {
|
||||
public void testDEC576Values() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
writerX18.strobeNumberDEC144(BigInteger.valueOf(123), 456);
|
||||
writerX18.strobeWord(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
writerX18.strobeNumberDEC144(FourCornerZion7Petroglyphs.DEC144_COEFFICIENT_MAX, FourCornerZion7Petroglyphs.DEC144_EXPONENT_MAX);
|
||||
writerX18.strobeNumberDEC576(BigInteger.valueOf(123), BigInteger.valueOf(456));
|
||||
writerX18.strobeTheWord(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
writerX18.strobeNumberDEC576(FourCornerZion7Petroglyphs.DEC576_COEFFICIENT_MAX, FourCornerZion7Petroglyphs.DEC576_EXPONENT_MAX);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("123*10⁴⁵⁶=42535295865117307932921825928971026431*10¹³¹⁰⁷¹", resX18);
|
||||
Assertions.assertEquals("123*10⁴⁵⁶=26187124863169134960105517574620793217733136368344518315866330944769070371237396439066160738607233257207093473020480568073738052367083144426628220715007*10²³⁶¹¹⁸³²⁴¹⁴³⁴⁸²²⁶⁰²⁷⁵²", resX18);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFP144Values() throws Exception {
|
||||
public void testE503M72Values() throws Exception {
|
||||
List<Integer> outX18 = new ArrayList<>();
|
||||
FourCornerZion7Candlelier writerX18 = FourCornerZionStenoGrapher.writerX18(outX18);
|
||||
writerX18.strobeNumberFP144(true, 456, BigInteger.valueOf(123));
|
||||
writerX18.strobeWord(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
writerX18.strobeNumberFP144(false, FourCornerZion7Petroglyphs.FP144_EXPONENT_MAX, FourCornerZion7Petroglyphs.FP144_SIGNIFICAND_MAX);
|
||||
writerX18.strobeNumberE503M72(true, BigInteger.valueOf(456), BigInteger.valueOf(123));
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals("(-1)¹*2⁴⁵⁶⁻¹²⁷*1.123=(-1)⁰*2¹³¹⁰⁷¹⁻¹²⁷*1.85070591730234615865843651857942052863", resX18);
|
||||
Assertions.assertEquals("(-1)¹*2⁴⁵⁶⁻¹²⁷*1.123", resX18);
|
||||
}
|
||||
|
||||
@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.strobeNumberNCR1632(BigInteger.ONE, v1);
|
||||
writerX18.strobeNumberNCR1632(BigInteger.ONE, v1);
|
||||
BigInteger v2 = BigInteger.valueOf(12345);
|
||||
writerX06.strobeNumberNCR1632(BigInteger.ONE, v2);
|
||||
writerX18.strobeNumberNCR1632(BigInteger.ONE, v2);
|
||||
BigInteger v3 = BigInteger.valueOf(-5432);
|
||||
writerX06.strobeNumberNCR1632(v3, v3);
|
||||
writerX18.strobeNumberNCR1632(v3, v3);
|
||||
String resX06 = FourCornerUnicodeDisplay.text().renderFromInt18(outX06);
|
||||
String resX18 = FourCornerUnicodeDisplay.text().renderFromInt18(outX18);
|
||||
Assertions.assertEquals(resX18, resX06);
|
||||
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅⁻⁵⁴³²/₋₅₄₃₂", resX06);
|
||||
Assertions.assertEquals("¹/₁₂₃¹/₁₂₃₄₅⁻⁵⁴³²/₋₅₄₃₂", resX18);
|
||||
}
|
||||
|
||||
//Test TODO: MOVE + fix java.io.IOException: Expected 9 bytes, got: 3 from PrimordialOctalOrangeString.ioSmurfReadStreamX8
|
||||
|
|
@ -129,7 +131,7 @@ public class StenoGrapherTest {
|
|||
for (int x = 1; x <= 1025 /*_999999*/; x++) {
|
||||
BigInteger v = BigInteger.valueOf(x);
|
||||
writerX18.strobeNumberNCR1632(BigInteger.ONE, v);
|
||||
writerX18.strobeWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex());
|
||||
writerX18.strobeTheWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex());
|
||||
}
|
||||
writerX18.strobeDocumentOmega();
|
||||
PrimordialOctalOrangeString str = PrimordialOctalOrangeString.ioSmurfReadListX18(outX18);
|
||||
|
|
@ -149,21 +151,13 @@ public class StenoGrapherTest {
|
|||
|
||||
@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.strobeNumberNCR1632(BigInteger.ONE, v);
|
||||
writerX18.strobeNumberNCR1632(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);
|
||||
|
|
@ -171,18 +165,9 @@ public class StenoGrapherTest {
|
|||
|
||||
@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("7FFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF"+"FFFFFFFFFFFFFFFFFF", 16);
|
||||
writerX06.strobeNumberNCR1632(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeNumberNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
});
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX06.strobeNumberNCR1632(maxValue.add(BigInteger.ONE), maxValue);
|
||||
});
|
||||
writerX18.strobeNumberNCR1632(maxValue, maxValue);
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> {
|
||||
writerX18.strobeNumberNCR1632(maxValue, maxValue.add(BigInteger.ONE));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
|||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class StenoLexerNCRTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testNCRSmokeSignals() throws Exception {
|
||||
TestSmokeReader smokeReader = new TestSmokeReader();
|
||||
|
|
@ -47,29 +47,29 @@ public class StenoLexerNCRTest {
|
|||
lexer.withSmokeSignals(smokeReader);
|
||||
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + (512*3) + 1); /// auto NXX_001
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart() + (512*3) + 1); /// auto NXX_001
|
||||
Assertions.assertEquals(0, smokeReader.pipeSmokeClouds);
|
||||
lexer.read(cdc);
|
||||
Assertions.assertEquals(1, smokeReader.pipeSmokeClouds);
|
||||
Assertions.assertEquals("burnNumberNCR1632MissingSparkler", smokeReader.pipeError);
|
||||
|
||||
cdc.addAll(FCDotDEC2701DashPX0.ESC_STOP.baklavaPointSequence()); // the print above auto value + next test
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() - 1 + 123); // normal NXX_123
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + (512*4) + 2); /// auto NXX_123 + this
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart() - 1 + 123); // normal NXX_123
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart() + (512*4) + 2); /// auto NXX_123 + this
|
||||
smokeReader.reset();
|
||||
lexer.read(cdc);
|
||||
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() + 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.getStart() + 123); // normal NXX_123
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart() + 11);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart() + (512*3) + 12);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart() + (512*4) + 13);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart() + (512*5) + 14);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart()); // and one which prints
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart() + 123); // normal NXX_123
|
||||
smokeReader.reset();
|
||||
lexer.read(cdc);
|
||||
String res = "[0:1:burnNumberNCR1632MissingSparkler][0:8:burnNumberNCR1632MissingSparkler]¹³⁷⁴³⁸⁹⁵³⁵⁹⁴/₁₃₄₂₁₇₇₃₉[0:16:burnNumberNCR1632MissingSparkler]";
|
||||
String res = "[0:1:burnNumberNCR1632MissingSparkler][0:8:burnNumberNCR1632MissingSparkler][0:16:burnNumberNCR1632MissingSparkler]";
|
||||
Assertions.assertEquals(res, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
|
||||
|
|
@ -79,37 +79,49 @@ public class StenoLexerNCRTest {
|
|||
cdc.add(FCDotCDC1604DashP6.NX24_X.ordinal()); // = X
|
||||
cdc.add(FCDotCDC1604DashP6.NY09_EQUALS.ordinal());
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 11);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 11);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 1);
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 1);
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 14);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 15);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 14);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.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_SEL0N.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 123);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart() + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 1); // 4096
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 1); // +1 = 4097
|
||||
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_NUM.getStart() + 4);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_DEN.getStart() + 1);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 4);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStart());
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStart() + 1);
|
||||
cdc.add(FCDotCDC1604DashP6.NY14_SEMICOLON.ordinal());
|
||||
|
||||
Assertions.assertEquals("X=¹¹/₁¹/₁¹⁴/₁₅¹²³/₁₀₂₅⁴/₁;", FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
Assertions.assertEquals("X=¹¹/₁¹/₁¹⁴/₁₅¹²³/₄₀₉₇⁴/₁;", FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNCRLargestF576() throws Exception {
|
||||
List<Integer> cdc = new ArrayList<>();
|
||||
for (int i = FourCornerDotCake.FC_NCR1632_NUM.getStop(); i >= FourCornerDotCake.FC_NCR1632_NUM.getStart(); i = i - 512) {
|
||||
cdc.add(i);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL0N.getStop());
|
||||
for (int i = FourCornerDotCake.FC_NCR1632_SEL0N.getStop(); i >= FourCornerDotCake.FC_NCR1632_SEL0N.getStart(); i--) {
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStop());
|
||||
}
|
||||
for (int i = FourCornerDotCake.FC_NCR1632_DEN.getStop(); i >= FourCornerDotCake.FC_NCR1632_DEN.getStart(); i = i - 512) {
|
||||
cdc.add(i);
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_SEL1D.getStop());
|
||||
for (int i = FourCornerDotCake.FC_NCR1632_SEL1D.getStop(); i >= FourCornerDotCake.FC_NCR1632_SEL1D.getStart(); i--) {
|
||||
cdc.add(FourCornerDotCake.FC_NCR1632_BANK.getStop());
|
||||
}
|
||||
String resSuper = "⁻¹⁹³²²⁶⁸⁷⁶¹⁵⁰⁸⁶²⁹¹⁷²³⁴⁷⁶⁷⁵⁹⁴⁵⁴⁶⁵⁹⁹³⁶⁷²¹⁴⁹⁴⁶³⁶⁶⁴⁸⁵³²¹⁷⁴⁹⁹³²⁸⁶¹⁷⁶²⁵⁷²⁵⁷⁵⁹⁵⁷¹¹⁴⁴⁷⁸⁰²¹²²⁶⁸⁰⁹⁶⁸⁸³²⁹⁰⁹⁶¹²⁸⁸⁹⁸¹²³¹⁸⁰⁸⁰¹⁵⁷⁵¹⁰⁸⁸⁵⁸⁸⁶⁸²⁵³⁹³³⁰⁵²¹⁴⁹³⁸²⁷⁸⁷¹⁴⁵⁴³³⁶⁷³³⁵⁴⁰³⁷⁴³⁴⁸⁴⁹⁰⁴⁰⁷⁴¹¹⁷¹¹";
|
||||
String resSuber = "₋₁₉₃₂₂₆₈₇₆₁₅₀₈₆₂₉₁₇₂₃₄₇₆₇₅₉₄₅₄₆₅₉₉₃₆₇₂₁₄₉₄₆₃₆₆₄₈₅₃₂₁₇₄₉₉₃₂₈₆₁₇₆₂₅₇₂₅₇₅₉₅₇₁₁₄₄₇₈₀₂₁₂₂₆₈₀₉₆₈₈₃₂₉₀₉₆₁₂₈₈₉₈₁₂₃₁₈₀₈₀₁₅₇₅₁₀₈₈₅₈₈₆₈₂₅₃₉₃₃₀₅₂₁₄₉₃₈₂₇₈₇₁₄₅₄₃₃₆₇₃₃₅₄₀₃₇₄₃₄₈₄₉₀₄₀₇₄₁₁₇₁₁";
|
||||
String resSuper = "⁻¹²³⁶⁶⁵²⁰⁰⁷³⁶⁵⁵²²⁶⁷⁰³⁰²⁵¹²⁶⁰⁵⁰⁹⁸²³⁵⁹⁵⁰¹⁷⁵⁶⁵⁶⁷⁴⁵⁵⁰⁶⁰⁵⁹¹⁹⁹⁵⁷⁰³¹⁵²⁸⁰⁴⁶⁴⁴⁸⁶¹²⁵⁵³²⁶⁵⁹³³⁵⁸⁵¹⁵⁸²⁰⁰⁵³⁰⁶²¹⁵²²⁴⁹⁴⁷⁹⁸⁸³⁵⁷¹³⁰⁰⁸⁰⁶⁹⁶⁶⁹⁶⁷⁵⁶⁸²⁵¹⁷¹⁵³³⁷⁵⁶⁰⁴⁹⁸³⁷⁷³⁰⁷⁷⁵⁵⁰⁹⁴⁶⁵⁸³⁹⁵⁸³⁰³³⁸⁶⁰⁷⁴³⁴⁹⁵⁶⁷";
|
||||
String resSuber = "₋₁₂₃₆₆₅₂₀₀₇₃₆₅₅₂₂₆₇₀₃₀₂₅₁₂₆₀₅₀₉₈₂₃₅₉₅₀₁₇₅₆₅₆₇₄₅₅₀₆₀₅₉₁₉₉₅₇₀₃₁₅₂₈₀₄₆₄₄₈₆₁₂₅₅₃₂₆₅₉₃₃₅₈₅₁₅₈₂₀₀₅₃₀₆₂₁₅₂₂₄₉₄₇₉₈₈₃₅₇₁₃₀₀₈₀₆₉₆₆₉₆₇₅₆₈₂₅₁₇₁₅₃₃₇₅₆₀₄₉₈₃₇₇₃₀₇₇₅₅₀₉₄₆₅₈₃₉₅₈₃₀₃₃₈₆₀₇₄₃₄₉₅₆₇";
|
||||
Assertions.assertEquals(resSuper + "/" + resSuber, FourCornerUnicodeDisplay.text().renderFromInt18(cdc));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue