harvard-kyoto: fixes

This commit is contained in:
Vlasta Vesely 2023-02-14 18:44:15 +01:00
parent 232a0f85b3
commit ff72a6ce05
4 changed files with 26 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
/* https://en.wikipedia.org/wiki/Velthuis */ /* https://en.wikipedia.org/wiki/Harvard-Kyoto */
#include "compat.h" #include "compat.h"
#include "harvard-kyoto.h" #include "harvard-kyoto.h"
@ -11,33 +11,32 @@ struct encoder_tuple {
}; };
static const struct encoder_tuple table[] = { static const struct encoder_tuple table[] = {
{"A", "\u0101"}, {"A", "\u0101"},
{"I", "\u012b"}, {"I", "\u012b"},
{"U", "\u016b"}, {"U", "\u016b"},
{"RR", "\u1e5d"}, {"RR", "\u1e5d"},
{"R", "\u1e5b"}, {"R", "\u1e5b"},
{"LL", "\u1e39"}, {"lRR", "\u1e39"},
{"L", "\u1e37"}, {"lR", "\u1e37"},
{"aa", "\u0101"}, {"aa", "\u0101"},
{"ii", "\u012b"}, {"ii", "\u012b"},
{"uu", "\u016b"}, {"uu", "\u016b"},
{".rr", "\u1e5d"},
{".r", "\u1e5b"},
{".ll", "\u1e39"},
{".l", "\u1e37"},
{"M", "\u1e43"}, {"M", "\u1e43"},
{"H", "\u1e25"}, {"H", "\u1e25"},
{"G", "\u1e45"}, {"G", "\u1e45"},
{"J", "\u00f1"}, {"J", "\u00f1"},
{"T", "\u1e6d"}, {"T", "\u1e6d"},
{"D", "\u1e0d"}, {"D", "\u1e0d"},
{"N", "\u1e47"}, {"N", "\u1e47"},
{"S", "\u1e63"}, {"S", "\u1e63"},
{"sh", "\u015b"}, {"z", "\u015b"},
{"z", "\u015b"}
/* not defined by the standard */
{"LL", "\u1e39"},
{"L", "\u1e37"}
}; };
static const struct encoder_tuple *find_tuple(const char *text) static const struct encoder_tuple *find_tuple(const char *text)

1
main.c
View file

@ -54,6 +54,7 @@ static const struct option long_opts[] = {
{"encode", no_argument, 0, 'e'}, {"encode", no_argument, 0, 'e'},
{"velthuis", no_argument, 0, 'e'}, {"velthuis", no_argument, 0, 'e'},
{"harvard", no_argument, 0, 'k'}, {"harvard", no_argument, 0, 'k'},
{"kyoto", no_argument, 0, 'k'},
{"ascii", no_argument, 0, 'a'}, {"ascii", no_argument, 0, 'a'},
{"devanagari", no_argument, 0, 'd'}, {"devanagari", no_argument, 0, 'd'},
{"czech", no_argument, 0, 'c'}, {"czech", no_argument, 0, 'c'},

View file

@ -18,9 +18,9 @@ START_TEST(test_harvard_kyoto_encoding)
{ {
test_harvard_kyoto("saMskRtam", "saṃskṛtam"); test_harvard_kyoto("saMskRtam", "saṃskṛtam");
test_harvard_kyoto("yogaH", "yogaḥ"); test_harvard_kyoto("yogaH", "yogaḥ");
test_harvard_kyoto("zaastraM shaastram", "śāstraṃ śāstram"); test_harvard_kyoto("zaastraM zAstram", "śāstraṃ śāstram");
test_harvard_kyoto("liGga yajJa varNa", "liṅga yajña varṇa"); test_harvard_kyoto("liGga yajJa varNa", "liṅga yajña varṇa");
test_harvard_kyoto("Aaa Iii Uuu RR R L", "āā īī ūū ṝ ṛ ḷ"); test_harvard_kyoto("Aaa Iii Uuu RR R L lR lRR", "āā īī ūū ṝ ṛ ḷ ḷ ḹ");
} }
END_TEST END_TEST

View file

@ -120,9 +120,10 @@ START_TEST(test_harvard)
{ {
test_output("./iast \"RtaM\" -k", "ṛtaṃ\n"); test_output("./iast \"RtaM\" -k", "ṛtaṃ\n");
test_output("./iast \"RtaM\" --harvard", "ṛtaṃ\n"); test_output("./iast \"RtaM\" --harvard", "ṛtaṃ\n");
test_output("./iast \"RtaM\" --kyoto", "ṛtaṃ\n");
/* force Devanagari output */ /* force Devanagari output */
test_output("./iast \"agnIH zatruH shatruH\" -kd", "अग्नीः शत्रुः शत्रुः\n"); test_output("./iast \"agnIH zatruH\" -kd", "अग्नीः शत्रुः\n");
} }
END_TEST END_TEST