Removed slice offset with relative offsets from read/write api of FC18
This commit is contained in:
parent
2850174c63
commit
8cabc8eb0d
6 changed files with 119 additions and 51 deletions
|
|
@ -26,6 +26,7 @@ import java.math.BigInteger;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
|
@ -129,10 +130,10 @@ public class FourCornerUnicodeDisplay {
|
|||
this.output = Objects.requireNonNull(output);
|
||||
}
|
||||
|
||||
private boolean printedEscape(FourCornerDotCake slice, int offset) {
|
||||
private boolean printedEscape(FourCornerDotCake slice, int cakePoint) {
|
||||
if (FourCornerDotCake.FC_CDC1604_P6.equals(slice)) {
|
||||
if (offset < 4) {
|
||||
output.appendCodePoint(FCDotPIE9DDash09.values()[offset].codePointDotIndex());
|
||||
if (cakePoint < 4) {
|
||||
output.appendCodePoint(FCDotPIE9DDash09.values()[cakePoint].codePointDotIndex());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -156,27 +157,35 @@ public class FourCornerUnicodeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void strobeWords(FourCornerDotCake slice, List<Integer> offsets) {
|
||||
for (int i = 0; i < offsets.size(); i++) {
|
||||
strobeWord(slice, offsets.get(i));
|
||||
public void strobeWords(List<Integer> cakePoints) {
|
||||
for (int i = 0; i < cakePoints.size(); i++) {
|
||||
strobeWord(cakePoints.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeWord(FourCornerDotCake slice, int offset) {
|
||||
if (printedEscape(slice, offset)) {
|
||||
public void strobeWord(int cakePoint) {
|
||||
|
||||
// TODO: remove slice here;
|
||||
Optional<FourCornerDotCake> sliceOpt = FourCornerDotCake.valueFromCakePoint(cakePoint);
|
||||
if (sliceOpt.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
FourCornerDotCake slice = sliceOpt.get();
|
||||
|
||||
if (printedEscape(slice, cakePoint)) {
|
||||
return;
|
||||
}
|
||||
FourCornerX00PetitVide[] videPoints = slice.getVidePoints();
|
||||
|
||||
if (slice.isExternWord()) {
|
||||
String nameSpec = slice.nameSpec();
|
||||
String key = nameSpec + "." + Integer.toString(offset);
|
||||
String key = nameSpec + "." + Integer.toString(cakePoint);
|
||||
String value = null;
|
||||
if (value != null) {
|
||||
output.append(value);
|
||||
} else {
|
||||
FourCornerX00PetitVide videPoint = videPoints[offset];
|
||||
FourCornerX00PetitVide videPoint = videPoints[cakePoint - slice.getStart()];
|
||||
if (videPoint.kaasX18CakeDotName().isPresent()) {
|
||||
List<FourCornerX18CakePointSequence> nameX18 = videPoint.kaasX18CakeDotName().get().nameX18();
|
||||
for (FourCornerX18CakePointSequence letter : nameX18) {
|
||||
|
|
@ -200,7 +209,7 @@ public class FourCornerUnicodeDisplay {
|
|||
//if (offset < 0 || offset > videPoints.length) {
|
||||
// continue;
|
||||
//}
|
||||
FourCornerX00PetitVide videPoint = videPoints[offset];
|
||||
FourCornerX00PetitVide videPoint = videPoints[cakePoint - slice.getStart()];
|
||||
videPoint.kaasX21CodeSequence().ifPresent(v -> {
|
||||
v.codePointSequence().forEach(vv -> output.appendCodePoint(vv));
|
||||
});
|
||||
|
|
@ -209,7 +218,7 @@ public class FourCornerUnicodeDisplay {
|
|||
|
||||
output.append(slice.name());
|
||||
output.append("#");
|
||||
output.append(offset);
|
||||
output.append(cakePoint);
|
||||
output.append("#");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,12 @@ public enum FourCornerDotCake {
|
|||
|
||||
// =========== Allow pie terminators for symbols without escaping
|
||||
|
||||
// build from ovewviews;
|
||||
// - https://www.msx.org/wiki/KuTen_-_JIS_-_SJIS_Code_Conversion_Tables
|
||||
// - https://en.wikipedia.org/wiki/Digital_encoding_of_APL_symbols
|
||||
// - https://en.wikipedia.org/wiki/BraSCII
|
||||
// - https://en.wikipedia.org/wiki/List_of_Unicode_characters
|
||||
|
||||
FC_PIE9C_01(256 + 0 , 1, FCDotPIE9CDash01.values()),
|
||||
FC_PIE9C_02(1 + FC_PIE9C_01.getStop(), 2, FCDotPIE9CDash02.values()),
|
||||
FC_PIE9C_03(1 + FC_PIE9C_02.getStop(), 3, FCDotPIE9CDash03.values()),
|
||||
|
|
|
|||
|
|
@ -25,29 +25,22 @@ package org.x4o.fc18.zion7;
|
|||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
|
||||
/// Handles the main lexer four corner cake strobes.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 09, 2025
|
||||
public interface FourCornerZion7Candlelier {
|
||||
|
||||
// TODO: remove dot cake enum and change offsets to full cake points
|
||||
// (and remove duplicate list objects like;)
|
||||
// maybe remove cakeSliceStart as that is not needed for write support, (is already in fire)
|
||||
//void strobeWords(List<Integer> text, int textStart, int textStop, int cakeSliceStart);
|
||||
/// Single word cake point.
|
||||
void strobeWord(int cakePoint);
|
||||
|
||||
/// Single word from slice.
|
||||
void strobeWord(FourCornerDotCake slice, int offset);
|
||||
|
||||
/// Block of relative word slice offsets.
|
||||
void strobeWords(FourCornerDotCake slice, List<Integer> offsets);
|
||||
/// Block of word cake points.
|
||||
void strobeWords(List<Integer> cakePoints);
|
||||
|
||||
/// 1152 bit fractions of two 576 bit numbers.
|
||||
void strobeNCR1632(BigInteger denominator, BigInteger numerator);
|
||||
|
||||
/// Allows a 6 bit computer to use the nether,fractions or unicode.
|
||||
/// 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.
|
||||
|
|
@ -59,11 +52,11 @@ public interface FourCornerZion7Candlelier {
|
|||
interface Adapter extends FourCornerZion7Candlelier {
|
||||
|
||||
@Override
|
||||
default void strobeWords(FourCornerDotCake slice, List<Integer> offsets) {
|
||||
default void strobeWord(int cakePoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
default void strobeWord(FourCornerDotCake slice, int offset) {
|
||||
default void strobeWords(List<Integer> cakePoints) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -24,20 +24,18 @@ package org.x4o.fc18.zion7;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
|
||||
/// Handles the lexer salah sequence strobes.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 11, 2025
|
||||
public interface FourCornerZion7SalahSequence extends FourCornerZion7Candlelier {
|
||||
|
||||
void strobeSalahSequence(FCDotDEC2701DashPX0 type, List<List<Integer>> arguments);
|
||||
void strobeSalahSequence(int type, List<List<Integer>> arguments);
|
||||
|
||||
interface Adapter extends FourCornerZion7SalahSequence, FourCornerZion7Candlelier.Adapter {
|
||||
|
||||
@Override
|
||||
default void strobeSalahSequence(FCDotDEC2701DashPX0 type, List<List<Integer>> arguments) {
|
||||
default void strobeSalahSequence(int type, List<List<Integer>> arguments) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,66 @@
|
|||
* 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;
|
||||
package org.x4o.fc18.zion7;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
||||
|
||||
/// Write steno for zion.
|
||||
///
|
||||
/// @author Willem Cazander
|
||||
/// @version 1.0 Jan 11, 2025
|
||||
public class FourCornerZionStenoGrapher {
|
||||
|
||||
private final List<Integer> out;
|
||||
|
||||
public FourCornerZionStenoGrapher(List<Integer> out) {
|
||||
this.out = Objects.requireNonNull(out);
|
||||
}
|
||||
|
||||
class FourCornerWriter implements FourCornerZion7AlphaOmega,FourCornerZion7SalahSequence {
|
||||
|
||||
@Override
|
||||
public void strobeDocumentAlpha() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeDocumentOmega() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeWord(int cakePoint) {
|
||||
out.add(cakePoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeWords(List<Integer> cakePoints) {
|
||||
out.addAll(cakePoints);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeNCR1632(BigInteger denominator, BigInteger numerator) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeRecursiveCake(List<Integer> cakePoints) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWalker(List<Integer> rhythm) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSandWorm(List<Integer> spice) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeSalahSequence(int type, List<List<Integer>> arguments) {
|
||||
FCDotDEC2701DashPX0 cdcDECMode = FCDotDEC2701DashPX0.valueOf(type);
|
||||
}
|
||||
|
||||
public void write() {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ import java.util.Optional;
|
|||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.flag4.FCDotF4TTY0001DashNL;
|
||||
import org.x4o.fc18.cake2.flag4.FCDotF4TXT0001DashSP;
|
||||
import org.x4o.fc18.cake2.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotCMD5401Dash2D;
|
||||
import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC0801DashE10;
|
||||
|
|
@ -303,20 +305,21 @@ public class FourCornerZionStenoLexer {
|
|||
|
||||
static class StenoScannerWordCakeSlice extends StenoScanner {
|
||||
|
||||
private final FourCornerDotCake cakeSlice;
|
||||
//private final FourCornerDotCake cakeSlice;
|
||||
|
||||
public StenoScannerWordCakeSlice(FourCornerDotCake cakeSlice) {
|
||||
super(cakeSlice);
|
||||
this.cakeSlice = Objects.requireNonNull(cakeSlice);
|
||||
//this.cakeSlice = Objects.requireNonNull(cakeSlice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
List<Integer> offsets = new ArrayList<>();
|
||||
for (int i = idxFirst; i <= idxLast; i++) {
|
||||
offsets.add(lexer.input.get(i) - blockStart);
|
||||
}
|
||||
lexer.handler.strobeWords(cakeSlice, offsets);
|
||||
// List<Integer> offsets = new ArrayList<>();
|
||||
// for (int i = idxFirst; i <= idxLast; i++) {
|
||||
// offsets.add(lexer.input.get(i) - blockStart);
|
||||
// }
|
||||
// lexer.handler.strobeWords(cakeSlice, offsets);
|
||||
lexer.handler.strobeWords(lexer.input.subList(idxFirst, idxLast + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -517,11 +520,12 @@ public class FourCornerZionStenoLexer {
|
|||
continue;
|
||||
}
|
||||
int cdcDECPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (FourCornerDotCake.FC_DEC2701_PX0.contains(cdcDECPoint)) {
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_DEC2701_PX0, cdcDECPoint - FourCornerDotCake.FC_DEC2701_PX0.getStart());
|
||||
} else {
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcDECPoint);
|
||||
}
|
||||
lexer.handler.strobeWord(cdcDECPoint);
|
||||
// if (FourCornerDotCake.FC_DEC2701_PX0.contains(cdcDECPoint)) {
|
||||
// lexer.handler.strobeWord(FourCornerDotCake.FC_DEC2701_PX0, cdcDECPoint - FourCornerDotCake.FC_DEC2701_PX0.getStart());
|
||||
// } else {
|
||||
// lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcDECPoint);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -603,7 +607,7 @@ public class FourCornerZionStenoLexer {
|
|||
if (readOK == false) {
|
||||
return true; // point is eaten
|
||||
}
|
||||
lexer.handlerSalahSequence.strobeSalahSequence(cdcDECMode, args);
|
||||
lexer.handlerSalahSequence.strobeSalahSequence(cdcDECMode.ordinal(), args);
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC68_2PIE9C.equals(cdcDECMode)) {
|
||||
|
|
@ -654,7 +658,8 @@ public class FourCornerZionStenoLexer {
|
|||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
//lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
lexer.handler.strobeWord(displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -681,7 +686,8 @@ public class FourCornerZionStenoLexer {
|
|||
// }
|
||||
|
||||
if (FCDotDEC0801DashE10.E10_CDC1604_P6.equals(lexer.cdcDECModeE10)) {
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcPoint); // not A based offset here
|
||||
lexer.handler.strobeWord(cdcPoint); // not A based offset here
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcPoint); // not A based offset here
|
||||
return true;
|
||||
}
|
||||
FourCornerDotCake displayCake = lexer.cdcDECModeE10.displayCake();
|
||||
|
|
@ -689,7 +695,8 @@ public class FourCornerZionStenoLexer {
|
|||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
//lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
lexer.handler.strobeWord(displayCake.getStart() + cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -704,7 +711,8 @@ public class FourCornerZionStenoLexer {
|
|||
FCDotCMD5401Dash2D cmdMode = cmdModeOpt.get();
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TXT0001_SP.equals(cmdMode)) {
|
||||
lexer.decModeReset();
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_F4TXT0001_SP, 0); // white space
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_F4TXT0001_SP, 0); // white space
|
||||
lexer.handler.strobeWord(FCDotF4TXT0001DashSP.SPANISH_PEACE.cakePointDotIndex()); // white space
|
||||
return true;
|
||||
}
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TTY0001_NL.equals(cmdMode)) {
|
||||
|
|
@ -712,7 +720,8 @@ public class FourCornerZionStenoLexer {
|
|||
lexer.currLine++;
|
||||
lexer.currCol = 0;
|
||||
lexer.fireSignals.fireStateLine(lexer.currLine);
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_F4TTY0001_NL, 0); // new line
|
||||
//lexer.handler.strobeWord(FourCornerDotCake.FC_F4TTY0001_NL, 0); // new line
|
||||
lexer.handler.strobeWord(FCDotF4TTY0001DashNL.NETHER_LINE.cakePointDotIndex()); // new line
|
||||
return true;
|
||||
}
|
||||
lexer.decModeReset();
|
||||
|
|
@ -758,7 +767,8 @@ public class FourCornerZionStenoLexer {
|
|||
sliceBase = FourCornerDotCake.FC_PIE9D_01.ordinal();
|
||||
}
|
||||
FourCornerDotCake slice = FourCornerDotCake.valueOf(terminatorOffZero + sliceBase);
|
||||
lexer.handler.strobeWord(slice, numberIdxOffZero);
|
||||
//lexer.handler.strobeWord(slice, numberIdxOffZero);
|
||||
lexer.handler.strobeWord(slice.getStart() + numberIdxOffZero);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue