@@ 26,6 26,10 @@ namespace {
}
const std::string_view StringConversions::_formats[static_cast<size_t>(StringConversions::Format::NumFormats)] = {
+ std::string_view("pet2001"),
+ std::string_view("pet3000"),
+ std::string_view("pet4000"),
+ std::string_view("pet8000"),
std::string_view("vic20"),
std::string_view("c16"),
std::string_view("plus4"),
@@ 59,6 63,145 @@ StringConversions::StringConversions()
static_assert(core::array_num_elements(StringConversions::_flags) == static_cast<size_t>(StringConversions::NumFlags), "Formats mismatch");
{
+ // fill pet2001 lowercase
+ ConversionMap map;
+ for (wchar_t c = 0; c < 32; ++c)
+ map[c + 32] = c + 32;
+ map[L'@'] = 64;
+ for (wchar_t c = 0; c < 26; ++c)
+ map[c + L'A'] = c + 65;
+ map[L'['] = 0x5b;
+ map[L'\\'] = 0x5c;
+ map[L']'] = 0x5d;
+ map[L'\u2191'] = 0x5e; // arrow up
+ map[L'\u2190'] = 0x5f; // arrow left
+ map[L'\u2501'] = 0xc0; // horizontal line
+ for (wchar_t c = 0; c < 26; ++c)
+ map[c + 'a'] = c + 0xc1;
+ map[L'\u254b'] = 0xdb; // junction
+ map[L'\u2503'] = 0xdd; // vertical line
+
+ map[L'\u2592'] = 0xa6; // medium checker
+
+ map[L'\u2523'] = 0xab; // vertical and right crossing
+ map[L'\u2597'] = 0xac; // quadrant lower right
+ map[L'\u2517'] = 0xad; // up and right bend
+ map[L'\u2513'] = 0xae; // down and left bend
+ map[L'\u250f'] = 0xb0; // down and right bend
+ map[L'\u253b'] = 0xb1; // up and horizontal crossing
+ map[L'\u2533'] = 0xb2; // down and horizontal crossing
+ map[L'\u252b'] = 0xb3; // vertical and left crossing
+ map[L'\u2596'] = 0xbb; // quadrant lower left
+ map[L'\u259d'] = 0xbc; // quadrant upper right
+ map[L'\u251b'] = 0xbd; // up and left bend
+ map[L'\u2598'] = 0xbe; // quadrant upper left
+ map[L'\u259a'] = 0xbf; // quadrant upper left lower right
+
+ _conversions[format_hash(Format::Pet2001, SubFormat::Lowercase, Locale::English)] = map;
+ }
+
+ {
+ // fill pet2001 uppercase
+ ConversionMap map;
+ for (wchar_t c = 0; c < 32; ++c)
+ map[c + 32] = c + 32;
+ map[L'@'] = 64;
+ for (wchar_t c = 0; c < 26; ++c)
+ map[c + L'A'] = c + 65;
+ map[L'['] = 0x5b;
+ map[L'\\'] = 0x5c;
+ map[L']'] = 0x5d;
+ map[L'\u2191'] = 0x5e; // arrow up
+ map[L'\u2190'] = 0x5f; // arrow left
+ map[L'\u2501'] = 0xc0; // horizontal line
+ map[L'\u2660'] = 0xc1; // spades
+ map[L'\u2572'] = 0xcd; // nw diagonal line
+ map[L'\u2571'] = 0xce; // ne diagonal line
+ map[L'\u25cf'] = 0xd1; // filled circle
+ map[L'\u2665'] = 0xd3; // heart
+ map[L'\u2573'] = 0xd6; // cross
+ map[L'\u25cb'] = 0xd7; // circle
+ map[L'\u2663'] = 0xd8; // club
+ map[L'\u2666'] = 0xda; // diamond
+ map[L'\u254b'] = 0xdb; // junction
+ map[L'\u2503'] = 0xdd; // vertical line
+ map[L'\u23c0'] = 0xde; // pi
+ map[L'\u25e5'] = 0xdf; // upper right triangle
+ map[L'\u2592'] = 0xa6; // medium checker
+ map[L'\u25e4'] = 0xe9; // upper left triangle
+
+ map[L'\u2523'] = 0xab; // vertical and right crossing
+ map[L'\u2597'] = 0xac; // quadrant lower right
+ map[L'\u2517'] = 0xad; // up and right bend
+ map[L'\u2513'] = 0xae; // down and left bend
+ map[L'\u250f'] = 0xb0; // down and right bend
+ map[L'\u253b'] = 0xb1; // up and horizontal crossing
+ map[L'\u2533'] = 0xb2; // down and horizontal crossing
+ map[L'\u252b'] = 0xb3; // vertical and left crossing
+ map[L'\u2596'] = 0xbb; // quadrant lower left
+ map[L'\u259d'] = 0xbc; // quadrant upper right
+ map[L'\u251b'] = 0xbd; // up and left bend
+ map[L'\u2598'] = 0xbe; // quadrant upper left
+ map[L'\u259a'] = 0xbf; // quadrant upper left lower right
+
+ _conversions[format_hash(Format::Pet2001, SubFormat::Uppercase, Locale::English)] = map;
+ }
+
+ {
+ // fill pet2001 screencode uppercase
+ ConversionMap map;
+ for (wchar_t c = 0; c < 32; ++c)
+ map[c + 32] = c + 32;
+ map[L'@'] = 0;
+ for (wchar_t c = 0; c < 26; ++c)
+ map[c + L'A'] = c + 1;
+ map[L'['] = 27;
+ map[L'\\'] = 28;
+ map[L']'] = 29;
+ map[L'\u2191'] = 30;
+ map[L'\u2190'] = 31;
+
+ map[L'\u2501'] = 64; // horizontal line
+ map[L'\u2660'] = 65; // spades
+ map[L'\u2572'] = 77; // nw diagonal line
+ map[L'\u2571'] = 78; // ne diagonal line
+ map[L'\u25cf'] = 81; // filled circle
+ map[L'\u2665'] = 83; // heart
+ map[L'\u2573'] = 86; // cross
+ map[L'\u25cb'] = 87; // circle
+ map[L'\u2663'] = 88; // club
+ map[L'\u2666'] = 90; // diamond
+ map[L'\u254b'] = 91; // junction
+ map[L'\u2503'] = 93; // vertical line
+
+ map[L'\u23c0'] = 94; // pi
+ map[L'\u25e5'] = 95; // upper right triangle
+ map[L'\u2592'] = 102; // medium checker
+ map[L'\u25e4'] = 105; // upper left triangle
+
+ map[L'\u2523'] = 107; // vertical and right crossing
+ map[L'\u2597'] = 108; // quadrant lower right
+ map[L'\u2517'] = 109; // up and right bend
+ map[L'\u2513'] = 110; // down and left bend
+ map[L'\u250f'] = 112; // down and right bend
+ map[L'\u253b'] = 113; // up and horizontal crossing
+ map[L'\u2533'] = 114; // down and horizontal crossing
+ map[L'\u252b'] = 115; // vertical and left crossing
+ map[L'\u2596'] = 123; // quadrant lower left
+ map[L'\u259d'] = 124; // quadrant upper right
+ map[L'\u251b'] = 125; // up and left bend
+ map[L'\u2598'] = 126; // quadrant upper right
+ map[L'\u259a'] = 127; // quadrant upper left lower right
+
+ _conversions[format_hash(Format::Vic20, SubFormat::UppercaseScreen, Locale::English)] = map;
+ _conversions[format_hash(Format::C16, SubFormat::UppercaseScreen, Locale::English)] = map;
+ _conversions[format_hash(Format::Plus4, SubFormat::UppercaseScreen, Locale::English)] = map;
+ _conversions[format_hash(Format::C64, SubFormat::UppercaseScreen, Locale::English)] = map;
+ _conversions[format_hash(Format::C128, SubFormat::UppercaseScreen, Locale::English)] = map;
+ }
+
+
+ {
// fill petascii lowercase
ConversionMap map;
for (wchar_t c = 0; c < 32; ++c)
@@ 90,7 233,7 @@ StringConversions::StringConversions()
map[L'\u2596'] = 187; // quadrant lower left
map[L'\u259d'] = 188; // quadrant upper right
map[L'\u251b'] = 189; // up and left bend
- map[L'\u2598'] = 190; // quadrant upper right
+ map[L'\u2598'] = 190; // quadrant upper left
map[L'\u259a'] = 191; // quadrant upper left lower right
_conversions[format_hash(Format::Vic20, SubFormat::Lowercase, Locale::English)] = map;
@@ 141,7 284,7 @@ StringConversions::StringConversions()
map[L'\u2596'] = 187; // quadrant lower left
map[L'\u259d'] = 188; // quadrant upper right
map[L'\u251b'] = 189; // up and left bend
- map[L'\u2598'] = 190; // quadrant upper right
+ map[L'\u2598'] = 190; // quadrant upper left
map[L'\u259a'] = 191; // quadrant upper left lower right
_conversions[format_hash(Format::Vic20, SubFormat::Uppercase, Locale::English)] = map;
@@ 152,7 295,7 @@ StringConversions::StringConversions()
}
{
- // fill pet screencode lowercase
+ // fill c64 screencode lowercase
ConversionMap map;
for (wchar_t c = 0; c < 32; ++c)
map[c + 32] = c + 32;
@@ 183,7 326,7 @@ StringConversions::StringConversions()
map[L'\u2596'] = 123; // quadrant lower left
map[L'\u259d'] = 124; // quadrant upper right
map[L'\u251b'] = 125; // up and left bend
- map[L'\u2598'] = 126; // quadrant upper right
+ map[L'\u2598'] = 126; // quadrant upper left
map[L'\u259a'] = 127; // quadrant upper left lower right
_conversions[format_hash(Format::Vic20, SubFormat::LowercaseScreen, Locale::English)] = map;
@@ 194,7 337,7 @@ StringConversions::StringConversions()
}
{
- // fill pet screencode uppercase
+ // fill c64 screencode uppercase
ConversionMap map;
for (wchar_t c = 0; c < 32; ++c)
map[c + 32] = c + 32;
@@ 24,6 24,10 @@ class StringConversions
public:
enum class Format : uint8_t
{
+ Pet2001,
+ Pet3000,
+ Pet4000,
+ Pet8000,
Vic20,
C16,
Plus4,