From c3cd9d1f9083d3e393ecafccf6c5eb040cec8759 Mon Sep 17 00:00:00 2001 From: Diomidis Spinellis Date: Tue, 11 May 2004 11:11:14 +0000 Subject: [PATCH] Add Greek character encoding suport. MFC after: 2 weeks --- games/morse/morse.6 | 28 +++++++++---------- games/morse/morse.c | 67 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 79 insertions(+), 16 deletions(-) diff --git a/games/morse/morse.6 b/games/morse/morse.6 index 74aa5eb3faa4..235d95424ffa 100644 --- a/games/morse/morse.6 +++ b/games/morse/morse.6 @@ -33,7 +33,7 @@ .\" @(#)bcd.6 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd December 7, 2000 +.Dd May 11, 2004 .Dt MORSE 6 .Os .Sh NAME @@ -143,20 +143,20 @@ minor glitch that is generated during program startup. speaker device file .El .Sh ENVIRONMENT -If your +Your .Ev LC_CTYPE -locale codeset is -.Ql KOI8-R , -characters with the high-order bit set are interpreted as -Cyrillic characters. If your -.Ev LC_CTYPE -locale codeset is -.Ql ISO8859-1 -compatible, -they are interpreted -as belonging to the -.Ql ISO-8859-1 -character set. +locale codeset determines how +characters with the high-order bit set +are interpreted. +.Bl -tag -width ".Li ISO8859-15" -compact +.It Li ISO8859-1 +.It Li ISO8859-15 +Interpret characters with the high-order bit set as Western European characters. +.It Li KOI8-R +Interpret characters with the high-order bit set as Cyrillic characters. +.It Li ISO8859-7 +Interpret characters with the high-order bit set as Greek characters. +.El .Sh SEE ALSO .Xr speaker 4 .Sh HISTORY diff --git a/games/morse/morse.c b/games/morse/morse.c index af0465c93317..92df71f5fdb7 100644 --- a/games/morse/morse.c +++ b/games/morse/morse.c @@ -145,7 +145,7 @@ static const struct morsetab mtab[] = { }; -static const struct morsetab iso8859tab[] = { +static const struct morsetab iso8859_1tab[] = { {'á', ".--.-"}, {'à', ".--.-"}, {'â', ".--.-"}, @@ -160,6 +160,67 @@ static const struct morsetab iso8859tab[] = { {'\0', ""} }; +static const struct morsetab iso8859_7tab[] = { + /* + * The greek alphabet; you'll need an 8859-7 font in order + * to see the actual characters. + * This table does not implement: + * - the special sequences for the seven diphthongs, + * - the punctuation differences. + * Implementing these features would introduce too many + * special-cases in the program's main loop. + * The diphtong sequences are: + * alpha iota .-.- + * alpha upsilon ..-- + * epsilon upsilon ---. + * eta upsilon ...- + * omikron iota ---.. + * omikron upsilon ..- + * upsilon iota .--- + * The different punctuation symbols are: + * ; ..-.- + * ! --..-- + */ + {'á', ".-"}, /* alpha */ + {'Ü', ".-"}, /* alpha with acute */ + {'â', "-..."}, /* beta */ + {'ã', "--."}, /* gamma */ + {'ä', "-.."}, /* delta */ + {'å', "."}, /* epsilon */ + {'Ý', "."}, /* epsilon with acute */ + {'æ', "--.."}, /* zeta */ + {'ç', "...."}, /* eta */ + {'Þ', "...."}, /* eta with acute */ + {'è', "-.-."}, /* theta */ + {'é', ".."}, /* iota */ + {'ß', ".."}, /* iota with acute */ + {'ú', ".."}, /* iota with diairesis */ + {'À', ".."}, /* iota with acute and diairesis */ + {'ê', "-.-"}, /* kappa */ + {'ë', ".-.."}, /* lamda */ + {'ì', "--"}, /* mu */ + {'í', "-."}, /* nu */ + {'î', "-..-"}, /* xi */ + {'ï', "---"}, /* omicron */ + {'ü', "---"}, /* omicron with acute */ + {'ð', ".--."}, /* pi */ + {'ñ', ".-."}, /* rho */ + {'ó', "..."}, /* sigma */ + {'ò', "..."}, /* final sigma */ + {'ô', "-"}, /* tau */ + {'õ', "-.--"}, /* upsilon */ + {'ý', "-.--"}, /* upsilon with acute */ + {'û', "-.--"}, /* upsilon and diairesis */ + {'à', "-.--"}, /* upsilon with acute and diairesis */ + {'ö', "..-."}, /* phi */ + {'÷', "----"}, /* chi */ + {'ø', "--.-"}, /* psi */ + {'ù', ".--"}, /* omega */ + {'þ', ".--"}, /* omega with acute */ + + {'\0', ""} +}; + static const struct morsetab koi8rtab[] = { /* * the cyrillic alphabet; you'll need a KOI8R font in order @@ -335,7 +396,9 @@ main(int argc, char **argv) hightab = koi8rtab; else if (strcmp(codeset, "ISO8859-1") == 0 || strcmp(codeset, "ISO8859-15") == 0) - hightab = iso8859tab; + hightab = iso8859_1tab; + else if (strcmp(codeset, "ISO8859-7") == 0) + hightab = iso8859_7tab; } if (lflag)