Add failing unit test and begin of VT-06 virtual typewriter support
This commit is contained in:
parent
c5d497d2d1
commit
b4fec076b0
|
@ -194,7 +194,7 @@ public class FourCornerUnicodeImport {
|
|||
}
|
||||
int cdcNumberOff = ctx.codePoint - '0';
|
||||
int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff;
|
||||
ctx.output.add(FCDotCDC1604DashP6.indexOf(cdcNumber));
|
||||
ctx.output.add(FCDotCDC1604DashP6.valueOf(cdcNumber));
|
||||
return true;
|
||||
}
|
||||
if (ctx.cdcNumberTerminator != null) {
|
||||
|
@ -224,7 +224,7 @@ public class FourCornerUnicodeImport {
|
|||
}
|
||||
int cdcNumberOff = ctx.codePoint - 'a';
|
||||
int cdcNumber = FCDotCDC1604DashP6.NX01_A.ordinal() + cdcNumberOff;
|
||||
ctx.output.add(FCDotCDC1604DashP6.indexOf(cdcNumber));
|
||||
ctx.output.add(FCDotCDC1604DashP6.valueOf(cdcNumber));
|
||||
return true;
|
||||
}
|
||||
if (ctx.cdcCaseTerminator != null) {
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10;
|
||||
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash11;
|
||||
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash20;
|
||||
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||
|
@ -103,22 +104,42 @@ public enum FourCornerUnicodeMapper {
|
|||
return int21ToVide.get(letter);
|
||||
}
|
||||
|
||||
// TODO: move this not really unicode related, AND add the muffin version too... move into StenoGrapher later?
|
||||
public List<Integer> embedFC18(List<Integer> cakePoints) {
|
||||
if (cakePoints.isEmpty()) {
|
||||
return cakePoints;
|
||||
}
|
||||
List<Integer> result = new ArrayList<>();
|
||||
result.addAll(FCDotDEC0127DashPX0.ESC68_FC18.toInt18BaklavaPoints());
|
||||
|
||||
|
||||
Iterator<Integer> i = cakePoints.iterator();
|
||||
while (i.hasNext()) {
|
||||
int cakePoint = i.next();
|
||||
for (int cakePointIdx=0;cakePointIdx<=6;cakePointIdx++) {
|
||||
int octal = (cakePoint >> ((6-cakePointIdx)*3)) & 0b111;
|
||||
int letter = octal + FCDotCDC1604DashP6.NX01_A.ordinal();
|
||||
result.add(letter);
|
||||
if (cakePoint < 64) {
|
||||
result.add(cakePoint);
|
||||
continue;
|
||||
}
|
||||
if (!i.hasNext()) {
|
||||
break;
|
||||
}
|
||||
result.addAll(FCDotDEC0127DashPX0.ESC68_FC18.toInt18BaklavaPoints());
|
||||
while (i.hasNext()) {
|
||||
if (cakePoint < 64) {
|
||||
result.addAll(FCDotDEC0127DashPX0.ESC_SEQ_SALAH.toInt18BaklavaPoints());
|
||||
result.add(cakePoint);
|
||||
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);
|
||||
}
|
||||
if (!i.hasNext()) {
|
||||
result.addAll(FCDotDEC0127DashPX0.ESC_SEQ_SALAH.toInt18BaklavaPoints());
|
||||
}
|
||||
cakePoint = i.next();
|
||||
}
|
||||
}
|
||||
result.addAll(FCDotDEC0127DashPX0.ESC_SEQ_SALAH.toInt18BaklavaPoints());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -180,4 +201,29 @@ public enum FourCornerUnicodeMapper {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<FourCornerX06BaklavaPoints> toDecimalsX06(int value) {
|
||||
return toDecimalsX00(value);
|
||||
}
|
||||
|
||||
public List<FourCornerX18CakePoints> toDecimalsX18(int value) {
|
||||
return toDecimalsX00(value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends FourCornerX00PetitVidePoints> List<T> toDecimalsX00(int value) {
|
||||
List<T> result = new ArrayList<>();
|
||||
String valueStr = Integer.toString(value);
|
||||
PrimitiveIterator.OfInt i = valueStr.codePoints().iterator();
|
||||
while (i.hasNext()) {
|
||||
int chr = i.nextInt();
|
||||
int num = chr - '0';
|
||||
if (result.isEmpty()) {
|
||||
result.add((T) FCDotPIE9CDash10.valueOf(num)); // Add escaping only once
|
||||
} else {
|
||||
result.add((T) FCDotCDC1604DashP6.valueOf(FCDotCDC1604DashP6.NX01_A.ordinal() + num));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,7 @@
|
|||
*/
|
||||
package org.x4o.o2o.fc18.pie9c;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.PrimitiveIterator;
|
||||
|
||||
import org.x4o.o2o.fc18.FourCornerDotCake;
|
||||
import org.x4o.o2o.fc18.FourCornerX00PetitVidePoints;
|
||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
|
||||
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
||||
|
@ -54,6 +49,7 @@ public enum FCDotPIE9CDash10 implements FourCornerX06BaklavaPoints, FourCornerX0
|
|||
DECIMAL_8('8'),
|
||||
DECIMAL_9('9'),
|
||||
;
|
||||
private final static FCDotPIE9CDash10[] VALUES = values();
|
||||
private final int[] codePoints;
|
||||
|
||||
private FCDotPIE9CDash10(int...codePoints) {
|
||||
|
@ -80,29 +76,11 @@ public enum FCDotPIE9CDash10 implements FourCornerX06BaklavaPoints, FourCornerX0
|
|||
return codePoints;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
static public List<FourCornerX06BaklavaPoints> toDecimalsX06(int value) {
|
||||
return toDecimalsX00(value);
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public List<FourCornerX18CakePoints> toDecimalsX18(int value) {
|
||||
return toDecimalsX00(value);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static private <T extends FourCornerX00PetitVidePoints> List<T> toDecimalsX00(int value) {
|
||||
List<T> result = new ArrayList<>();
|
||||
String valueStr = Integer.toString(value);
|
||||
PrimitiveIterator.OfInt i = valueStr.codePoints().iterator();
|
||||
while (i.hasNext()) {
|
||||
int chr = i.nextInt();
|
||||
int num = chr - '0';
|
||||
if (result.isEmpty()) {
|
||||
result.add((T) values()[num]); // Add escaping only once
|
||||
} else {
|
||||
result.add((T) FCDotCDC1604DashP6.indexOf(FCDotCDC1604DashP6.NX01_A.ordinal() + num));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
static public FCDotPIE9CDash10 valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.o2o.fc18.vt06;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||
|
||||
/**
|
||||
* The "VT-06.0" defines the action group identifiers.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public enum VTDash06DotZero {
|
||||
|
||||
VT_CURSOR(FCDotCDC1604DashP6.NX01_A),
|
||||
VT_BUFFER(FCDotCDC1604DashP6.NX02_B),
|
||||
VT_CLEAR(FCDotCDC1604DashP6.NX03_C),
|
||||
|
||||
|
||||
/*
|
||||
/// VT-52 = ESC L = Insert line
|
||||
OLD_MSX_INSERT_LINE,
|
||||
/// VT-52 = ESC M = Delete line
|
||||
OLD_MSX_DELETE_LINE,
|
||||
|
||||
/// VT-NX01 = __ESC6 & + ?-?num + VT_NX01_EXECUTE = Ring the bells of the alarms and alerts, without the argument a "-4" green alert is given.
|
||||
/// An condition is state-full and an alert is signal to the crew member(s).
|
||||
/// 0 = Condition blue;
|
||||
/// For exceptional situations environmental hazards to the crew, main power failure,
|
||||
/// docking and separation maneuvers, and landing protocols, for ships with the capability.
|
||||
/// When the warp cores is booting is starts in blue until booted and white state is asserted.
|
||||
/// 1 = White state;
|
||||
/// Restores condition state to normal.
|
||||
/// 2 = Condition red;
|
||||
/// Usually triggered when entering a combat situation.
|
||||
/// -3 = Orange alert;
|
||||
/// Indicated tea or coffee or orange juice drinking time for crew member.
|
||||
/// -4 = Green alert; (default single bell)
|
||||
/// Signal positive of background task or check that signifies the ship systems are operating correctly.
|
||||
/// 5 = Condition Yellow;
|
||||
/// Is raised in preparation for a tactical or environmentally hazardous situation,
|
||||
/// or automatically upon detection of unknown or hostile spacecraft,
|
||||
/// or upon detection of certain system malfunctions.
|
||||
/// -6 = Brown alert;
|
||||
/// A brownout is a drop in the magnitude of voltage in an electrical power system.
|
||||
/// 7 = Condition Black;
|
||||
/// Signify that the ship is operating its experimental spore drive or cloaking device is active.
|
||||
/// This stealth mode for ships and submarines enables ultra low CPU/PSG/VDP noise output. (thus no audio/blinking/etc)
|
||||
/// 8 = Condition purple;
|
||||
/// Indication of ceremonial ship wide event for the wounded or killed in war or duty;
|
||||
/// Active-duty and former military personnel salute, while civilians remove their hat and place their hand over their heart,
|
||||
/// to honor the fallen service member(s).
|
||||
/// -9 = Pink alert;
|
||||
/// Security or intruder alert.
|
||||
NX_BELL,
|
||||
*/
|
||||
// MSX is simple VT-52 for reference see https://www.msx.org/wiki/MSX_Characters_and_Control_Codes#Escape_codes
|
||||
//
|
||||
// ANSI CSI has dynamic termination;
|
||||
// - ESC [
|
||||
// - any number (including none) of "parameter bytes" in the range 0x30–0x3F (ASCII 0–9:;<=>?),
|
||||
// - any number of "intermediate bytes" in the range 0x20–0x2F (ASCII space and !"#$%&'()*+,-./),
|
||||
// - finally by a single "final byte" in the range 0x40–0x7E (ASCII @A–Z[\]^_`a–z{|}~)
|
||||
;
|
||||
|
||||
private FCDotCDC1604DashP6 dotZero;
|
||||
|
||||
private VTDash06DotZero(FCDotCDC1604DashP6 dotZero) {
|
||||
this.dotZero = Objects.requireNonNull(dotZero);
|
||||
}
|
||||
|
||||
public FCDotCDC1604DashP6 dotZero() {
|
||||
return dotZero;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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.o2o.fc18.vt06;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
|
||||
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
||||
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.o2o.fc18.zero33.FCDotDEC0127DashPX0;
|
||||
|
||||
/**
|
||||
* The "VT-06.0A" cursor action sequences.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public enum VTDash06DotZeroACursor implements FourCornerX06BaklavaPoints, FourCornerX08MuffinPoints, FourCornerX18CakePoints {
|
||||
|
||||
/// VT-06 = ESC_VT06
|
||||
/// + ESC_SEQ_RAKA_AT + A // select cursor function
|
||||
/// + ESC_SEQ_RAKA_AT + A // move up
|
||||
/// + ?ESC_SEQ_RAKA_AT + ?num // optional amount of movement
|
||||
/// + ESC_SEQ_SALAH = Cursor one or X-num up
|
||||
VT_CURSOR_UP(FCDotCDC1604DashP6.NX01_A),
|
||||
NX_CURSOR_DOWN(FCDotCDC1604DashP6.NX02_B),
|
||||
NX_CURSOR_RIGHT(FCDotCDC1604DashP6.NX03_C),
|
||||
NX_CURSOR_LEFT(FCDotCDC1604DashP6.NX04_D),
|
||||
// E
|
||||
// F
|
||||
NX_CURSOR_GOTO(FCDotCDC1604DashP6.NX07_G),
|
||||
NX_CURSOR_HOME(FCDotCDC1604DashP6.NX08_H),
|
||||
|
||||
;
|
||||
|
||||
private FCDotCDC1604DashP6 actionGroup;
|
||||
private FCDotCDC1604DashP6 action;
|
||||
|
||||
private VTDash06DotZeroACursor(FCDotCDC1604DashP6 action) {
|
||||
this.actionGroup = VTDash06DotZero.VT_CURSOR.dotZero();
|
||||
this.action = Objects.requireNonNull(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] baklavaPoints() {
|
||||
return FCDotDEC0127DashPX0.ESC_VT06.baklavaPointsVT06Action(actionGroup, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] muffinPoints() {
|
||||
return cakePoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] cakePoints() {
|
||||
return new int[] {FCDotDEC0127DashPX0.ESC_VT06.cakePoints()[0], actionGroup.ordinal(), action.ordinal()};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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.o2o.fc18.vt06;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||
import org.x4o.o2o.fc18.FourCornerX08MuffinPoints;
|
||||
import org.x4o.o2o.fc18.FourCornerX18CakePoints;
|
||||
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||
import org.x4o.o2o.fc18.zero33.FCDotDEC0127DashPX0;
|
||||
|
||||
/**
|
||||
* The "VT-06.0A" cursor action sequences.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public enum VTDash06DotZeroCClear implements FourCornerX06BaklavaPoints, FourCornerX08MuffinPoints, FourCornerX18CakePoints {
|
||||
|
||||
VT_CLEAR_TOP(FCDotCDC1604DashP6.NX01_A),
|
||||
VT_CLEAR_LEFT(FCDotCDC1604DashP6.NX02_B),
|
||||
VT_CLEAR_DOWN(FCDotCDC1604DashP6.NX03_C),
|
||||
VT_CLEAR_RIGHT(FCDotCDC1604DashP6.NX04_D),
|
||||
|
||||
;
|
||||
|
||||
private FCDotCDC1604DashP6 actionGroup;
|
||||
private FCDotCDC1604DashP6 action;
|
||||
|
||||
private VTDash06DotZeroCClear(FCDotCDC1604DashP6 action) {
|
||||
this.actionGroup = VTDash06DotZero.VT_CLEAR.dotZero();
|
||||
this.action = Objects.requireNonNull(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] baklavaPoints() {
|
||||
return FCDotDEC0127DashPX0.ESC_VT06.baklavaPointsVT06Action(actionGroup, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] muffinPoints() {
|
||||
return cakePoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] cakePoints() {
|
||||
return new int[] {FCDotDEC0127DashPX0.ESC_VT06.cakePoints()[0], actionGroup.ordinal(), action.ordinal()};
|
||||
}
|
||||
}
|
|
@ -49,7 +49,7 @@ public enum FCDotCDC1604DashP6 implements FourCornerX06BaklavaPoints, FourCorner
|
|||
/// Indicator for termination of pussy strings, which is the compatibility duel octal, with the CDC 1604 computers.
|
||||
_NUL('\u0000'),
|
||||
|
||||
/// Escape to direct control codes for 6 bit systems requires an sequence of 3 escapes.
|
||||
/// Goto direct escaped control with sequence of 3 escapes on 6 bit systems.
|
||||
_ESC6_X1('\u0001'),
|
||||
_ESC6_X2('\u0002'),
|
||||
_ESC6_X3('\u0003'),
|
||||
|
@ -89,7 +89,7 @@ public enum FCDotCDC1604DashP6 implements FourCornerX06BaklavaPoints, FourCorner
|
|||
BAR_V_LEFT('\\'),
|
||||
BAR_V_RIGHT('/'),
|
||||
AT('@'),
|
||||
/// The tone letter 'A' is "one", if your computer is expensive and has a lower-case char ROM, than this is 'a' except after some pie glue.
|
||||
/// The tone letter 'A' is "one", if your computer is expensive and has a lower-case char ROM, than this is 'a' after some pie glue.
|
||||
NX01_A('A'),
|
||||
NX02_B('B'),
|
||||
NX03_C('C'),
|
||||
|
@ -147,11 +147,11 @@ public enum FCDotCDC1604DashP6 implements FourCornerX06BaklavaPoints, FourCorner
|
|||
return new int[] {codePoint};
|
||||
}
|
||||
|
||||
static public int length() {
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
static public FCDotCDC1604DashP6 indexOf(int idx) {
|
||||
static public FCDotCDC1604DashP6 valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
_ESC_USER_5,
|
||||
|
||||
/// _ESC6_X1 _ESC6_X2 _ESC6_X3
|
||||
/// Virtual Typewriter Six bit control support with argumented commands which MUST end with ESC_SEQ_SALAH.
|
||||
/// Virtual Typewriter 0ctal Six bit control sequences with argumented commands which MUST end with ESC_SEQ_SALAH.
|
||||
ESC_VT06,
|
||||
|
||||
/// _ESC6_X1 _ESC6_X3 _ESC6_X1
|
||||
|
@ -100,7 +100,9 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
/// + ?slug + ?ESC_SEQ_RAKA_AT (Up to 8 slug arguments to have max key)
|
||||
/// + ESC_SEQ_SALAH + data-block as FC_NETHER in 15 bit embedded octals
|
||||
///
|
||||
/// NOTE: key slug format is <6><6><6><9><6><6><6><6><6><6><9> encoded as 4 bit octals with CDC MX01_A++ "letnums".
|
||||
/// NOTE: key slug format is <6><6><6><9><6><6><6><6><6><6><9> encoded as 3 bit octals with CDC MX01_A++ "letnums".
|
||||
/// On 6/8 bit systems this slug can be rendered with the ESC68_PIE.NX08_H (T008) hexa-grams octal symbols.
|
||||
/// On 18 bit systems this slug can be rendered using the FC.OCE0808-H6 and FC.OCE0864-H9 data-gram encoding.
|
||||
///
|
||||
/// With dark nether space you can add unnamed and real dark(key is optional) undefined data segments in text.
|
||||
/// With an nether DB enabled text editor, it can render for example vector graphics in source like HolyC of TempleOS.
|
||||
|
@ -112,8 +114,7 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
ESC_SEQ_SALAH,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X3 _ESC6_X2
|
||||
/// Next argument separator for escape command sequences which MUST end with ESC_SEQ_SALAH.
|
||||
/// Only allowed cake points are 7-63 or from { to & 6 bit chars.
|
||||
/// Next argument separator for escape sequences, and which MUST end with ESC_SEQ_SALAH.
|
||||
ESC_SEQ_RAKA_AT,
|
||||
|
||||
/// _ESC6_X2 _ESC6_X3 _ESC6_X3
|
||||
|
@ -124,21 +125,27 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
// =========== Embeddable sequences, with open or manual stopped or auto stopped ending. (stop on out of range)
|
||||
|
||||
/// _ESC6_X3 _ESC6_X1 _ESC6_X1
|
||||
/// Select APL page 7A mode.
|
||||
ESC6_APL0127_P7A,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X1 _ESC6_X2
|
||||
/// Select APL page 7B mode.
|
||||
ESC6_APL0127_P7B,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X1 _ESC6_X3
|
||||
/// Select APL page 7C mode.
|
||||
ESC6_APL0127_P7C,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X2 _ESC6_X1
|
||||
/// Select BYD page 7D mode.
|
||||
ESC6_BYD0127_P7D,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X2 _ESC6_X2
|
||||
/// Select BYD page 7E mode.
|
||||
ESC6_BYD0127_P7E,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X2 _ESC6_X3
|
||||
/// Select BYD page 7F mode.
|
||||
ESC6_BYD0127_P7F,
|
||||
|
||||
/// _ESC6_X3 _ESC6_X3 _ESC6_X1
|
||||
|
@ -159,7 +166,11 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
|
||||
/*
|
||||
|
||||
/// VT-NX01 = __ESC6 A + ?num + VT_NX01_EXECUTE = Cursor one or X up
|
||||
/// VT-06 = ESC_VT06
|
||||
/// + ESC_SEQ_RAKA_AT + A // select cursor function
|
||||
/// + ESC_SEQ_RAKA_AT + A // move up
|
||||
/// + ?ESC_SEQ_RAKA_AT + ?num // optional amount of movement
|
||||
/// + ESC_SEQ_SALAH = Cursor one or X-num up
|
||||
NX_CURSOR_UP,
|
||||
/// VT-NX01 = __ESC6 B + ?num + VT_NX01_EXECUTE = Cursor one or X down
|
||||
NX_CURSOR_DOWN,
|
||||
|
@ -245,6 +256,7 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
// C1 char P = DCS = Device Control String
|
||||
// C1 char X = SOS = Start Of String
|
||||
;
|
||||
private static final FCDotDEC0127DashPX0[] VALUES = values();
|
||||
|
||||
private FCDotDEC0127DashPX0() {
|
||||
}
|
||||
|
@ -277,7 +289,7 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
public List<FourCornerX06BaklavaPoints> toX06BaklavaPoints(FCDotCDC1604DashP6... letters) {
|
||||
List<FourCornerX06BaklavaPoints> result = new ArrayList<>();
|
||||
for (int baklave : baklavaPoints()) {
|
||||
result.add(FCDotCDC1604DashP6.indexOf(baklave));
|
||||
result.add(FCDotCDC1604DashP6.valueOf(baklave));
|
||||
}
|
||||
for (FCDotCDC1604DashP6 letter : letters) {
|
||||
result.add(letter);
|
||||
|
@ -315,6 +327,17 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
};
|
||||
}
|
||||
|
||||
// FIXME move
|
||||
public int[] baklavaPointsVT06Action(FCDotCDC1604DashP6 group, FCDotCDC1604DashP6 action) {
|
||||
return new int[] {
|
||||
FCDotCDC1604DashP6._ESC6_X1.ordinal() + (ordinal() / 9),
|
||||
FCDotCDC1604DashP6._ESC6_X1.ordinal() + ((ordinal() / 3) % 3),
|
||||
FCDotCDC1604DashP6._ESC6_X1.ordinal() + (ordinal() % 3),
|
||||
group.ordinal(),
|
||||
action.ordinal()
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] baklavaPoints() {
|
||||
return new int[] {
|
||||
|
@ -334,10 +357,23 @@ public enum FCDotDEC0127DashPX0 implements FourCornerX06BaklavaPoints, FourCorne
|
|||
return new int[] {FourCornerDotCake.FC_DEC0127_PX0.getStart() + ordinal()};
|
||||
}
|
||||
|
||||
static public int valuesLength() {
|
||||
return VALUES.length;
|
||||
}
|
||||
|
||||
public static FCDotDEC0127DashPX0 valueOf(int idx) {
|
||||
return VALUES[idx];
|
||||
}
|
||||
|
||||
public static FCDotDEC0127DashPX0 valueOfCakePoint(int cakePoint) {
|
||||
return valueOf(cakePoint - FourCornerDotCake.FC_DEC0127_PX0.getStart());
|
||||
}
|
||||
|
||||
public static FCDotDEC0127DashPX0 valueOf(FCDotCDC1604DashP6 msb, FCDotCDC1604DashP6 csb, FCDotCDC1604DashP6 lsb) {
|
||||
int idx = (msb.ordinal() - FCDotCDC1604DashP6._ESC6_X1.ordinal()) * 9;
|
||||
int idx = 0;
|
||||
idx += (msb.ordinal() - FCDotCDC1604DashP6._ESC6_X1.ordinal()) * 9;
|
||||
idx += (csb.ordinal() - FCDotCDC1604DashP6._ESC6_X1.ordinal()) * 3;
|
||||
idx += (lsb.ordinal() - FCDotCDC1604DashP6._ESC6_X1.ordinal());
|
||||
return FCDotDEC0127DashPX0.values()[idx];
|
||||
return valueOf(idx);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,10 +420,10 @@ public class FourCornerZionStenoLexer {
|
|||
private FCDotDEC0127DashPX0 readEscape6(Iterator<Integer> cdc, Integer cdcPoint) {
|
||||
// Read 8 or 18 bit Direct Escape Code
|
||||
if (FourCornerDotCake.FC_DEC0127_PX0.contains(cdcPoint)) {
|
||||
return FCDotDEC0127DashPX0.values()[cdcPoint - FourCornerDotCake.FC_DEC0127_PX0.getStart()];
|
||||
return FCDotDEC0127DashPX0.valueOfCakePoint(cdcPoint);
|
||||
}
|
||||
// Read 6 bit escape code
|
||||
FCDotCDC1604DashP6 x1 = FCDotCDC1604DashP6.indexOf(cdcPoint);
|
||||
FCDotCDC1604DashP6 x1 = FCDotCDC1604DashP6.valueOf(cdcPoint);
|
||||
FCDotCDC1604DashP6 x2 = null;
|
||||
FCDotCDC1604DashP6 x3 = null;
|
||||
if (!cdc.hasNext()) {
|
||||
|
@ -431,7 +431,7 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
cdcPoint = cdc.next();
|
||||
if (FCDotCDC1604DashP6.isEscape6(cdcPoint)) {
|
||||
x2 = FCDotCDC1604DashP6.indexOf(cdcPoint);
|
||||
x2 = FCDotCDC1604DashP6.valueOf(cdcPoint);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
cdcPoint = cdc.next();
|
||||
if (FCDotCDC1604DashP6.isEscape6(cdcPoint)) {
|
||||
x3 = FCDotCDC1604DashP6.indexOf(cdcPoint);
|
||||
x3 = FCDotCDC1604DashP6.valueOf(cdcPoint);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -498,6 +498,7 @@ public class FourCornerZionStenoLexer {
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME: this pages need a stop on out of range too
|
||||
if (decMode == FCDotDEC0127DashPX0.ESC6_APL0127_P7A) {
|
||||
handler.strobeWords(FourCornerDotCake.FC_APL0127_P7A, List.of(cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal()));
|
||||
return;
|
||||
|
@ -648,6 +649,7 @@ public class FourCornerZionStenoLexer {
|
|||
result.clear();
|
||||
return ScanResult.NEXT;
|
||||
}
|
||||
// FIXME: this is wrong
|
||||
handleCDCDEC(input, cdcPoint, embedESC);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public class FourCornerWriteExampleMD {
|
|||
buf.append(prefixHex.charAt(0));
|
||||
buf.append("x</td>");
|
||||
for (int i=off; i<16+off;i++) {
|
||||
FCDotCDC1604DashP6 cdc = FCDotCDC1604DashP6.indexOf(i);
|
||||
FCDotCDC1604DashP6 cdc = FCDotCDC1604DashP6.valueOf(i);
|
||||
int codePoint = cdc.codePoints()[0];
|
||||
buf.append("<td>");
|
||||
if (codePoint == '\u0000') {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class FCDotCDC1604DashP6Test {
|
|||
|
||||
@Test
|
||||
public void testValues() throws Exception {
|
||||
Assertions.assertEquals(64, FCDotCDC1604DashP6.length());
|
||||
Assertions.assertEquals(64, FCDotCDC1604DashP6.valuesLength());
|
||||
boolean duplicate = false;
|
||||
Map<Integer,FCDotCDC1604DashP6> global = new HashMap<>();
|
||||
for (FCDotCDC1604DashP6 v : FCDotCDC1604DashP6.values()) {
|
||||
|
|
|
@ -28,8 +28,10 @@ import java.util.List;
|
|||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.x4o.o2o.fc18.FourCornerUnicodeDisplay;
|
||||
import org.x4o.o2o.fc18.FourCornerUnicodeMapper;
|
||||
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||
import org.x4o.o2o.fc18.pie9c.FCDotPIE9CDash10;
|
||||
import org.x4o.o2o.fc18.vt06.VTDash06DotZeroACursor;
|
||||
import org.x4o.o2o.fc18.vt06.VTDash06DotZeroCClear;
|
||||
|
||||
/**
|
||||
* Tests FCDotCDC1604DashP6 encoding.
|
||||
|
@ -70,32 +72,28 @@ public class FCDotDEC0127DashP7GTest {
|
|||
Assertions.assertEquals(FCDotCDC1604DashP6._ESC6_X3.ordinal(), seq[2]);
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testCusorGoto() throws Exception {
|
||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotDEC0127DashP7G.NX_CURSOR_GOTO);
|
||||
cdc.add(FCDotDEC0127DashP7G.VT_RAKA_AT);
|
||||
cdc.add(FCDotCDC1604DashP6.NX25_Y);
|
||||
cdc.add(FCDotDEC0127DashP7G.VT_RAKA_AT);
|
||||
cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(123));
|
||||
cdc.add(FCDotDEC0127DashP7G.VT_RAKA_AT);
|
||||
cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(456));
|
||||
cdc.add(FCDotDEC0127DashP7G.VT_SALAH);
|
||||
cdc.add(VTDash06DotZeroACursor.NX_CURSOR_GOTO);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(123));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(456));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH);
|
||||
|
||||
Assertions.assertEquals("␃Y␃?Y␃?␁JBCD␃?␁JEFG␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
Assertions.assertEquals("?Y?123?456!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
Assertions.assertEquals("␁␂␃AG␃␃␁JBCD␂␃␂␃␃␁JEFG␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
// TODO: Fix lexer embedded escapes, and display external with single unicode escape sign
|
||||
Assertions.assertEquals("?AG?BCD?EFG!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearTop5Lines() throws Exception {
|
||||
List<FourCornerX06BaklavaPoints> cdc = new ArrayList<>();
|
||||
cdc.add(FCDotDEC0127DashP7G.NX_CLEAR_TOP);
|
||||
cdc.add(FCDotDEC0127DashP7G.VT_RAKA_AT);
|
||||
cdc.addAll(FCDotPIE9CDash10.toDecimalsX06(5));
|
||||
cdc.add(FCDotDEC0127DashP7G.VT_SALAH);
|
||||
cdc.add(VTDash06DotZeroCClear.VT_CLEAR_TOP);
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_RAKA_AT);
|
||||
cdc.addAll(FourCornerUnicodeMapper.DICTIONARY.toDecimalsX06(5));
|
||||
cdc.add(FCDotDEC0127DashPX0.ESC_SEQ_SALAH);
|
||||
|
||||
Assertions.assertEquals("␃E␃?␁JF␃!", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
Assertions.assertEquals("␁␂␃CA␂␃␂␃␃␁JF␂␃␁", FourCornerUnicodeDisplay.raw().renderFromX06(cdc));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue