implement reverse mode for encoding + fix typos
This commit is contained in:
parent
b732cf6c33
commit
000d33b7a2
2 changed files with 13 additions and 5 deletions
9
main.c
9
main.c
|
@ -75,8 +75,13 @@ static int process_input(const char *input, char **out, unsigned int flags)
|
|||
char *tmp = NULL;
|
||||
int ret;
|
||||
|
||||
if (flags & FLAG_REVERSE)
|
||||
return transliterate_latin_to_devanagari(input, out);
|
||||
if (flags & FLAG_REVERSE) {
|
||||
if (flags & FLAG_VELTHUIS) {
|
||||
return encode_iast_to_velthuis(input, out);
|
||||
} else {
|
||||
return transliterate_latin_to_devanagari(input, out);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & FLAG_VELTHUIS)
|
||||
return encode_velthuis_to_iast(input, out);
|
||||
|
|
|
@ -97,9 +97,12 @@ END_TEST
|
|||
|
||||
START_TEST(test_velthuis)
|
||||
{
|
||||
test_output("./iast \"r.ta.m ca satyam\" -e", "rṭaṃ ca satyam\n");
|
||||
test_output("./iast \"r.ta.m ca satyam\" --encode", "rṭaṃ ca satyam\n");
|
||||
test_output("./iast \"r.ta.m ca satyam\" --velthuis", "rṭaṃ ca satyam\n");
|
||||
test_output("./iast \".rta.m ca satyam\" -e", "ṛtaṃ ca satyam\n");
|
||||
test_output("./iast \".rta.m ca satyam\" --encode", "ṛtaṃ ca satyam\n");
|
||||
test_output("./iast \".rta.m ca satyam\" --velthuis", "ṛtaṃ ca satyam\n");
|
||||
|
||||
/* reverse */
|
||||
test_output("./iast \"ṛtaṃ ca satyam\" -er", ".rta.m ca satyam\n");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
Loading…
Reference in a new issue