Added single word strobe to FC18 lexer candlelier
This commit is contained in:
parent
0d54b152dc
commit
73d408f1ec
|
@ -135,9 +135,12 @@ public class FourCornerUnicodeDisplay {
|
||||||
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZionStenoLexerSmoke.Adapter {
|
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZionStenoLexerSmoke.Adapter {
|
||||||
|
|
||||||
private final StringBuilder output;
|
private final StringBuilder output;
|
||||||
|
private final FourCornerZionStenoLexer thisDisplayEscaked;
|
||||||
|
private boolean wasExternalWord = false;
|
||||||
|
|
||||||
private StenoUnicodePrinter(StringBuilder output) {
|
private StenoUnicodePrinter(StringBuilder output) {
|
||||||
this.output = Objects.requireNonNull(output);
|
this.output = Objects.requireNonNull(output);
|
||||||
|
this.thisDisplayEscaked = new FourCornerZionStenoLexer(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean printedEscape(FourCornerDotCake slice, int offset) {
|
private boolean printedEscape(FourCornerDotCake slice, int offset) {
|
||||||
|
@ -164,61 +167,58 @@ public class FourCornerUnicodeDisplay {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeWords(FourCornerDotCake slice, List<Integer> offsets) {
|
public void strobeWords(FourCornerDotCake slice, List<Integer> offsets) {
|
||||||
|
for (int i = 0; i < offsets.size(); i++) {
|
||||||
|
strobeWord(slice, offsets.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void strobeWord(FourCornerDotCake slice, int offset) {
|
||||||
|
if (printedEscape(slice, offset)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
FourCornerX00PetitVidePoints[] videPoints = slice.getVidePoints();
|
FourCornerX00PetitVidePoints[] videPoints = slice.getVidePoints();
|
||||||
|
|
||||||
if (slice.isExternWord()) {
|
if (slice.isExternWord()) {
|
||||||
String fcQName = slice.qname();
|
String fcQName = slice.qname();
|
||||||
Iterator<Integer> i = offsets.iterator();
|
String key = fcQName + "." + Integer.toString(offset);
|
||||||
while (i.hasNext()) {
|
String value = null;
|
||||||
Integer offset = i.next();
|
if (value != null) {
|
||||||
if (printedEscape(slice, offset)) {
|
output.append(value);
|
||||||
continue;
|
} else {
|
||||||
}
|
FourCornerX00PetitVidePoints videPoint = videPoints[offset];
|
||||||
String key = fcQName + "." + Integer.toString(offset);
|
if (videPoint instanceof FourCornerX18CakeWord) {
|
||||||
String value = null;
|
FourCornerX18CakeWord cakeWord = FourCornerX18CakeWord.class.cast(videPoint);
|
||||||
if (value != null) {
|
FourCornerX18CakePoints[] wordDefault = cakeWord.nameDefault();
|
||||||
output.append(value);
|
for (FourCornerX18CakePoints letter : wordDefault) {
|
||||||
} else {
|
if (letter.isX21()) {
|
||||||
FourCornerX00PetitVidePoints videPoint = videPoints[offset];
|
Arrays.stream(letter.toX21().codePoints()).forEach(v -> output.appendCodePoint(v));
|
||||||
if (videPoint instanceof FourCornerX18CakeWord) {
|
|
||||||
FourCornerX18CakeWord cakeWord = FourCornerX18CakeWord.class.cast(videPoint);
|
|
||||||
FourCornerX18CakePoints[] wordDefault = cakeWord.nameDefault();
|
|
||||||
for (FourCornerX18CakePoints letter : wordDefault) {
|
|
||||||
if (letter.isX21()) {
|
|
||||||
Arrays.stream(letter.toX21().codePoints()).forEach(v -> output.appendCodePoint(v));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (renderSeperator != null && i.hasNext()) {
|
|
||||||
output.append(renderSeperator);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (renderSeperator != null && wasExternalWord) {
|
||||||
|
output.append(renderSeperator);
|
||||||
|
}
|
||||||
|
wasExternalWord = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
wasExternalWord = false;
|
||||||
|
|
||||||
if (videPoints.length > 0) {
|
if (videPoints.length > 0) {
|
||||||
for (Integer offset : offsets) {
|
//if (offset < 0 || offset > videPoints.length) {
|
||||||
if (printedEscape(slice, offset)) {
|
// continue;
|
||||||
continue;
|
//}
|
||||||
}
|
FourCornerX00PetitVidePoints videPoint = videPoints[offset];
|
||||||
//if (offset < 0 || offset > videPoints.length) {
|
if (videPoint.isX21()) {
|
||||||
// continue;
|
Arrays.stream(videPoint.toX21().codePoints()).forEach(v -> output.appendCodePoint(v));
|
||||||
//}
|
|
||||||
FourCornerX00PetitVidePoints videPoint = videPoints[offset];
|
|
||||||
if (videPoint.isX21()) {
|
|
||||||
Arrays.stream(videPoint.toX21().codePoints()).forEach(v -> output.appendCodePoint(v));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
output.append(slice.name());
|
output.append(slice.name());
|
||||||
output.append("#");
|
output.append("#");
|
||||||
for (Integer offset : offsets) {
|
output.append(offset);
|
||||||
output.append(offset);
|
|
||||||
output.append("-");
|
|
||||||
}
|
|
||||||
output.append("#");
|
output.append("#");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,6 @@ public class FourCornerUnicodeDisplay {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeRecursiveCake(List<Integer> cakePoints) {
|
public void strobeRecursiveCake(List<Integer> cakePoints) {
|
||||||
FourCornerZionStenoLexer thisDisplayEscaked = new FourCornerZionStenoLexer(this, true);
|
|
||||||
thisDisplayEscaked.read(cakePoints);
|
thisDisplayEscaked.read(cakePoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ public interface FourCornerZion7Candlelier {
|
||||||
/// Block of relative slice numbers.
|
/// Block of relative slice numbers.
|
||||||
void strobeWords(FourCornerDotCake slice, List<Integer> offsets);
|
void strobeWords(FourCornerDotCake slice, List<Integer> offsets);
|
||||||
|
|
||||||
|
void strobeWord(FourCornerDotCake slice, int offset);
|
||||||
|
|
||||||
/// One based already
|
/// One based already
|
||||||
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
||||||
|
|
||||||
|
@ -51,6 +53,10 @@ public interface FourCornerZion7Candlelier {
|
||||||
default void strobeWords(FourCornerDotCake slice, List<Integer> offsets) {
|
default void strobeWords(FourCornerDotCake slice, List<Integer> offsets) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void strobeWord(FourCornerDotCake slice, int offset) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
default void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,9 +399,9 @@ public class FourCornerZionStenoLexer {
|
||||||
// No escaping, print CDC or DEC code
|
// No escaping, print CDC or DEC code
|
||||||
if (!lexer.handlerEscape) {
|
if (!lexer.handlerEscape) {
|
||||||
if (FourCornerDotCake.FC_DEC0127_PX0.contains(cdcDECPoint)) {
|
if (FourCornerDotCake.FC_DEC0127_PX0.contains(cdcDECPoint)) {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_DEC0127_PX0, List.of(cdcDECPoint - FourCornerDotCake.FC_DEC0127_PX0.getStart()));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_DEC0127_PX0, cdcDECPoint - FourCornerDotCake.FC_DEC0127_PX0.getStart());
|
||||||
} else {
|
} else {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_CDC1604_P6, List.of(cdcDECPoint));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcDECPoint);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -498,27 +498,27 @@ public class FourCornerZionStenoLexer {
|
||||||
|
|
||||||
// FIXME: this pages need a stop on out of range too
|
// FIXME: this pages need a stop on out of range too
|
||||||
if (decMode == FCDotDEC0127DashPX0.ESC6_APL0127_P7A) {
|
if (decMode == FCDotDEC0127DashPX0.ESC6_APL0127_P7A) {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_APL0127_P7A, List.of(cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal()));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_APL0127_P7A, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (decMode == FCDotDEC0127DashPX0.ESC6_APL0127_P7B) {
|
if (decMode == FCDotDEC0127DashPX0.ESC6_APL0127_P7B) {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_APL0127_P7B, List.of(cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal()));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_APL0127_P7B, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (decMode == FCDotDEC0127DashPX0.ESC6_APL0127_P7C) {
|
if (decMode == FCDotDEC0127DashPX0.ESC6_APL0127_P7C) {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_APL0127_P7C, List.of(cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal()));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_APL0127_P7C, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (decMode == FCDotDEC0127DashPX0.ESC6_BYD0127_P7D) {
|
if (decMode == FCDotDEC0127DashPX0.ESC6_BYD0127_P7D) {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_BYD0127_P7D, List.of(cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal()));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_BYD0127_P7D, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (decMode == FCDotDEC0127DashPX0.ESC6_BYD0127_P7E) {
|
if (decMode == FCDotDEC0127DashPX0.ESC6_BYD0127_P7E) {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_BYD0127_P7E, List.of(cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal()));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_BYD0127_P7E, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (decMode == FCDotDEC0127DashPX0.ESC6_BYD0127_P7F) {
|
if (decMode == FCDotDEC0127DashPX0.ESC6_BYD0127_P7F) {
|
||||||
lexer.handler.strobeWords(FourCornerDotCake.FC_BYD0127_P7F, List.of(cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal()));
|
lexer.handler.strobeWord(FourCornerDotCake.FC_BYD0127_P7F, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,14 +540,14 @@ public class FourCornerZionStenoLexer {
|
||||||
lexer.smokeSignals.burnUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
lexer.smokeSignals.burnUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lexer.handler.strobeWords(slice.get(), List.of(cdcPoint));
|
lexer.handler.strobeWord(slice.get(), cdcPoint);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (numberPIE) {
|
if (numberPIE) {
|
||||||
int terminatorOffZero = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal();
|
int terminatorOffZero = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal();
|
||||||
int numberIdxOffZero = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal();
|
int numberIdxOffZero = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal();
|
||||||
FourCornerDotCake slice = FourCornerDotCake.values()[terminatorOffZero + FourCornerDotCake.FC_PIE9C_01.ordinal()];
|
FourCornerDotCake slice = FourCornerDotCake.values()[terminatorOffZero + FourCornerDotCake.FC_PIE9C_01.ordinal()];
|
||||||
lexer.handler.strobeWords(slice, List.of(numberIdxOffZero));
|
lexer.handler.strobeWord(slice, numberIdxOffZero);
|
||||||
} else { // _PIN = ²⁄₁₂
|
} else { // _PIN = ²⁄₁₂
|
||||||
int terminatorOff = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal() + 1;
|
int terminatorOff = numberMode - FCDotCDC1604DashP6.NX01_A.ordinal() + 1;
|
||||||
int numberIdxOff = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal() + 1;
|
int numberIdxOff = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal() + 1;
|
||||||
|
|
Loading…
Reference in a new issue