diff options
author | B. Watson <urchlay@slackware.uk> | 2024-06-29 04:49:12 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-06-29 04:49:12 -0400 |
commit | 017a503f34a0f8ce2245f1b5dd78894f65326a90 (patch) | |
tree | 62ac02471db0a6e9b97b619b7b63f05110fad61b /mkatables.pl | |
parent | d1563c6d7db5e2c8484b80b870e7fb753400f6db (diff) | |
download | bw-atari8-tools-017a503f34a0f8ce2245f1b5dd78894f65326a90.tar.gz |
a8cat: added (will eventually replace both a8utf8 and a8eol).
Diffstat (limited to 'mkatables.pl')
-rw-r--r-- | mkatables.pl | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/mkatables.pl b/mkatables.pl new file mode 100644 index 0000000..1eb3a08 --- /dev/null +++ b/mkatables.pl @@ -0,0 +1,116 @@ +#!/usr/bin/perl -w + +%atascii = ( + 0 => "♥", + 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 => "␛", + 28 => "↑", + 29 => "↓", + 30 => "←", + 31 => "→", + 34 => "\\\"", + 92 => "\\\\", + 96 => "◆", + 123 => "♠", + 125 => "↰", + 126 => "◀", + 127 => "▶", +); + +%xl = ( + 0 => "á", + 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 => "␛", + 28 => "↑", + 29 => "↓", + 30 => "←", + 31 => "→", + 34 => "\\\"", + 92 => "\\\\", + 96 => "¡", + 123 => "Ä", + 125 => "↰", + 126 => "◀", + 127 => "▶", +); + +sub getcharname { + my $c = shift; + if($c == 127) { + return "[del]"; + } elsif($c < 32) { + return "^" . chr($c + 64); + } else { + return chr($c); + } +} + +sub mktable { + my ($name, $hash) = @_; + + print "const char *$name\[\] = {\n"; + for (0..127) { + my $cmt = sprintf("/* %3d \$%02x %5s */", $_, $_, getcharname($_)); + print "\t\"" . ($hash->{$_} || chr($_)), "\", $cmt\n"; + } + print "};\n\n"; +} + +print <<EOF; +/* ATASCII to UTF-8 tables. Generated by mkatables.pl. + Do not edit this file; edit mkatables.pl instead. */ + +EOF + +mktable("ata2utf", \%atascii); +mktable("ics2utf", \%xl); |