FC18: Removed recursieve fc18 access for 6 and 8 bit systems.
This commit is contained in:
parent
e2f54ec3ea
commit
ddda38ffaa
7 changed files with 6 additions and 112 deletions
|
|
@ -24,7 +24,6 @@ package org.x4o.fc18;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.PrimitiveIterator;
|
import java.util.PrimitiveIterator;
|
||||||
|
|
||||||
|
|
@ -36,7 +35,6 @@ import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash10;
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash11;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash11;
|
||||||
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20;
|
import org.x4o.fc18.cake2.pie9c.FCDotPIE9CDash20;
|
||||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
|
||||||
|
|
||||||
/// Holds different lookup and conversion maps towards four corner int18 cake points.
|
/// Holds different lookup and conversion maps towards four corner int18 cake points.
|
||||||
///
|
///
|
||||||
|
|
@ -50,50 +48,6 @@ final public class FourCornerRecipe {
|
||||||
private FourCornerRecipe() {
|
private FourCornerRecipe() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static public List<Integer> embedFC18(List<Integer> cakePoints) {
|
|
||||||
if (cakePoints.isEmpty()) {
|
|
||||||
return cakePoints;
|
|
||||||
}
|
|
||||||
boolean lostEnd = false;
|
|
||||||
List<Integer> result = new ArrayList<>();
|
|
||||||
Iterator<Integer> i = cakePoints.iterator();
|
|
||||||
while (i.hasNext()) {
|
|
||||||
int cakePoint = i.next();
|
|
||||||
if (cakePoint < 64) {
|
|
||||||
result.add(cakePoint);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!i.hasNext()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
boolean closeEnd = true;
|
|
||||||
result.addAll(FCDotDEC2701DashPX0.ESC68_FC18.baklavaPointSequence());
|
|
||||||
while (i.hasNext()) {
|
|
||||||
lostEnd = false;
|
|
||||||
if (cakePoint < 64) {
|
|
||||||
result.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex());
|
|
||||||
result.add(cakePoint);
|
|
||||||
closeEnd = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (int cakePointIdx=0;cakePointIdx<=6;cakePointIdx++) {
|
|
||||||
int octal = (cakePoint >> ((6-cakePointIdx)*3)) & 0b111;
|
|
||||||
int letter = octal + FCDotCDC1604DashP6.NX01_A.ordinal();
|
|
||||||
result.add(letter);
|
|
||||||
}
|
|
||||||
cakePoint = i.next();
|
|
||||||
lostEnd = true;
|
|
||||||
}
|
|
||||||
if (closeEnd) {
|
|
||||||
result.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex());
|
|
||||||
}
|
|
||||||
if (lostEnd) {
|
|
||||||
result.add(cakePoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated // TODO: move to sand worm
|
@Deprecated // TODO: move to sand worm
|
||||||
static public List<Integer> embedUNI2K(String value) {
|
static public List<Integer> embedUNI2K(String value) {
|
||||||
List<Integer> result = new ArrayList<>(value.length());
|
List<Integer> result = new ArrayList<>(value.length());
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,6 @@ public class FourCornerUnicodeDisplay {
|
||||||
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZion7WaterCodex, FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZion7WaterCodex, FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
||||||
|
|
||||||
private final StringBuilder output;
|
private final StringBuilder output;
|
||||||
private FourCornerZionStenoLexer thisDisplayEscaked = null;
|
|
||||||
private boolean wasExternalWord = false;
|
private boolean wasExternalWord = false;
|
||||||
|
|
||||||
private StenoUnicodePrinter(StringBuilder output) {
|
private StenoUnicodePrinter(StringBuilder output) {
|
||||||
|
|
@ -232,14 +231,6 @@ public class FourCornerUnicodeDisplay {
|
||||||
renderFromInt18(math, output);
|
renderFromInt18(math, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void strobeRecursiveCake(List<Integer> cakePoints) {
|
|
||||||
if (thisDisplayEscaked == null) {
|
|
||||||
thisDisplayEscaked = new FourCornerZionStenoLexer(this, true);
|
|
||||||
}
|
|
||||||
thisDisplayEscaked.read(cakePoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,7 @@ public enum FCDotDEC2701DashPX0 implements FourCornerX06BaklavaPointSequence, Fo
|
||||||
ESC68_NCR,
|
ESC68_NCR,
|
||||||
|
|
||||||
/// _ESC6_X2 _ESC6_X3 _ESC6_X3 = 18
|
/// _ESC6_X2 _ESC6_X3 _ESC6_X3 = 18
|
||||||
/// On 6/8 bit escape to 18 bit four corner cake points.
|
__ESC_RESERVED_B9,
|
||||||
/// Stream per six octals as CDC chars in NX01_A to NX08_H, and MUST end with !.
|
|
||||||
ESC68_FC18,
|
|
||||||
|
|
||||||
// =========== Internal control sequences
|
// =========== Internal control sequences
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,6 @@ public interface FourCornerZion7Candlelier {
|
||||||
/// 1152 bit fractions of two 576 bit numbers.
|
/// 1152 bit fractions of two 576 bit numbers.
|
||||||
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
||||||
|
|
||||||
/// Allows a 6 bit computer to use the full FC18 space for nether or fractions.
|
|
||||||
void strobeRecursiveCake(List<Integer> cakePoints);
|
|
||||||
|
|
||||||
/// Octal sand walker, with an 72 to 576 bit mime-type rhythm header.
|
/// Octal sand walker, with an 72 to 576 bit mime-type rhythm header.
|
||||||
void strobeSandWalker(List<PrimordialOctal> rhythm);
|
void strobeSandWalker(List<PrimordialOctal> rhythm);
|
||||||
|
|
||||||
|
|
@ -65,10 +62,6 @@ public interface FourCornerZion7Candlelier {
|
||||||
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default void strobeRecursiveCake(List<Integer> cakePoints) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
default void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,10 +68,6 @@ public class FourCornerZionStenoGrapher {
|
||||||
FourCornerRecipe.embedNCR1632Numerator(out, numerator);
|
FourCornerRecipe.embedNCR1632Numerator(out, numerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void strobeRecursiveCake(List<Integer> cakePoints) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
public void strobeSandWalker(List<PrimordialOctal> rhythm) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -622,9 +622,6 @@ public class FourCornerZionStenoLexer {
|
||||||
if (FCDotDEC2701DashPX0.ESC68_NCR.equals(cdcDECMode)) {
|
if (FCDotDEC2701DashPX0.ESC68_NCR.equals(cdcDECMode)) {
|
||||||
return handleNCR(lexer); // TODO: add small bank switching ?
|
return handleNCR(lexer); // TODO: add small bank switching ?
|
||||||
}
|
}
|
||||||
if (FCDotDEC2701DashPX0.ESC68_FC18.equals(cdcDECMode)) {
|
|
||||||
return handleFC18(lexer);
|
|
||||||
}
|
|
||||||
if (FCDotDEC2701DashPX0.ESC_DEC0801_E10.equals(cdcDECMode)) {
|
if (FCDotDEC2701DashPX0.ESC_DEC0801_E10.equals(cdcDECMode)) {
|
||||||
return handleE10(lexer);
|
return handleE10(lexer);
|
||||||
}
|
}
|
||||||
|
|
@ -796,41 +793,6 @@ public class FourCornerZionStenoLexer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean handleFC18(FourCornerZionStenoLexer lexer) {
|
|
||||||
lexer.decModeReset();
|
|
||||||
List<List<Integer>> result = new ArrayList<>();
|
|
||||||
scanSalahRakaAt(lexer, result);
|
|
||||||
if (result.isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
List<Integer> renderCakePoints = new ArrayList<>();
|
|
||||||
for (List<Integer> argu : result) {
|
|
||||||
int cakePointArgu = 0;
|
|
||||||
int cakePointIdx = 6;
|
|
||||||
for (Integer octal : argu) {
|
|
||||||
if (octal < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (octal > FCDotCDC1604DashP6.NX08_H.ordinal()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int offset = octal - FCDotCDC1604DashP6.NX01_A.ordinal();
|
|
||||||
cakePointArgu = cakePointArgu + (offset << (cakePointIdx*3));
|
|
||||||
cakePointIdx--;
|
|
||||||
if (cakePointIdx < 0) {
|
|
||||||
renderCakePoints.add(cakePointArgu);
|
|
||||||
cakePointIdx = 6;
|
|
||||||
cakePointArgu = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (renderCakePoints.isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
lexer.handler.strobeRecursiveCake(renderCakePoints);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean scanSalahRakaAt(FourCornerZionStenoLexer lexer, List<List<Integer>> result) {
|
private boolean scanSalahRakaAt(FourCornerZionStenoLexer lexer, List<List<Integer>> result) {
|
||||||
List<Integer> argu = new ArrayList<>();
|
List<Integer> argu = new ArrayList<>();
|
||||||
while (lexer.cdcDECScanIndex <= lexer.cdcDECScanIndexEnd) {
|
while (lexer.cdcDECScanIndex <= lexer.cdcDECScanIndexEnd) {
|
||||||
|
|
|
||||||
|
|
@ -114,15 +114,15 @@ public class FourCornerUnicodeDisplayTest {
|
||||||
int bitsFC18 = cdc.size()*18;
|
int bitsFC18 = cdc.size()*18;
|
||||||
Assertions.assertTrue(bitsFC18 < bitsUTF8, "FC18 is not smaller");
|
Assertions.assertTrue(bitsFC18 < bitsUTF8, "FC18 is not smaller");
|
||||||
|
|
||||||
List<Integer> cdc6 = FourCornerRecipe.embedFC18(cdc);
|
//List<Integer> cdc6 = FourCornerRecipe.embedFC18(cdc);
|
||||||
Assertions.assertEquals(outputExpected, FourCornerUnicodeDisplay.text().renderFromInt18(cdc6));
|
//Assertions.assertEquals(outputExpected, FourCornerUnicodeDisplay.text().renderFromInt18(cdc6));
|
||||||
Assertions.assertTrue(cdc6.size() > cdc.size(), "FCx6 is not bigger");
|
//Assertions.assertTrue(cdc6.size() > cdc.size(), "FCx6 is not bigger");
|
||||||
|
|
||||||
System.out.println("size FC18="+cdc.size());
|
System.out.println("size FC18="+cdc.size());
|
||||||
System.out.println("size 0x21="+outputExpected.length());
|
System.out.println("size 0x21="+outputExpected.length());
|
||||||
System.out.println("size UTF8="+outputExpected.getBytes(StandardCharsets.UTF_8).length);
|
System.out.println("size UTF8="+outputExpected.getBytes(StandardCharsets.UTF_8).length);
|
||||||
System.out.println("size FCx6="+cdc6.size());
|
//System.out.println("size FCx6="+cdc6.size());
|
||||||
System.out.println("raw FCx6="+FourCornerUnicodeDisplay.raw().renderFromInt18(cdc6));
|
//System.out.println("raw FCx6="+FourCornerUnicodeDisplay.raw().renderFromInt18(cdc6));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue