Normalized names of CDC1604DashP6 and improved docs

This commit is contained in:
Willem Cazander 2024-12-25 16:07:58 +01:00
parent fc0b9343f7
commit 9677f39351
3 changed files with 219 additions and 169 deletions

View file

@ -28,99 +28,104 @@ import java.util.List;
import java.util.PrimitiveIterator;
/**
* CDC1604DashP6 has 27 pie slice number systems and BASIC letters in a six bit encoding.
* CDC1604DashP6 has 27 pie slice number systems "Packed" for MATH and BASIC letters in a "Six" bit encoding.
*
* This is used as the first 64 word numbers of the china four corner method, and acts like ascii glue for adult 18 bit computers.
*
* ASCII 8 bit can only encoding 10 number glyphs, this 6 bit format can encode 378 different number glyphs.
* (1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17+18+19+20+21+22+23+24+25+26+27)
*
* @author Willem Cazander
* @version 1.0 Dec 22, 2024
*/
public enum CDC1604DashP6 {
// [NUL][WN][WG][WE] [WL][WS]?! {[(< }])>
// [__NUL][__PIE][__GLUE][__ESC] [__LINE][__SPACE]?! {[(< }])>
// ~+-* ,.:; '"`^ =#$%
// |_\/ @ABC DEFG HIJK
// LMNO PQRS TUVW XYZ&
/// NUL for termination.
_NUL('\u0000'),
/// Select packed number encoding.
/// Indicator for termination of pussy strings, which is the compatibility duel octal, with the CDC 1604 computers.
__NUL('\u0000'),
/// Select packed pie number encoding.
/// A = 1, first P6 is terminator select, than next P6 _A++ select pie part 1-27, until other P6 stops it.
/// Example ascii "012" is
/// 0 = _WORD_NUMBER _A _A (WN T001 PART_1 = 0)
/// 12 = _WORD_NUMBER _I _A _B (WN T009 PART_1+2 = 1+2)
_WORD_NUMBER('\u0001'),
/// Word glue to flag for automatic casing or separator in renderer.
_WORD_GLUE('\u0002'),
/// Escape to terminal control code. (note only needed for 6 bit and 8 bit systems)
_WORD_ESC('\u0003'),
_WORD_LINE('\n'),
_WORD_SPACE(' '),
_QUESTION_MARK('?'),
_EXCLAMATION_MARK('!'),
_CURLY_BRACKET_LEFT('{'),
_SQUARE_BRACKET_LEFT('['),
_ROUND_BRACKET_LEFT('('),
_LESSER_THAN_SIGN('<'),
_CURLY_BRACKET_RIGHT('}'),
_SQUARE_BRACKET_RIGHT(']'),
_ROUND_BRACKET_RIGHT(')'),
_GREATER_THAN_SIGN('>'),
/// 0 = __PIE _A _A (__PIE T001 PART_1)
/// 12 = __PIE _I _A _B (__PIE T009 PART_1+2)
__PIE('\u0001'),
/// Word glue to flag for automatic casing and/or separator in renderer.(by user-pref per context)
/// Example "__SPACE __GLUE _F _O _O __GLUE _B _A _R" can be rendered as " FooᐧBar" or " fOObAR" or " FOO_BAR" etc/etc.
__GLUE('\u0002'),
/// Escape to direct control code. (note only needed for 6 bit and 8 bit systems)
__ESC('\u0003'),
__LINE('\n'),
__SPACE(' '),
_QUESTION('?'),
_EXCLAMATION('!'),
_TILDE_SIGN('~'),
_PLUS_SIGN('+'),
_MINUS_SIGN('-'),
TAG_CURLY_LEFT('{'),
TAG_SQUARE_LEFT('['),
TAG_ROUND_LEFT('('),
TAG_COMPARE_LEFT('<'),
TAG_CURLY_RIGHT('}'),
TAG_SQUARE_RIGHT(']'),
TAG_ROUND_RIGHT(')'),
TAG_COMPARE_RIGHT('>'),
_TILDE('~'),
_PLUS('+'),
_MINUS('-'),
_ASTERISK('*'),
_COMMA(','),
_FULL_POINT('.'),
_DOT('.'),
_COLON(':'),
_SEMICOLON(';'),
_APOSTROPHE('\''),
_QUOTATION_MARK('\"'),
_BACKTICK_MARK('`'),
_QUOTATION('\"'),
_BACKTICK('`'),
_CARET('^'),
_EQUALS_SIGN('='),
_NUMBER_SIGN('#'),
_DOLLAR_SIGN('$'),
_PERCENT_SIGN('%'),
_EQUALS('='),
_HASH('#'),
_DOLLAR('$'),
_PERCENT('%'),
_VERTICAL_BAR('|'),
_UNDERSCORE('_'),
_BACKSLASH('\\'),
_SLASH('/'),
_AT_SIGN('@'),
_A('A', "Æ æ Å å Ǻ ǻ Ḁ ḁ ẚ Ă ă Ặ ặ Ắ ắ Ằ ằ Ẳ ẳ Ẵ ẵ Ȃ ȃ Â â Ậ ậ Ấ ấ Ầ ầ Ẫ ẫ Ẩ ẩ Ả ả Ǎ ǎ Ⱥ ⱥ Ȧ ȧ Ǡ ǡ Ạ ạ Ä ä Ǟ ǟ À à Ȁ ȁ Á á Ā ā Ā̀ ā̀ Ã ã Ą ą Ą́ ą́ Ą̃ ą̃ A̲ a̲ ᶏ"),
_B('B', "Ƀ ƀ Ḃ ḃ Ḅ ḅ Ḇ ḇ Ɓ ɓ ᵬ ᶀ"),
_C('C', "Ć ć Ĉ ĉ Č č Ċ ċ Ḉ ḉ Ƈ ƈ C̈ c̈ Ȼ ȼ Ç ç Ꞔ ꞔ Ꞓ ꞓ"),
_D('D', "Đ đ Ꟈ ꟈ Ɗ ɗ Ḋ ḋ Ḍ ḍ Ḑ ḑ Ḓ ḓ Ď ď Ḏ ḏ"),
_E('E', "Ĕ ĕ Ḝ ḝ Ȇ ȇ Ê ê Ê̄ ê̄ Ê̌ ê̌ Ề ề Ế ế Ể ể Ễ ễ Ệ ệ Ẻ ẻ Ḙ ḙ Ě ě Ɇ ɇ Ė ė Ė́ ė́ Ė̃ ė̃ Ẹ ẹ Ë ë È è È̩ è̩ Ȅ ȅ É é É̩ Ē ē Ḕ ḕ Ḗ ḗ Ẽ ẽ Ḛ ḛ Ę ę Ę́ ę́ Ę̃ ę̃ Ȩ ȩ E̩ e̩ ᶒ"),
_F('F', "Ƒ ƒ Ḟ ḟ ᵮ ᶂ "),
_G('G', "Ǵ ǵ Ǥ ǥ Ĝ ĝ Ǧ ǧ Ğ ğ Ģ ģ Ɠ ɠ Ġ ġ Ḡ ḡ Ꞡ ꞡ "),
_H('H', "Ĥ ĥ Ȟ ȟ Ħ ħ Ḩ ḩ Ⱨ ⱨ ẖ ẖ Ḥ ḥ Ḣ ḣ Ḧ ḧ Ḫ ḫ ꞕ Ꜧ ꜧ"),
_I('I', "Ị ị Ĭ ĭ Î î Ǐ ǐ Ɨ ɨ Ï ï Ḯ ḯ Í í Ì ì Ȉ ȉ Į į Į́ Į̃ Ī ī Ī̀ ī̀ ᶖ Ỉ ỉ Ȋ ȋ Ĩ ĩ Ḭ ḭ ᶤ"),
_J('J', "J́ j́ Ĵ ĵ J̌ ǰ Ɉ ɉ J̃ j̇̃"),
_K('K', "Ƙ ƙ Ꝁ ꝁ Ḱ ḱ Ǩ ǩ Ḳ ḳ Ķ ķ ᶄ Ⱪ ⱪ Ḵ ḵ"),
_L('L', "Ĺ ĺ Ł ł Ľ ľ Ḹ ḹ L̃ l̃ Ļ ļ Ŀ ŀ Ḷ ḷ Ḻ ḻ Ḽ ḽ Ƚ ƚ Ⱡ ⱡ"),
_M('M', "Ḿ ḿ Ṁ ṁ Ṃ ṃ M̃ m̃ ᵯ"),
_N('N', "Ń ń Ñ ñ Ň ň Ǹ ǹ Ṅ ṅ Ṇ ṇ Ņ ņ Ṉ ṉ Ṋ ṋ Ꞥ ꞥ ᵰ ᶇ"),
_O('O', "Ø ø Ǿ ǿ Ö ö Ȫ ȫ Ó ó Ò ò Ô ô Ố ố Ồ ồ Ổ ổ Ỗ ỗ Ộ ộ Ǒ ǒ Ő ő Ŏ ŏ Ȏ ȏ Ȯ ȯ Ȱ ȱ Ọ ọ Ɵ ɵ ᶱ Ơ ơ Ớ ớ Ờ ờ Ỡ ỡ Ợ ợ Ở ở Ỏ ỏ Ō ō Ṓ ṓ Ṑ ṑ Õ õ Ȭ ȭ Ṍ ṍ Ṏ ṏ Ǫ ǫ Ȍ ȍ O̩ o̩ Ó̩ ó̩ Ò̩ ò̩ Ǭ ǭ O͍ o͍"),
_P('P', "Ṕ ṕ Ṗ ṗ Ᵽ ᵽ Ƥ ƥ ᵱ ᶈ"),
_Q('Q', "ʠ Ɋ ɋ q̃"),
_R('R', "Ŕ ŕ Ɍ ɍ Ř ř Ŗ ŗ Ṙ ṙ Ȑ ȑ Ȓ ȓ Ṛ ṛ Ṝ ṝ Ṟ ṟ Ꞧ ꞧ Ɽ ɽ R̃ r̃ ᵲ ꭨ ᵳ ᶉ"),
_S('S', "Ś ś Ṡ ṡ ẛ Ṩ ṩ Ṥ ṥ Ṣ ṣ S̩ s̩ Ꞩ ꞩ Ꟊ ꟊ Ꟍ ꟍ Ŝ ŝ Ṧ ṧ Š š Ş ş Ș ș S̈ s̈ ᶊ Ȿ ȿ ᵴ ᶳ"),
_T('T', "Ť ť Ṫ ṫ ẗ Ţ ţ Ṭ ṭ Ʈ ʈ Ț ț ƫ Ṱ ṱ Ṯ ṯ Ŧ ŧ Ⱦ ⱦ Ƭ ƭ ᵵ ᶵ"),
_U('U', "Ŭ ŭ Ʉ ʉ ᵾ ᶶ Ꞹ ꞹ Ụ ụ Ü ü Ǜ ǜ Ǘ ǘ Ǚ ǚ Ǖ ǖ Ṳ ṳ Ú ú Ù ù Û û Ṷ ṷ Ǔ ǔ Ȗ ȗ Ű ű Ŭ ŭ Ư ư Ứ ứ Ừ ừ Ử ử Ự ự Ữ Ữ Ủ ủ Ū ū Ū̀ ū̀ Ū́ ū́ Ṻ ṻ Ū̃ ū̃ Ũ ũ Ṹ ṹ Ṵ ṵ ᶙ Ų ų Ų́ ų́ Ų̃ ų̃ Ȕ ȕ Ů ů"),
_V('V', "Ṽ ṽ Ṿ ṿ Ʋ ʋ "),
_W('W', "Ẃ ẃ Ẁ ẁ Ŵ ŵ Ẅ ẅ Ẇ ẇ Ẉ ẉ ẘ"),
_X('X', "Ẍ ẍ Ẋ ẋ X̂ x̂ ᶍ"),
_Y('Y', "Ý ý Ỳ ỳ Ŷ ŷ Ÿ ÿ Ỹ ỹ Ẏ ẏ Ỵ ỵ ẙ Ỷ ỷ Ȳ ȳ Ɏ ɏ Ƴ ƴ"),
_Z('Z', "Ź ź Ẑ ẑ Ž ž Ż ż Ẓ ẓ Ẕ ẕ Ƶ ƶ ᵶ Ᶎ ᶎ Ⱬ ⱬ"),
BAR_VERTICAL('|'),
BAR_UNDER('_'),
BAR_V_LEFT('\\'),
BAR_V_RIGHT('/'),
_AT('@'),
/// The tone letter 'A' is "one" and is equal to 'a', if your computer is expensive and has a lower-case char ROM, than this is 'a' except after __GLUE marker.
T001_A('A', "Æ æ Å å Ǻ ǻ Ḁ ḁ ẚ Ă ă Ặ ặ Ắ ắ Ằ ằ Ẳ ẳ Ẵ ẵ Ȃ ȃ Â â Ậ ậ Ấ ấ Ầ ầ Ẫ ẫ Ẩ ẩ Ả ả Ǎ ǎ Ⱥ ⱥ Ȧ ȧ Ǡ ǡ Ạ ạ Ä ä Ǟ ǟ À à Ȁ ȁ Á á Ā ā Ā̀ ā̀ Ã ã Ą ą Ą́ ą́ Ą̃ ą̃ A̲ a̲ ᶏ"),
T002_B('B', "Ƀ ƀ Ḃ ḃ Ḅ ḅ Ḇ ḇ Ɓ ɓ ᵬ ᶀ"),
T003_C('C', "Ć ć Ĉ ĉ Č č Ċ ċ Ḉ ḉ Ƈ ƈ C̈ c̈ Ȼ ȼ Ç ç Ꞔ ꞔ Ꞓ ꞓ"),
T004_D('D', "Đ đ Ꟈ ꟈ Ɗ ɗ Ḋ ḋ Ḍ ḍ Ḑ ḑ Ḓ ḓ Ď ď Ḏ ḏ"),
T005_E('E', "Ĕ ĕ Ḝ ḝ Ȇ ȇ Ê ê Ê̄ ê̄ Ê̌ ê̌ Ề ề Ế ế Ể ể Ễ ễ Ệ ệ Ẻ ẻ Ḙ ḙ Ě ě Ɇ ɇ Ė ė Ė́ ė́ Ė̃ ė̃ Ẹ ẹ Ë ë È è È̩ è̩ Ȅ ȅ É é É̩ Ē ē Ḕ ḕ Ḗ ḗ Ẽ ẽ Ḛ ḛ Ę ę Ę́ ę́ Ę̃ ę̃ Ȩ ȩ E̩ e̩ ᶒ"),
T006_F('F', "Ƒ ƒ Ḟ ḟ ᵮ ᶂ "),
T007_G('G', "Ǵ ǵ Ǥ ǥ Ĝ ĝ Ǧ ǧ Ğ ğ Ģ ģ Ɠ ɠ Ġ ġ Ḡ ḡ Ꞡ ꞡ "),
T008_H('H', "Ĥ ĥ Ȟ ȟ Ħ ħ Ḩ ḩ Ⱨ ⱨ ẖ ẖ Ḥ ḥ Ḣ ḣ Ḧ ḧ Ḫ ḫ ꞕ Ꜧ ꜧ"),
T009_I('I', "Ị ị Ĭ ĭ Î î Ǐ ǐ Ɨ ɨ Ï ï Ḯ ḯ Í í Ì ì Ȉ ȉ Į į Į́ Į̃ Ī ī Ī̀ ī̀ ᶖ Ỉ ỉ Ȋ ȋ Ĩ ĩ Ḭ ḭ ᶤ"),
T010_J('J', "J́ j́ Ĵ ĵ J̌ ǰ Ɉ ɉ J̃ j̇̃"),
T011_K('K', "Ƙ ƙ Ꝁ ꝁ Ḱ ḱ Ǩ ǩ Ḳ ḳ Ķ ķ ᶄ Ⱪ ⱪ Ḵ ḵ"),
T012_L('L', "Ĺ ĺ Ł ł Ľ ľ Ḹ ḹ L̃ l̃ Ļ ļ Ŀ ŀ Ḷ ḷ Ḻ ḻ Ḽ ḽ Ƚ ƚ Ⱡ ⱡ"),
T013_M('M', "Ḿ ḿ Ṁ ṁ Ṃ ṃ M̃ m̃ ᵯ"),
T014_N('N', "Ń ń Ñ ñ Ň ň Ǹ ǹ Ṅ ṅ Ṇ ṇ Ņ ņ Ṉ ṉ Ṋ ṋ Ꞥ ꞥ ᵰ ᶇ"),
T015_O('O', "Ø ø Ǿ ǿ Ö ö Ȫ ȫ Ó ó Ò ò Ô ô Ố ố Ồ ồ Ổ ổ Ỗ ỗ Ộ ộ Ǒ ǒ Ő ő Ŏ ŏ Ȏ ȏ Ȯ ȯ Ȱ ȱ Ọ ọ Ɵ ɵ ᶱ Ơ ơ Ớ ớ Ờ ờ Ỡ ỡ Ợ ợ Ở ở Ỏ ỏ Ō ō Ṓ ṓ Ṑ ṑ Õ õ Ȭ ȭ Ṍ ṍ Ṏ ṏ Ǫ ǫ Ȍ ȍ O̩ o̩ Ó̩ ó̩ Ò̩ ò̩ Ǭ ǭ O͍ o͍"),
T016_P('P', "Ṕ ṕ Ṗ ṗ Ᵽ ᵽ Ƥ ƥ ᵱ ᶈ"),
T017_Q('Q', "ʠ Ɋ ɋ q̃"),
T018_R('R', "Ŕ ŕ Ɍ ɍ Ř ř Ŗ ŗ Ṙ ṙ Ȑ ȑ Ȓ ȓ Ṛ ṛ Ṝ ṝ Ṟ ṟ Ꞧ ꞧ Ɽ ɽ R̃ r̃ ᵲ ꭨ ᵳ ᶉ"),
T019_S('S', "Ś ś Ṡ ṡ ẛ Ṩ ṩ Ṥ ṥ Ṣ ṣ S̩ s̩ Ꞩ ꞩ Ꟊ ꟊ Ꟍ ꟍ Ŝ ŝ Ṧ ṧ Š š Ş ş Ș ș S̈ s̈ ᶊ Ȿ ȿ ᵴ ᶳ"),
T020_T('T', "Ť ť Ṫ ṫ ẗ Ţ ţ Ṭ ṭ Ʈ ʈ Ț ț ƫ Ṱ ṱ Ṯ ṯ Ŧ ŧ Ⱦ ⱦ Ƭ ƭ ᵵ ᶵ"),
T021_U('U', "Ŭ ŭ Ʉ ʉ ᵾ ᶶ Ꞹ ꞹ Ụ ụ Ü ü Ǜ ǜ Ǘ ǘ Ǚ ǚ Ǖ ǖ Ṳ ṳ Ú ú Ù ù Û û Ṷ ṷ Ǔ ǔ Ȗ ȗ Ű ű Ŭ ŭ Ư ư Ứ ứ Ừ ừ Ử ử Ự ự Ữ Ữ Ủ ủ Ū ū Ū̀ ū̀ Ū́ ū́ Ṻ ṻ Ū̃ ū̃ Ũ ũ Ṹ ṹ Ṵ ṵ ᶙ Ų ų Ų́ ų́ Ų̃ ų̃ Ȕ ȕ Ů ů"),
T022_V('V', "Ṽ ṽ Ṿ ṿ Ʋ ʋ "),
T023_W('W', "Ẃ ẃ Ẁ ẁ Ŵ ŵ Ẅ ẅ Ẇ ẇ Ẉ ẉ ẘ"),
T024_X('X', "Ẍ ẍ Ẋ ẋ X̂ x̂ ᶍ"),
T025_Y('Y', "Ý ý Ỳ ỳ Ŷ ŷ Ÿ ÿ Ỹ ỹ Ẏ ẏ Ỵ ỵ ẙ Ỷ ỷ Ȳ ȳ Ɏ ɏ Ƴ ƴ"),
T026_Z('Z', "Ź ź Ẑ ẑ Ž ž Ż ż Ẓ ẓ Ẕ ẕ Ƶ ƶ ᵶ Ᶎ ᶎ Ⱬ ⱬ"),
/// The 27th letter is at the end of the old english alphabet.
_AMPERSAND('&'),
T027_AMPERSAND('&'),
;
private final char codePoint;
private final char codePointLower;
private final byte codePoint;
private final byte codePointLower;
private final String aliases;
private CDC1604DashP6(char codePoint) {
@ -128,8 +133,8 @@ public enum CDC1604DashP6 {
}
private CDC1604DashP6(char codePoint, String aliases) {
this.codePoint = codePoint;
this.codePointLower = Character.toLowerCase(codePoint);
this.codePoint = (byte) codePoint;
this.codePointLower = (byte) Character.toLowerCase(codePoint);
this.aliases = aliases;
}
@ -138,10 +143,6 @@ public enum CDC1604DashP6 {
}
public byte asciiByte() {
return (byte) codePoint;
}
public char asciiChar() {
return codePoint;
}
@ -159,7 +160,7 @@ public enum CDC1604DashP6 {
int codePoint = i.next();
boolean found = false;
if ('\r' == codePoint) {
result.add(CDC1604DashP6._WORD_LINE);
result.add(CDC1604DashP6.__LINE);
continue;
}
for (CDC1604DashP6 v : cdcChars) {
@ -170,23 +171,23 @@ public enum CDC1604DashP6 {
break;
}
if ('0' == codePoint) {
if (!CDC1604DashP6._A.equals(cdcNumberTerminator)) {
result.add(CDC1604DashP6._WORD_NUMBER);
result.add(CDC1604DashP6._A);
cdcNumberTerminator = CDC1604DashP6._A;
if (!CDC1604DashP6.T001_A.equals(cdcNumberTerminator)) {
result.add(CDC1604DashP6.__PIE);
result.add(CDC1604DashP6.T001_A);
cdcNumberTerminator = CDC1604DashP6.T001_A;
}
result.add(CDC1604DashP6._A);
result.add(CDC1604DashP6.T001_A);
found = true;
break;
}
if (codePoint >= '1' && codePoint <= '9') {
if (!CDC1604DashP6._I.equals(cdcNumberTerminator)) {
result.add(CDC1604DashP6._WORD_NUMBER);
result.add(CDC1604DashP6._I);
cdcNumberTerminator = CDC1604DashP6._I;
if (!CDC1604DashP6.T009_I.equals(cdcNumberTerminator)) {
result.add(CDC1604DashP6.__PIE);
result.add(CDC1604DashP6.T009_I);
cdcNumberTerminator = CDC1604DashP6.T009_I;
}
int cdcNumberOff = codePoint - '1'; // 0 = 1
int cdcNumber = CDC1604DashP6._A.ordinal() + cdcNumberOff;
int cdcNumber = CDC1604DashP6.T001_A.ordinal() + cdcNumberOff;
result.add(CDC1604DashP6.values()[cdcNumber]);
found = true;
break;
@ -228,13 +229,13 @@ public enum CDC1604DashP6 {
if (numberMode != null && (cdcPoint.ordinal() > numberMode.ordinal())) {
numberMode = null; // out of range
}
if (numberMode != null && (cdcPoint.ordinal() < CDC1604DashP6._A.ordinal())) {
if (numberMode != null && (cdcPoint.ordinal() < CDC1604DashP6.T001_A.ordinal())) {
numberMode = null; // below index 1 is end number mode
}
if (_WORD_GLUE.equals(cdcPoint)) {
if (CDC1604DashP6.__GLUE.equals(cdcPoint)) {
continue;
}
if (_WORD_NUMBER.equals(cdcPoint)) {
if (CDC1604DashP6.__PIE.equals(cdcPoint)) {
if (!cdc.hasNext()) {
break;
}
@ -244,8 +245,8 @@ public enum CDC1604DashP6 {
if (numberMode == null) {
buf.appendCodePoint(cdcPoint.asciiByte());
} else {
int terminatorNum = numberMode.ordinal() - CDC1604DashP6._A.ordinal() + 1;
int valueNumber = cdcPoint.ordinal() - CDC1604DashP6._A.ordinal();
int terminatorNum = numberMode.ordinal() - CDC1604DashP6.T001_A.ordinal() + 1;
int valueNumber = cdcPoint.ordinal() - CDC1604DashP6.T001_A.ordinal();
appendTerminatorNumber(buf, terminatorNum, valueNumber);
}
}

View file

@ -23,9 +23,11 @@
package org.x4o.o2o;
/**
* Direct Escaped Control of text terminal with CDC1604DashP6 code points.
* Direct Escaped Control of text terminal with CDC1604DashP6 code points. (TODO: currently empty)
*
* A 6 or 8 bit computer use the CDC1604DashP6._WORD_ESCAPE to use these 64 control codes.
* This block defines "start" points of different escape sequence data-gram encoding within the 6 bit space.
*
* A 6 or 8 bit computer use the CDC1604DashP6.__ESC to use these 64 control codes.
*
* A 18 or 144 bit computer uses this direct as the second 64 part page. (thus number 64 to 128)
*
@ -33,53 +35,100 @@ package org.x4o.o2o;
* @version 1.0 Dec 24, 2024
*/
public enum CDC1604DashP6DEC {
RESERVED___NUL,
RESERVED___PIE,
RESERVED___GLUE,
RESERVED___ESC,
RESERVED__LINE,
RESERVED__SPACE,
UNDEFINED__QUESTION,
UNDEFINED__EXCLAMATION,
UNDEFINED__TAG_CURLY_LEFT,
UNDEFINED__TAG_SQUARE_LEFT,
UNDEFINED__TAG_ROUND_LEFT,
UNDEFINED__TAG_COMPARE_LEFT,
UNDEFINED__TAG_CURLY_RIGHT,
UNDEFINED__TAG_SQUARE_RIGHT,
UNDEFINED__TAG_ROUND_RIGHT,
UNDEFINED__TAG_COMPARE_RIGHT,
UNDEFINED___TILDE,
UNDEFINED___PLUS,
UNDEFINED___MINUS,
UNDEFINED___ASTERISK,
UNDEFINED___COMMA,
UNDEFINED___DOT,
UNDEFINED___COLON,
UNDEFINED___SEMICOLON,
UNDEFINED___APOSTROPHE,
UNDEFINED___QUOTATION,
UNDEFINED___BACKTICK,
UNDEFINED___CARET,
UNDEFINED___EQUALS,
UNDEFINED___HASH,
UNDEFINED___DOLLAR,
UNDEFINED___PERCENT,
UNDEFINED__BAR_VERTICAL,
UNDEFINED__BAR_UNDER,
UNDEFINED__BAR_V_LEFT,
UNDEFINED__BAR_V_RIGHT,
UNDEFINED___AT,
UNDEFINED__T001_A,
UNDEFINED__T002_B,
UNDEFINED__T003_C,
UNDEFINED__T004_D,
UNDEFINED__T005_E,
UNDEFINED__T006_F,
UNDEFINED__T007_G,
UNDEFINED__T008_H,
UNDEFINED__T009_I,
UNDEFINED__T010_J,
UNDEFINED__T011_K,
UNDEFINED__T012_L,
UNDEFINED__T013_M,
UNDEFINED__T014_N,
UNDEFINED__T015_O,
UNDEFINED__T016_P,
UNDEFINED__T017_Q,
UNDEFINED__T018_R,
UNDEFINED__T019_S,
UNDEFINED__T020_T,
UNDEFINED__T021_U,
UNDEFINED__T022_V,
UNDEFINED__T023_W,
UNDEFINED__T024_X,
UNDEFINED__T025_Y,
UNDEFINED__T026_Z,
UNDEFINED__T027_AMPERSAND,
/// Reserved so that 6 and 8 bit systems can used P6._NUL for termination.
_RESERVED0(),
/// Encode 21 bit unicode-1 code point ??
_RESERVED1_UNICODE1(),
_RESERVED2(),
_RESERVED3(),
/// Unicode-4 is 72 bit stroke blocks, which are 12 P6 code points to align.
/// _WORD_ESC + _TEST_UNICODE4 + <stroke-amount> + manyStrokeBlocks
_RESERVED4_UNICODE4(),
_RESERVED5(),
// block line for first 6 P6 code point to keep non-printable chars free on 6 bit computers.
_ESC_TERMINATOR(), // ESC \ 0x9C ST String Terminator
// Encode 21 bit unicode-1 code point ??
// _RESERVED1_UNICODE1(), // todo move down
// Unicode-4 is 72 bit stroke blocks, which are 12 P6 code points to align.
// _WORD_ESC + _TEST_UNICODE4 + <stroke-amount> + manyStrokeBlocks
// _RESERVED4_UNICODE4(), // todo move down
//
// Historical glue for ansi codes, TODO: put on P6 index number of '[' and ']'
// TAG_ANSI_UPPER,
// TAG_ANSI_LOWER,
//
// used for bell,backspace,tab etc, TODO: fix free index number in current ansi escape codes.
// TAG_ANSI_C0,
//
// TODO: Re-impl simple like VT52 see https://en.wikipedia.org/wiki/ANSI_escape_code
// - ESC [
// - any number (including none) of "parameter bytes" in the range 0x300x3F (ASCII 09:;<=>?),
// - any number of "intermediate bytes" in the range 0x200x2F (ASCII space and !"#$%&'()*+,-./),
// - finally by a single "final byte" in the range 0x400x7E (ASCII @AZ[\]^_`az{|}~)
/// Moves cursor up. (test)
/// On 8 bit ansi system this takes ESC+[+1+A = 4 bytes/32bit to move 1 up
/// with terminator codes;
/// On 6 bit P6DEC system with takes _ESC+_CSI_CURSOR_UP+_WM+_I+_A+_ESC+_ESC_TERMINATOR = 7*P6 or 42 bits
/// On 18 bit P6DEC system with takes _CSI_CURSOR_UP+_WM+_I+_A+_ESC_TERMINATOR = 5*18 or 90 bits
/// with unsigned native packet integer; (but limits value)
/// On 6 bit P6DEC system with takes _ESC+_CSI_CURSOR_UP_NP+0x1+_ESC+_ESC_TERMINATOR = 5*P6 or 30 bits
/// On 18 bit P6DEC system with takes _CSI_CURSOR_UP_NP+0x1+_ESC_TERMINATOR = 3*18 or 54 bits
/// TODO: Think of better encoding system
_CSI_CURSOR_UP('A'),
_CSI_CURSOR_UP_NP()
//
// Try reading ISO/IEC 2022, see "XTerm Control Sequences" for what is old and what is used;
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
//
// Moves cursor up. (test)
// On 8 bit ansi system this takes ESC+[+1+A = 4 bytes/32bit to move 1 up
// with terminator codes;
// On 6 bit P6DEC system with takes __ESC+TAG_SQUARE_LEFT+__PIE+T009_I+T001_A
// On 18 bit P6DEC system with takes TAG_ANSI_UPPER+__PIE+T009_I+T001_A
;
private final Character csiPostfix;
private CDC1604DashP6DEC() {
this(null);
}
private CDC1604DashP6DEC(Character csiPostfix) {
this.csiPostfix = csiPostfix;
}
public Character csiPostFix() {
return csiPostfix;
}
}

View file

@ -61,12 +61,12 @@ public class CDC1604DashP6Test {
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(6, cdc.size());
Assertions.assertEquals(CDC1604DashP6._F, cdc.get(0));
Assertions.assertEquals(CDC1604DashP6._O, cdc.get(1));
Assertions.assertEquals(CDC1604DashP6._O, cdc.get(2));
Assertions.assertEquals(CDC1604DashP6._B, cdc.get(3));
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(4));
Assertions.assertEquals(CDC1604DashP6._R, cdc.get(5));
Assertions.assertEquals(CDC1604DashP6.T006_F, cdc.get(0));
Assertions.assertEquals(CDC1604DashP6.T015_O, cdc.get(1));
Assertions.assertEquals(CDC1604DashP6.T015_O, cdc.get(2));
Assertions.assertEquals(CDC1604DashP6.T002_B, cdc.get(3));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(4));
Assertions.assertEquals(CDC1604DashP6.T018_R, cdc.get(5));
String out = CDC1604DashP6.convertToUnicode(cdc);
Assertions.assertEquals("FOOBAR", out);
@ -78,22 +78,22 @@ public class CDC1604DashP6Test {
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(16, cdc.size());
Assertions.assertEquals(CDC1604DashP6._WORD_NUMBER, cdc.get(0));
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(1));
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(2)); // 0
Assertions.assertEquals(CDC1604DashP6._WORD_NUMBER, cdc.get(3));
Assertions.assertEquals(CDC1604DashP6._I, cdc.get(4));
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(5)); // 1
Assertions.assertEquals(CDC1604DashP6._B, cdc.get(6)); // 2
Assertions.assertEquals(CDC1604DashP6._WORD_NUMBER, cdc.get(7));
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(8));
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(9)); // 0
Assertions.assertEquals(CDC1604DashP6._WORD_NUMBER, cdc.get(10));
Assertions.assertEquals(CDC1604DashP6._I, cdc.get(11));
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(12)); // 1
Assertions.assertEquals(CDC1604DashP6._C, cdc.get(13)); // 3
Assertions.assertEquals(CDC1604DashP6._C, cdc.get(14)); // 3
Assertions.assertEquals(CDC1604DashP6._G, cdc.get(15)); // 7
Assertions.assertEquals(CDC1604DashP6.__PIE, cdc.get(0));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(1));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(2)); // 0
Assertions.assertEquals(CDC1604DashP6.__PIE, cdc.get(3));
Assertions.assertEquals(CDC1604DashP6.T009_I, cdc.get(4));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(5)); // 1
Assertions.assertEquals(CDC1604DashP6.T002_B, cdc.get(6)); // 2
Assertions.assertEquals(CDC1604DashP6.__PIE, cdc.get(7));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(8));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(9)); // 0
Assertions.assertEquals(CDC1604DashP6.__PIE, cdc.get(10));
Assertions.assertEquals(CDC1604DashP6.T009_I, cdc.get(11));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(12)); // 1
Assertions.assertEquals(CDC1604DashP6.T003_C, cdc.get(13)); // 3
Assertions.assertEquals(CDC1604DashP6.T003_C, cdc.get(14)); // 3
Assertions.assertEquals(CDC1604DashP6.T007_G, cdc.get(15)); // 7
String out = CDC1604DashP6.convertToUnicode(cdc);
Assertions.assertEquals("01201337", out);
@ -102,13 +102,13 @@ public class CDC1604DashP6Test {
@Test
public void testNumberPieOutOfRange() throws Exception {
List<CDC1604DashP6> cdc = new ArrayList<>();
cdc.add(CDC1604DashP6._WORD_NUMBER);
cdc.add(CDC1604DashP6._A);
cdc.add(CDC1604DashP6._B); // = B
cdc.add(CDC1604DashP6._WORD_NUMBER);
cdc.add(CDC1604DashP6._I);
cdc.add(CDC1604DashP6._C); // = 3
cdc.add(CDC1604DashP6._J); // = J
cdc.add(CDC1604DashP6.__PIE);
cdc.add(CDC1604DashP6.T001_A);
cdc.add(CDC1604DashP6.T002_B); // = B
cdc.add(CDC1604DashP6.__PIE);
cdc.add(CDC1604DashP6.T009_I);
cdc.add(CDC1604DashP6.T003_C); // = 3
cdc.add(CDC1604DashP6.T010_J); // = J
String out = CDC1604DashP6.convertToUnicode(cdc);
Assertions.assertEquals("B3J", out);
@ -120,14 +120,14 @@ public class CDC1604DashP6Test {
Assertions.assertNotNull(cdc);
Assertions.assertFalse(cdc.isEmpty());
Assertions.assertEquals(8, cdc.size());
Assertions.assertEquals(CDC1604DashP6._A, cdc.get(0));
Assertions.assertEquals(CDC1604DashP6._WORD_LINE, cdc.get(1));
Assertions.assertEquals(CDC1604DashP6._B, cdc.get(2));
Assertions.assertEquals(CDC1604DashP6._WORD_LINE, cdc.get(3));
Assertions.assertEquals(CDC1604DashP6._C, cdc.get(4));
Assertions.assertEquals(CDC1604DashP6._WORD_LINE, cdc.get(5));
Assertions.assertEquals(CDC1604DashP6._D, cdc.get(6));
Assertions.assertEquals(CDC1604DashP6._WORD_LINE, cdc.get(7));
Assertions.assertEquals(CDC1604DashP6.T001_A, cdc.get(0));
Assertions.assertEquals(CDC1604DashP6.__LINE, cdc.get(1));
Assertions.assertEquals(CDC1604DashP6.T002_B, cdc.get(2));
Assertions.assertEquals(CDC1604DashP6.__LINE, cdc.get(3));
Assertions.assertEquals(CDC1604DashP6.T003_C, cdc.get(4));
Assertions.assertEquals(CDC1604DashP6.__LINE, cdc.get(5));
Assertions.assertEquals(CDC1604DashP6.T004_D, cdc.get(6));
Assertions.assertEquals(CDC1604DashP6.__LINE, cdc.get(7));
String out = CDC1604DashP6.convertToUnicode(cdc);
Assertions.assertEquals("A\nB\nC\nD\n", out);