morse.c (227101) | morse.c (230131) |
---|---|
1/* 2 * Copyright (c) 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 29 unchanged lines hidden (view full) --- 38 The Regents of the University of California. All rights reserved.\n"; 39#endif /* not lint */ 40 41#ifndef lint 42#if 0 43static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; 44#endif 45static const char rcsid[] = | 1/* 2 * Copyright (c) 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 29 unchanged lines hidden (view full) --- 38 The Regents of the University of California. All rights reserved.\n"; 39#endif /* not lint */ 40 41#ifndef lint 42#if 0 43static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; 44#endif 45static const char rcsid[] = |
46 "$FreeBSD: head/games/morse/morse.c 227101 2011-11-05 07:18:53Z ed $"; | 46 "$FreeBSD: head/games/morse/morse.c 230131 2012-01-15 13:23:01Z uqs $"; |
47#endif /* not lint */ 48 49#include <sys/time.h> 50 51#include <ctype.h> 52#include <fcntl.h> 53#include <langinfo.h> 54#include <locale.h> --- 83 unchanged lines hidden (view full) --- 138 {'#', ".-..."}, /* AS */ 139 {'&', "...-.-"}, /* SK */ 140 {'*', "...-."}, /* VE */ 141 {'%', "-...-.-"}, /* BK */ 142 143 {'\0', ""} 144}; 145 | 47#endif /* not lint */ 48 49#include <sys/time.h> 50 51#include <ctype.h> 52#include <fcntl.h> 53#include <langinfo.h> 54#include <locale.h> --- 83 unchanged lines hidden (view full) --- 138 {'#', ".-..."}, /* AS */ 139 {'&', "...-.-"}, /* SK */ 140 {'*', "...-."}, /* VE */ 141 {'%', "-...-.-"}, /* BK */ 142 143 {'\0', ""} 144}; 145 |
146 | 146/* 147 * Code-points for some Latin1 chars in ISO-8859-1 encoding. 148 * UTF-8 encoded chars in the comments. 149 */ |
147static const struct morsetab iso8859_1tab[] = { | 150static const struct morsetab iso8859_1tab[] = { |
148 {'�', ".--.-"}, 149 {'�', ".--.-"}, 150 {'�', ".--.-"}, 151 {'�', ".-.-"}, 152 {'�', "-.-.."}, 153 {'�', "..-.."}, 154 {'�', "..-.."}, 155 {'�', "-..-."}, 156 {'�', "---."}, 157 {'�', "..--"}, | 151 {'\340', ".--.-"}, /* �� */ 152 {'\341', ".--.-"}, /* �� */ 153 {'\342', ".--.-"}, /* �� */ 154 {'\344', ".-.-"}, /* �� */ 155 {'\347', "-.-.."}, /* �� */ 156 {'\350', "..-.."}, /* �� */ 157 {'\351', "..-.."}, /* �� */ 158 {'\352', "-..-."}, /* �� */ 159 {'\366', "---."}, /* �� */ 160 {'\374', "..--"}, /* �� */ |
158 159 {'\0', ""} 160}; 161 | 161 162 {'\0', ""} 163}; 164 |
165/* 166 * Code-points for some Greek chars in ISO-8859-7 encoding. 167 * UTF-8 encoded chars in the comments. 168 */ |
|
162static const struct morsetab iso8859_7tab[] = { 163 /* | 169static const struct morsetab iso8859_7tab[] = { 170 /* |
164 * The Greek alphabet; you'll need an ISO8859-7 font in order 165 * to see the actual characters. | |
166 * This table does not implement: 167 * - the special sequences for the seven diphthongs, 168 * - the punctuation differences. 169 * Implementing these features would introduce too many 170 * special-cases in the program's main loop. 171 * The diphthong sequences are: 172 * alpha iota .-.- 173 * alpha upsilon ..-- 174 * epsilon upsilon ---. 175 * eta upsilon ...- 176 * omicron iota ---.. 177 * omicron upsilon ..- 178 * upsilon iota .--- 179 * The different punctuation symbols are: 180 * ; ..-.- 181 * ! --..-- 182 */ | 171 * This table does not implement: 172 * - the special sequences for the seven diphthongs, 173 * - the punctuation differences. 174 * Implementing these features would introduce too many 175 * special-cases in the program's main loop. 176 * The diphthong sequences are: 177 * alpha iota .-.- 178 * alpha upsilon ..-- 179 * epsilon upsilon ---. 180 * eta upsilon ...- 181 * omicron iota ---.. 182 * omicron upsilon ..- 183 * upsilon iota .--- 184 * The different punctuation symbols are: 185 * ; ..-.- 186 * ! --..-- 187 */ |
183 {'�', ".-"}, /* alpha */ 184 {'�', ".-"}, /* alpha with acute */ 185 {'�', "-..."}, /* beta */ 186 {'�', "--."}, /* gamma */ 187 {'�', "-.."}, /* delta */ 188 {'�', "."}, /* epsilon */ 189 {'�', "."}, /* epsilon with acute */ 190 {'�', "--.."}, /* zeta */ 191 {'�', "...."}, /* eta */ 192 {'�', "...."}, /* eta with acute */ 193 {'�', "-.-."}, /* theta */ 194 {'�', ".."}, /* iota */ 195 {'�', ".."}, /* iota with acute */ 196 {'�', ".."}, /* iota with diaeresis */ 197 {'�', ".."}, /* iota with acute and diaeresis */ 198 {'�', "-.-"}, /* kappa */ 199 {'�', ".-.."}, /* lambda */ 200 {'�', "--"}, /* mu */ 201 {'�', "-."}, /* nu */ 202 {'�', "-..-"}, /* xi */ 203 {'�', "---"}, /* omicron */ 204 {'�', "---"}, /* omicron with acute */ 205 {'�', ".--."}, /* pi */ 206 {'�', ".-."}, /* rho */ 207 {'�', "..."}, /* sigma */ 208 {'�', "..."}, /* final sigma */ 209 {'�', "-"}, /* tau */ 210 {'�', "-.--"}, /* upsilon */ 211 {'�', "-.--"}, /* upsilon with acute */ 212 {'�', "-.--"}, /* upsilon and diaeresis */ 213 {'�', "-.--"}, /* upsilon with acute and diaeresis */ 214 {'�', "..-."}, /* phi */ 215 {'�', "----"}, /* chi */ 216 {'�', "--.-"}, /* psi */ 217 {'�', ".--"}, /* omega */ 218 {'�', ".--"}, /* omega with acute */ | 188 {'\341', ".-"}, /* ��, alpha */ 189 {'\334', ".-"}, /* ��, alpha with acute */ 190 {'\342', "-..."}, /* ��, beta */ 191 {'\343', "--."}, /* ��, gamma */ 192 {'\344', "-.."}, /* ��, delta */ 193 {'\345', "."}, /* ��, epsilon */ 194 {'\335', "."}, /* ��, epsilon with acute */ 195 {'\346', "--.."}, /* ��, zeta */ 196 {'\347', "...."}, /* ��, eta */ 197 {'\336', "...."}, /* ��, eta with acute */ 198 {'\350', "-.-."}, /* ��, theta */ 199 {'\351', ".."}, /* ��, iota */ 200 {'\337', ".."}, /* ��, iota with acute */ 201 {'\372', ".."}, /* ��, iota with diaeresis */ 202 {'\300', ".."}, /* ��, iota with acute and diaeresis */ 203 {'\352', "-.-"}, /* ��, kappa */ 204 {'\353', ".-.."}, /* ��, lambda */ 205 {'\354', "--"}, /* ��, mu */ 206 {'\355', "-."}, /* ��, nu */ 207 {'\356', "-..-"}, /* ��, xi */ 208 {'\357', "---"}, /* ��, omicron */ 209 {'\374', "---"}, /* ��, omicron with acute */ 210 {'\360', ".--."}, /* ��, pi */ 211 {'\361', ".-."}, /* ��, rho */ 212 {'\363', "..."}, /* ��, sigma */ 213 {'\362', "..."}, /* ��, final sigma */ 214 {'\364', "-"}, /* ��, tau */ 215 {'\365', "-.--"}, /* ��, upsilon */ 216 {'\375', "-.--"}, /* ��, upsilon with acute */ 217 {'\373', "-.--"}, /* ��, upsilon and diaeresis */ 218 {'\340', "-.--"}, /* ��, upsilon with acute and diaeresis */ 219 {'\366', "..-."}, /* ��, phi */ 220 {'\367', "----"}, /* ��, chi */ 221 {'\370', "--.-"}, /* ��, psi */ 222 {'\371', ".--"}, /* ��, omega */ 223 {'\376', ".--"}, /* ��, omega with acute */ |
219 220 {'\0', ""} 221}; 222 | 224 225 {'\0', ""} 226}; 227 |
228/* 229 * Code-points for the Cyrillic alphabet in KOI8-R encoding. 230 * UTF-8 encoded chars in the comments. 231 */ |
|
223static const struct morsetab koi8rtab[] = { | 232static const struct morsetab koi8rtab[] = { |
224 /* 225 * The Cyrillic alphabet; you'll need a KOI8-R font in order 226 * to see the actual characters 227 */ 228 {'�', ".-"}, /* a */ 229 {'�', "-..."}, /* be */ 230 {'�', ".--"}, /* ve */ 231 {'�', "--."}, /* ge */ 232 {'�', "-.."}, /* de */ 233 {'�', "."}, /* ye */ 234 {'�', "."}, /* yo, the same as ye */ 235 {'�', "...-"}, /* she */ 236 {'�', "--.."}, /* ze */ 237 {'�', ".."}, /* i */ 238 {'�', ".---"}, /* i kratkoye */ 239 {'�', "-.-"}, /* ka */ 240 {'�', ".-.."}, /* el */ 241 {'�', "--"}, /* em */ 242 {'�', "-."}, /* en */ 243 {'�', "---"}, /* o */ 244 {'�', ".--."}, /* pe */ 245 {'�', ".-."}, /* er */ 246 {'�', "..."}, /* es */ 247 {'�', "-"}, /* te */ 248 {'�', "..-"}, /* u */ 249 {'�', "..-."}, /* ef */ 250 {'�', "...."}, /* kha */ 251 {'�', "-.-."}, /* ce */ 252 {'�', "---."}, /* che */ 253 {'�', "----"}, /* sha */ 254 {'�', "--.-"}, /* shcha */ 255 {'�', "-.--"}, /* yi */ 256 {'�', "-..-"}, /* myakhkij znak */ 257 {'�', "..-.."}, /* ae */ 258 {'�', "..--"}, /* yu */ 259 {'�', ".-.-"}, /* ya */ | 233 {'\301', ".-"}, /* ��, a */ 234 {'\302', "-..."}, /* ��, be */ 235 {'\327', ".--"}, /* ��, ve */ 236 {'\307', "--."}, /* ��, ge */ 237 {'\304', "-.."}, /* ��, de */ 238 {'\305', "."}, /* ��, ye */ 239 {'\243', "."}, /* ��, yo, the same as ye */ 240 {'\326', "...-"}, /* ��, she */ 241 {'\332', "--.."}, /* ��, ze */ 242 {'\311', ".."}, /* ��, i */ 243 {'\312', ".---"}, /* ��, i kratkoye */ 244 {'\313', "-.-"}, /* ��, ka */ 245 {'\314', ".-.."}, /* ��, el */ 246 {'\315', "--"}, /* ��, em */ 247 {'\316', "-."}, /* ��, en */ 248 {'\317', "---"}, /* ��, o */ 249 {'\320', ".--."}, /* ��, pe */ 250 {'\322', ".-."}, /* ��, er */ 251 {'\323', "..."}, /* ��, es */ 252 {'\324', "-"}, /* ��, te */ 253 {'\325', "..-"}, /* ��, u */ 254 {'\306', "..-."}, /* ��, ef */ 255 {'\310', "...."}, /* ��, kha */ 256 {'\303', "-.-."}, /* ��, ce */ 257 {'\336', "---."}, /* ��, che */ 258 {'\333', "----"}, /* ��, sha */ 259 {'\335', "--.-"}, /* ��, shcha */ 260 {'\331', "-.--"}, /* ��, yi */ 261 {'\330', "-..-"}, /* ��, myakhkij znak */ 262 {'\334', "..-.."}, /* ��, ae */ 263 {'\300', "..--"}, /* ��, yu */ 264 {'\321', ".-.-"}, /* ��, ya */ |
260 261 {'\0', ""} 262}; 263 264static void show(const char *), play(const char *), morse(char); 265static void ttyout(const char *); 266static void sighandler(int); 267 --- 317 unchanged lines hidden --- | 265 266 {'\0', ""} 267}; 268 269static void show(const char *), play(const char *), morse(char); 270static void ttyout(const char *); 271static void sighandler(int); 272 --- 317 unchanged lines hidden --- |