Add Greek character encoding suport.

MFC after:	2 weeks
This commit is contained in:
Diomidis Spinellis 2004-05-11 11:11:14 +00:00
parent 26eff9e85b
commit c3cd9d1f90
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129114
2 changed files with 79 additions and 16 deletions

View File

@ -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

View File

@ -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)