mirror of
https://github.com/KarolS/millfork.git
synced 2024-12-26 12:29:26 +00:00
Fix escape sequences in many encodings
This commit is contained in:
parent
66fc1d3984
commit
24eac6708b
@ -7,7 +7,7 @@ C0-DF=@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
|
||||
|
||||
a-z=C1
|
||||
|
||||
{q}=02
|
||||
{apos}=07
|
||||
{q}=A2
|
||||
{apos}=A7
|
||||
{nbsp}=40
|
||||
{n}=8D
|
||||
|
@ -13,3 +13,4 @@ EOT=00
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{pound}=5c
|
||||
|
@ -7,8 +7,8 @@ EOT=7F
|
||||
20-3f=@abcdefghijklmnopqrstuvwxyz[\]^_
|
||||
60-7e=πABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~
|
||||
|
||||
{q}=22
|
||||
{apos}=27
|
||||
{q}=02
|
||||
{apos}=07
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{pi}=60
|
||||
|
@ -9,4 +9,4 @@ E0-FE=`abcdefghijklmnopqrstuvwxyz{\}~
|
||||
{q}=A2
|
||||
{apos}=A7
|
||||
{lbrace}=FB
|
||||
{rbrace}=FC
|
||||
{rbrace}=FD
|
||||
|
@ -26,6 +26,7 @@ f0-ff=đńňóôőö÷řůúűüýţ˙
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{euro}=80
|
||||
{copy}=a9
|
||||
{ss}=df
|
||||
{nbsp}=A0
|
||||
|
@ -23,6 +23,7 @@ f0-ff=рстуфхцчшщъыьэюя
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{euro}=88
|
||||
{copy}=a9
|
||||
{nbsp}=A0
|
||||
{shy}=AD
|
||||
|
@ -25,6 +25,7 @@ f0-ff=ðñòóôõö÷øùúûüýþÿ
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{euro}=80
|
||||
{cent}=a2
|
||||
{pound}=a3
|
||||
{yen}=a5
|
||||
|
@ -27,4 +27,5 @@ F0-FE=≡±≥≤⌠⌡÷≈°∙·√ⁿ²■
|
||||
{pound}=9c
|
||||
{yen}=9d
|
||||
{ss}=e1
|
||||
{pi}=e3
|
||||
{nbsp}=FF
|
||||
|
@ -23,6 +23,7 @@ F1-FE=±‗¾¶§÷¸°¨·¹³²■
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{copy}=b8
|
||||
{cent}=BD
|
||||
{pound}=9c
|
||||
{yen}=BE
|
||||
|
@ -24,6 +24,7 @@ F1-FE=±υφχ§ψ¸°¨ωϋΰώ■
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{pound}=9c
|
||||
{ss}=D7
|
||||
{nbsp}=FF
|
||||
{shy}=F0
|
||||
|
@ -25,6 +25,7 @@ F1-FE=±‗¾¶§÷¸°¨·¹³²■
|
||||
{rbrace}=7d
|
||||
{cent}=BD
|
||||
{pound}=9c
|
||||
{copy}=b8
|
||||
{yen}=BE
|
||||
{euro}=D5
|
||||
{ss}=e1
|
||||
|
@ -19,6 +19,9 @@ fe-ff=↕↔
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{pound}=a3
|
||||
{copy}=a4
|
||||
{pi}=b8
|
||||
{AE}=5b
|
||||
{OE}=5c
|
||||
{AA}=5d
|
||||
|
@ -19,3 +19,6 @@ fe-ff=↕↔
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{pound}=a3
|
||||
{copy}=a4
|
||||
{pi}=b8
|
||||
|
@ -19,3 +19,5 @@ fe-ff=↕↔
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{copy}=a4
|
||||
{pi}=b8
|
||||
|
@ -20,3 +20,6 @@ fe-ff=↕↔
|
||||
{apos}=27
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{pound}=a3
|
||||
{copy}=a4
|
||||
{pi}=b8
|
||||
|
@ -24,3 +24,4 @@ F0-F9=0123456789
|
||||
{q}=7F
|
||||
{lbrace}=C0
|
||||
{rbrace}=D0
|
||||
{cent}=4A
|
||||
|
@ -27,3 +27,4 @@ f1-ff=ñòóôġö÷ĝùúûüŭŝ˙
|
||||
{ss}=df
|
||||
{nbsp}=A0
|
||||
{shy}=AD
|
||||
{pound}=A3
|
||||
|
@ -24,4 +24,5 @@ F0-FE=≡±≥≤⌠⌡÷≈°∙·√ⁿ²■
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{ss}=e1
|
||||
{pi}=e3
|
||||
{nbsp}=FF
|
||||
|
@ -14,6 +14,7 @@ EOT=00
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{nbsp}=a0
|
||||
{copy}=98
|
||||
•=95
|
||||
|
||||
b0=№
|
||||
|
@ -14,6 +14,7 @@ EOT=00
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{nbsp}=9a
|
||||
{copy}=bf
|
||||
|
||||
80-8f=─│┌┐└┘├┤┬┴┼▀▄█▌▐
|
||||
90-99=░▒▓⌠■∙√≈≤≥
|
||||
|
@ -14,6 +14,7 @@ EOT=00
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{nbsp}=9a
|
||||
{copy}=bf
|
||||
|
||||
80-8f=─│┌┐└┘├┤┬┴┼▀▄█▌▐
|
||||
90-99=░▒▓“■∙”—№™
|
||||
|
@ -14,6 +14,7 @@ EOT=00
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{shy}=8d
|
||||
{copy}=bf
|
||||
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ EOT=00
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{nbsp}=9a
|
||||
{copy}=bf
|
||||
|
||||
80-8f=─│┌┐└┘├┤┬┴┼▀▄█▌▐
|
||||
90-99=░▒▓⌠■∙√≈≤≥
|
||||
|
@ -29,5 +29,6 @@ f1-ff=ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ
|
||||
{ss}=a7
|
||||
{nbsp}=CA
|
||||
{euro}=DB
|
||||
{pi}=b9
|
||||
€=DB
|
||||
U+F8FF=F0
|
||||
|
@ -26,4 +26,5 @@ F0-FE=≡±≥≤⌠⌡÷≈°∙·√ⁿ²■
|
||||
{cent}=9b
|
||||
{yen}=9d
|
||||
{ss}=e1
|
||||
{pi}=e3
|
||||
{nbsp}=FF
|
||||
|
@ -55,3 +55,8 @@ f0-ff=äëïöüçæåøñãõ⇒⇐⇔≡
|
||||
{lbrace}=7b
|
||||
{rbrace}=7d
|
||||
{pi}=1b18
|
||||
{pound}=a3
|
||||
{copy}=a4
|
||||
{yen}=bd
|
||||
{cent}=b1
|
||||
{ss}=ba
|
||||
|
@ -23,6 +23,7 @@ F0-FF=₽×./,♀0123456789
|
||||
{ot}=BE
|
||||
{'v}=BF
|
||||
{hav}=BF
|
||||
{apos}=E0
|
||||
{'r}=E4
|
||||
{ar}=E4
|
||||
{'m}=E5
|
||||
|
@ -22,6 +22,7 @@ F0-FF=₽×./,♀0123456789
|
||||
{'t}=DD
|
||||
{'v}=DE
|
||||
|
||||
{apos}=E0
|
||||
{PK}=E1
|
||||
{pk}=E1
|
||||
{MN}=E2
|
||||
|
@ -13,6 +13,7 @@ E6-E8=?!.
|
||||
EC-EF=▷▶▼♂
|
||||
F0-FF=₽×./,♀0123456789
|
||||
|
||||
{ss}=be
|
||||
{c'}=d4
|
||||
{ce}=d4
|
||||
{d'}=d5
|
||||
@ -37,6 +38,7 @@ F0-FF=₽×./,♀0123456789
|
||||
{u'}=de
|
||||
{ue}=de
|
||||
{y'}=df
|
||||
{apos}=e0
|
||||
|
||||
{PK}=E1
|
||||
{pk}=E1
|
||||
|
@ -18,7 +18,7 @@ class EncodingSanitySuite extends FunSuite with Matchers {
|
||||
test("Encoding sanity test") {
|
||||
val log = new ConsoleLogger()
|
||||
val repo = new TextCodecRepository(List("include"))
|
||||
val options = CompilationOptions(EmuPlatform.get(Cpu.Intel8080), Map(), None, 0, Map(), new TextCodecRepository(List("D:/dokumenty/millfork/include/encoding")), JobContext(log, new LabelGenerator))
|
||||
val options = CompilationOptions(EmuPlatform.get(Cpu.Intel8080), Map(), None, 0, Map(), new TextCodecRepository(List("include")), JobContext(log, new LabelGenerator))
|
||||
|
||||
def roundtrip(codec: TableTextCodec, str1: String, str2: String): Unit = {
|
||||
val l1 = codec.encode(log, None, str1.toCharArray.map(_.toInt).toList, options, lenient = false)
|
||||
@ -27,8 +27,18 @@ class EncodingSanitySuite extends FunSuite with Matchers {
|
||||
fail(s"Strings $str1 and $str2 encoded to $l1 and $l2 in encoding ${codec.name}")
|
||||
}
|
||||
}
|
||||
def getSingleByte(codec: TableTextCodec, str1: String): Int = {
|
||||
val l1 = codec.encode(log, None, str1.toCharArray.map(_.toInt).toList, options, lenient = false)
|
||||
if (l1.size != 1) {
|
||||
fail(s"String $str1 encoded to $l1 in encoding ${codec.name}")
|
||||
}
|
||||
l1.head
|
||||
}
|
||||
|
||||
for (encoding <- new File("include/encoding").list()) {
|
||||
val allEncodingFiles = new File("./include/encoding").list()
|
||||
log.info(s"Testing ${allEncodingFiles.size} encodings")
|
||||
for (encoding <- allEncodingFiles) {
|
||||
log.info(s"Testing $encoding")
|
||||
repo.forName(encoding.stripSuffix(".tbl"), None, log).codec match {
|
||||
case codec:TableTextCodec =>
|
||||
codec.escapeSequences.foreach {
|
||||
@ -38,6 +48,23 @@ class EncodingSanitySuite extends FunSuite with Matchers {
|
||||
case ("yen", _) => roundtrip(codec, "{yen}", "¥")
|
||||
case ("pound", _) => roundtrip(codec, "{pound}", "£")
|
||||
case ("cent", _) => roundtrip(codec, "{cent}", "¢")
|
||||
case ("euro", _) => roundtrip(codec, "{euro}", "€")
|
||||
case ("apos", _) => roundtrip(codec, "{apos}", "'")
|
||||
case ("q", _) => roundtrip(codec, "{q}", "\"")
|
||||
case _ =>
|
||||
}
|
||||
codec.map.foreach {
|
||||
case '©' => roundtrip(codec, "{copy}", "©")
|
||||
case 'ß' => roundtrip(codec, "{ss}", "ß")
|
||||
case 'π' => roundtrip(codec, "{pi}", "π")
|
||||
case '¥' => roundtrip(codec, "{yen}", "¥")
|
||||
case '£' => roundtrip(codec, "{pound}", "£")
|
||||
case '¢' => roundtrip(codec, "{cent}", "¢")
|
||||
case '€' => roundtrip(codec, "{euro}", "€")
|
||||
case '\'' => roundtrip(codec, "{apos}", "'")
|
||||
case '"' => roundtrip(codec, "{q}", "\"")
|
||||
case '{' => getSingleByte(codec, "{lbrace}") should equal (codec.map.indexOf('{'))
|
||||
case '}' => getSingleByte(codec, "{rbrace}") should equal (codec.map.indexOf('}'))
|
||||
case _ =>
|
||||
}
|
||||
case _ =>
|
||||
|
Loading…
Reference in New Issue
Block a user