home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OL.LZH
/
PROCS.LZH
/
MORSE.ICN
< prev
next >
Wrap
Text File
|
1991-07-13
|
1KB
|
47 lines
############################################################################
#
# Name: morse.icn
#
# Title: Convert string to Morse code
#
# Author: Ralph E. Griswold, modified by Rich Morin
#
# Date: June 26, 1990
#
############################################################################
#
# This procedure converts the string s to its Morse code equivalent.
#
# The version used is known both as International Morse Code and as
# Continental Code, and is used by radio amateurs (hams).
#
############################################################################
procedure morse(s)
local i, c, t, x
static code, key1, key2
initial {
code := "....------.----..---.-.---...--.--._
-..--..-.--....-.-.-...-..-....."
key1 := "tmot09ttt1t8tt2gqtttjtz7t3nky(tcttt_
tdx/twptb64earttltvtiuftsh5"
key2 := "tttttttttt'tt,ttttttttt:tttttt)tttt_
t?tttttttt-ttt.;tttttt\"tttt"
}
x := ""
every c := !map(s) do
if i := upto(c, key1) then {
t := code[i+:6]
x ||:= t[ upto("-",t)+1 : 0 ] || " "
}
else if i := upto(c, key2) then
x ||:= code[i+:6] || " "
else if c == " " then
x ||:= " "
else
x ||:= "<" || c || "> "
return x
end