home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume36 / translit / part06 < prev    next >
Encoding:
Text File  |  1993-03-21  |  60.0 KB  |  1,436 lines

  1. Newsgroups: comp.sources.misc
  2. From: jkl@osc.edu (Jan Labanowski)
  3. Subject: v36i028:  translit - transliterate foreign alphabets, Part06/10
  4. Message-ID: <1993Mar19.224524.12252@sparky.imd.sterling.com>
  5. X-Md4-Signature: e6f0a520fd20024ed79b2a38ad48b863
  6. Date: Fri, 19 Mar 1993 22:45:24 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jkl@osc.edu (Jan Labanowski)
  10. Posting-number: Volume 36, Issue 28
  11. Archive-name: translit/part06
  12. Environment: UNIX, MS-DOS, VMS
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  pho-koi8.rus reg_exp.h tex-koi8.rus translit.txt.A
  19. # Wrapped by kent@sparky on Fri Mar 19 16:00:13 1993
  20. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  21. echo If this archive is complete, you will see the following message:
  22. echo '          "shar: End of archive 6 (of 10)."'
  23. if test -f 'pho-koi8.rus' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'pho-koi8.rus'\"
  25. else
  26.   echo shar: Extracting \"'pho-koi8.rus'\" \(10735 characters\)
  27.   sed "s/^X//" >'pho-koi8.rus' <<'END_OF_FILE'
  28. X# Jan Labanowski, jkl@osc.edu, Jan. 10, 1992 # File lc_koi8.dat
  29. X
  30. X# This is a transliteration data file for converting from various phonetic
  31. X# transliteration schemes to KOI-8 as used by RELCOM (GOST 19768-74).
  32. X# It is not possible to exactly represent phonetic transliteration
  33. X# since it is very flexible and frequently contradictory.
  34. X# This file is compilcated (in my humble opinion) and it will take
  35. X# a substantial amount of time to process longer files on a slower
  36. X# computer. However, this is what you get, of you want something more
  37. X# or less general. If your phonetic transliteration is consistent
  38. X# and unequivocal, you will be much better of to write a specific
  39. X# transliteration file, e.g. the GOST 16876-71 transliteration file (phg) or
  40. X# Pokrovsky scheme (php).
  41. X# The English text should be embraced in braces {}, while Russian one,
  42. X# is outside the braces.
  43. X# To be used with translit.c program by Jan Labanowski. For a format of
  44. X# this file consult translit documenation
  45. X
  46. X   1            file version number
  47. X
  48. X   "    "      # string delimiters
  49. X   [    ]      # list delimites
  50. X   {    }      # regular expression delimiters
  51. X
  52. X
  53. X
  54. X#starting sequence
  55. X""
  56. X
  57. X#ending sequence
  58. X""
  59. X
  60. X   2     # number of input SHIFT sequences
  61. X""  ""  ""  ""  ""  ""    # no SHIFT-OUT/IN for Russian letters
  62. X"{" ""  ""  ""  "}" ""    # Latin text in braces {}
  63. X
  64. X   0     # number of output SHIFT sequences, two sets of input characters
  65. X
  66. X# conversion table
  67. X# inp_set     inp_seq           out_set    out_seq
  68. X
  69. X# Latin(ASCII) is embraced in {}
  70. X     2         ["'A-Za-z]           0  ["'A-Za-z]
  71. X
  72. X# Cyrillic letters
  73. X
  74. X# If already converted to KOI8 by backstepping, send it to output
  75. X     1 {([\0x80-\0xFF])}    0         {\1}
  76. X
  77. X# Convert " followed by a capital letter to capital Tvyordyj znak and backstep
  78. X# otherwise " will be treated as a small tvyordyj znak
  79. X     1 {"([^A-Za-z])}  0         {"\1}             # " at the end
  80. X     1 {([^A-Za-z])"}  0         {\1"}             # " at the beginning
  81. X     1 {"([A-Z])}     -2         {\0xFF\1}         # capital Tvyordyj znak
  82. X     
  83. X
  84. X     1 {Q[Hh]}         0         "\0xFF"           # Some use it as Tvyordyj
  85. X     1 "qh"            0         "\0xDF"           # Some use it as tvyordyj
  86. X     1 "\0x22"         0         "\0xDF"           # tvyordyj znak
  87. X
  88. X# Convert ' preceded by a capital letter to capital Myagkij znak and backstep
  89. X# otherwise ' will be trated as a small myagkij znak
  90. X
  91. X     1 "''"                 0         "''"              # double quote
  92. X     1 {([^A-Za-z])'}       0         {\1'}             # opening quote
  93. X# Muagkij znak
  94. X 1 {((S[Hh][Cc][Hh])|(S[Hh])|(C[Hh])|(T[Cc][Hh])|([A-Z]))'} -1  {\1\0xF8}
  95. X                       
  96. X     1       "Q"            0         "\0xF8"
  97. X
  98. X     1       "'"            0         "\0xD8"           # myagkij znak
  99. X     1       "q"            0         "\0xD8"
  100. X
  101. X 1 {(([YIJ]?[EOUA])|([J]?[EOAUY]))((Y)|([IJ]))([^A-Za-z])} -1  {\1\0xEA\7} #-J
  102. X#   12              3             45   6      7
  103. X 1 {(([yij]?[eoua])|([j]?[eoauy]))((y)|([ij]))([^A-Za-z])} -1  {\1\0xCA\7} #-j
  104. X#   12              3             45   6      7
  105. X
  106. X# the story of ts versus c (the ts for c was a stupid idea of Library of
  107. X# Congress --- very, very stupid... T and S should be T and S, not C).
  108. X     1 "INTS"                       0       "\0xE9\0xED\0xE3"  #INC
  109. X     1 "INC"                        0       "\0xE9\0xED\0xE3"  #INC
  110. X     1 "ints"                       0       "\0xC9\0xCD\0xC3"  #inc
  111. X     1 "inc"                        0       "\0xC9\0xCD\0xC3"  #inc
  112. X     1 "CI"                         0       "\0xE3\0xE9"
  113. X     1 "ci"                         0       "\0xC3\0xC9"
  114. X     1 {AVIA(TS|C)}                 0       "\0xE1\0xE2\0xE9\0xE1\0xE3" #aviac
  115. X     1 {avia(ts|c)}                 0       "\0xC1\0xC2\0xC9\0xC1\0xC3" 
  116. X     1 {tsi([iyjo])}               -2       {\0xC3\0xC9\1}    # ci
  117. X     1 {TSI([IYJO])}               -2       {\0xE3\0xE9\1}    # ci
  118. X     1 {T[Ss]([Aa])}               -2       {\0xE3\1}         # CA
  119. X     1 {t[Ss]([Aa])}               -2       {\0xC3\1}         # ca
  120. X     1 {([DdKk])T[Ss]}             -1       {\1\0xE3}         # DC or KC
  121. X     1 {([DdKk])t[Ss]}             -1       {\1\0xC3}         # dc or kc
  122. X     1 {TS([^A-Za-z])}             -2       {\0xE3\1}         # C
  123. X     1 {ts([^A-Za-z])}             -2       {\0xC3\1}         # c
  124. X
  125. X#    Je --- people frequently write e instead of Je. E oborotnoje is
  126. X#    frequently at the beginning of foreign origin words
  127. X
  128. X     1 "AER"                                       0   "\0xE1\0xFC\0xF2"
  129. X     1 {([Aa])er}                                 -1   {\1\0xDC\0xD2}
  130. X
  131. X     1 {([A-Za-z])'[IiYyJj]?E}                    -1   {\1\0xF8\0xE5} # Je
  132. X     1 {([A-Za-z])'[IiYyJj]?e}                    -1   {\1\0xD8\0xC5} # je
  133. X
  134. X# Capital Je
  135. X 1 {([^A-Za-z])E(([Mm][Uu]?[^A-Za-z])|([Mm][Ll])|([Ll][^EeIiLlYyJj'])\
  136. X        |([Ll][YyIiJj]?[Ee][^A-Za-z])|([Rr][Uu])|([Ss][HhTtLl])|([Kk][Aa]))}
  137. X   
  138. X                                                  -1 {\1\0xE5\2}   # Je
  139. X# Small je
  140. X 1 {([^A-Za-z])e(([Mm][Uu]?[^A-Za-z])|([Mm][Ll])|([Ll][^EeIiLlYyJj'])\
  141. X        |([Ll][YyIiJj]?[Ee][^A-Za-z])|([Rr][Uu])|([Ss][HhTtLl])|([Kk][Aa]))}
  142. X                                                  -1 {\1\0xC5\2}   # je
  143. X
  144. X# Capital Eh
  145. X 1 {([^A-Za-z])E(([Ll][Ee][KkGg])|([KLMNPRSTFklmnprstf]))} -1 {\1\0xFC\2} #Eh
  146. X
  147. X# Small eh
  148. X 1 {([^A-Za-z])e(([Ll][Ee][KkGg])|([KLMNPRSTFklmnprstf]))} -1 {\1\0xDC\2} #eh
  149. X
  150. X     1 {([iIOoPpUuFfYy])i[Ee]}                    -1   {\1\0xC5}     # ie->je
  151. X     1 {([iIOoPpUuFfYy])I[Ee]}                    -1   {\1\0xE5}     # ie->je
  152. X
  153. X#   Eh is e oborotnoje but not at the end of the word
  154. X     1 {E[Hh]([^A-Za-z]+)}  0    {\0xE5\0xE8\1}
  155. X     1 {e[Hh]([^A-Za-z]+)}  0    {\0xC5\0xC8\1}
  156. X     1       {E[Hh]}        0         "\0xFC"           # E oborotnoje
  157. X     1       "eh"           0         "\0xDC"           # e oboritnoje
  158. X
  159. X#   Various I kratkoe
  160. X     1       {J[Ii]}        0         "\0xEA"           # I kratkoje
  161. X     1       {J[Jj]}        0         "\0xEA"
  162. X     1       "ji"           0         "\0xCA"           # i kratkoje
  163. X     1       "jj"           0         "\0xCA"
  164. X
  165. X
  166. X
  167. X# SHCH
  168. X     1 {s[Hh][Cc][Hh]}      0         "\0xDD"
  169. X     1       "w"            0         "\0xDD"
  170. X     1 {S[Hh][Cc][Hh]}      0         "\0xFD"         
  171. X     1       "W"            0         "\0xFD"
  172. X
  173. X                       
  174. X     1       {[YJ][Oo]}     0         "\0xB3"           # capital Jo
  175. X     1       {J[Ee]}        0         "\0xE5"           # Je
  176. X     1 {RIU(M[^A-Za-z])}   -1       {\0xF2\0xE9\0xF5\2} # IU
  177. X     1 {([^A-Za-z])I([Uu][Dd])} -1    {\1\0xE9\2}
  178. X     1 "DIUS"                    0    "\0xE4\0xE9\0xF5\0xF3"
  179. X     1       {[IYJ][Uu]}    0         "\0xE0"           # Ju
  180. X     1 {([Dd])I([Aa][KkGgPp])} -1     {\1\0xE9\2}       # dia
  181. X     1 "RIAL"               0         "\0xF2\0xE9\0xE1\0xEC"       # rial
  182. X     1 "KIA"                0         "\0xEB\0xE9\0xE1" # kia
  183. X     1       {[IYJ][Aa]}    0         "\0xF1"           # Ja
  184. X     1       {Z[Hh]}        0         "\0xF6"         
  185. X     1       {K[Hh]}        0         "\0xE8"         
  186. X     1       {H[Hh]}        0         "\0xE8"
  187. X     1       {C[Hh]}        0         "\0xFE"         
  188. X     1       {S[Hh]}        0         "\0xFB"         
  189. X     1       "zh"           0         "\0xD6"         
  190. X     1       "kh"           0         "\0xC8"
  191. X     1       "hh"           0         "\0xC8"
  192. X     1       "ch"           0         "\0xDE"         
  193. X     1       "sh"           0         "\0xDB"         
  194. X     1       {[yj]o}        0         "\0xA3"    #jo
  195. X     1       "je"           0         "\0xC5"    #je
  196. X
  197. X     1 {([Rr])iu([Mm][^A-Za-z])} -1   {\1\0xC9\0xD5\2} # iu
  198. X     1 {([^A-Za-z])i(ud)}        -1   {\1\0xC9\2}
  199. X     1 "dius"                     0   "\0xC4\0xC9\0xD5\0xD3"
  200. X     1 {[iyj]u}                   0   "\0xC0"    #ju
  201. X     1 {([Dd])ia([kgp])}         -1   {\1\0xC9\0xC1\2}  # dia
  202. X     1 "rial"                     0   "\0xD2\0xC9\0xC1\0xCC"       # rial
  203. X     1 "kia"                      0   "\0xCB\0xC9\0xC1"            # kia
  204. X     1 {[iyj]a}                   0   "\0xD1"    #ja
  205. X
  206. X     1       "A"            0         "\0xE1"         
  207. X     1       "B"            0         "\0xE2"         
  208. X     1       "V"            0         "\0xF7"         
  209. X     1       "G"            0         "\0xE7"         
  210. X     1       "D"            0         "\0xE4"         
  211. X     1       "Z"            0         "\0xFA"         
  212. X     1       "I"            0         "\0xE9"         
  213. X     1       "J"            0         "\0xEA"           # I kratkoje
  214. X     1       "K"            0         "\0xEB"         
  215. X     1       "L"            0         "\0xEC"         
  216. X     1       "M"            0         "\0xED"         
  217. X     1       "N"            0         "\0xEE"         
  218. X     1       "O"            0         "\0xEF"         
  219. X     1       "P"            0         "\0xF0"         
  220. X     1       "R"            0         "\0xF2"         
  221. X     1       "S"            0         "\0xF3"         
  222. X     1       "T"            0         "\0xF4"         
  223. X     1       "U"            0         "\0xF5"         
  224. X     1       "F"            0         "\0xE6"         
  225. X     1       "X"            0         "\0xE8"          # Kha
  226. X     1       "H"            0         "\0xE8"          # Kha
  227. X     1       "C"            0         "\0xE3"         
  228. X     1       "Y"            0         "\0xF9"         
  229. X     1       "E"            0         "\0xE5"          #Je
  230. X     1       "a"            0         "\0xC1"         
  231. X     1       "b"            0         "\0xC2"         
  232. X     1       "v"            0         "\0xD7"         
  233. X     1       "g"            0         "\0xC7"         
  234. X     1       "d"            0         "\0xC4"         
  235. X     1       "z"            0         "\0xDA"         
  236. X     1       "i"            0         "\0xC9"         
  237. X     1       "j"            0         "\0xCA"         
  238. X     1       "k"            0         "\0xCB"         
  239. X     1       "l"            0         "\0xCC"         
  240. X     1       "m"            0         "\0xCD"         
  241. X     1       "n"            0         "\0xCE"         
  242. X     1       "o"            0         "\0xCF"         
  243. X     1       "p"            0         "\0xD0"         
  244. X     1       "r"            0         "\0xD2"         
  245. X     1       "s"            0         "\0xD3"         
  246. X     1       "t"            0         "\0xD4"         
  247. X     1       "u"            0         "\0xD5"         
  248. X     1       "f"            0         "\0xC6"         
  249. X     1       "x"            0         "\0xC8"      # kha
  250. X     1       "h"            0         "\0xC8"      # kha
  251. X     1       "c"            0         "\0xC3"         
  252. X     1       "y"            0         "\0xD9"         
  253. X     1       "e"            0         "\0xC5"      # je
  254. X
  255. X
  256. END_OF_FILE
  257.   if test 10735 -ne `wc -c <'pho-koi8.rus'`; then
  258.     echo shar: \"'pho-koi8.rus'\" unpacked with wrong size!
  259.   fi
  260.   # end of 'pho-koi8.rus'
  261. fi
  262. if test -f 'reg_exp.h' -a "${1}" != "-c" ; then 
  263.   echo shar: Will not clobber existing file \"'reg_exp.h'\"
  264. else
  265.   echo shar: Extracting \"'reg_exp.h'\" \(749 characters\)
  266.   sed "s/^X//" >'reg_exp.h' <<'END_OF_FILE'
  267. X/*
  268. X * Definitions etc. for regexp(3) routines.
  269. X *
  270. X * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
  271. X * not the System V one.
  272. X */
  273. X#define NSUBEXP  10
  274. Xtypedef struct {
  275. X    char *startp[NSUBEXP];
  276. X    char *endp[NSUBEXP];
  277. X    char regstart;        /* Internal use only. */
  278. X    char reganch;        /* Internal use only. */
  279. X    char *regmust;        /* Internal use only. */
  280. X    int regmlen;        /* Internal use only. */
  281. X    char program[1];    /* Unwarranted chumminess with compiler. */
  282. X} reg_exp;
  283. X
  284. Xextern reg_exp *reg_comp();
  285. Xextern int reg_exec();
  286. Xextern int reg_try();
  287. Xextern void reg_sub();
  288. Xextern void reg_error();
  289. X
  290. X/*
  291. X * The first byte of the regexp internal "program" is actually this magic
  292. X * number; the start node begins in the second byte.
  293. X */
  294. X#define    MAGIC    0234
  295. END_OF_FILE
  296.   if test 749 -ne `wc -c <'reg_exp.h'`; then
  297.     echo shar: \"'reg_exp.h'\" unpacked with wrong size!
  298.   fi
  299.   # end of 'reg_exp.h'
  300. fi
  301. if test -f 'tex-koi8.rus' -a "${1}" != "-c" ; then 
  302.   echo shar: Will not clobber existing file \"'tex-koi8.rus'\"
  303. else
  304.   echo shar: Extracting \"'tex-koi8.rus'\" \(10491 characters\)
  305.   sed "s/^X//" >'tex-koi8.rus' <<'END_OF_FILE'
  306. X# Jan Labanowski, jkl@osc.edu, Jan. 10, 1992
  307. X# File tex_koi8.rus
  308. X
  309. X# This is a transliteration data file for converting from Latex to KOI8
  310. X# as used by RELCOM (GOST 19768-74). It assumes that the sister file:
  311. X# koi8-latex.rus was used to obtain the LaTeX file. 
  312. X# Since Latex is a program, frequently complicated, it is probably possible
  313. X# to convert LaTeX to KOI8 only with TeX. However, if you have a simple
  314. X# LaTeX document, without math, tables, different font sized and shapes,
  315. X# you can easily convert it to KOI8 tex, by listing symbols for Russian
  316. X# lettes on the left side and appropriate KOI8 codes on the right.
  317. X# Since there are many possible assignements in LaTeX, you need to
  318. X# modify this file to the ones actually used. First of all, some other
  319. X# symbols may be used to represent Russian letters. I included some more
  320. X# popular sequences, but there might be more, which I am not aware of.
  321. X# The TeX tranliteration sequences follow AMS cyrillic convention for
  322. X# WNCYR fonts with cyracc.def file
  323. X# To be used with translit.c program by Jan Labanowski. For a format of
  324. X# this file consult translit documentation
  325. X
  326. X   1            file version number
  327. X
  328. X   "    "      # string delimiters
  329. X   [    ]      # list delimites
  330. X   {    }      # regular expression delimiters
  331. X
  332. X
  333. X#starting sequence
  334. X""
  335. X
  336. X
  337. X#ending sequence
  338. X""
  339. X
  340. X
  341. X   4     # number input SHIFT sequences
  342. X# The last two of the input "character sets" are used simply to delete all
  343. X# characters from LaTeX preamble and the \end{document} closing
  344. X# For set 2, note that \cyr may be followed by spaces or new lines
  345. X# end preceded with some LaTeX escape sequences
  346. X
  347. X#SO-match #SO-subs  #Nest-up  #Nest-down  #SI-match   #SI-subs
  348. X    ""       ""        ""         ""         ""         ""  #Latin letters
  349. X
  350. X{{\\cyr[ \0x09-\0x0D]+}
  351. X             ""        "{"        "}"        "}"        ""  #cyrillic
  352. X
  353. X"\documentstyle" 
  354. X             ""        ""         ""  {\begin{document\0x7D[\0d09-\15]*} ""
  355. X
  356. X"\end{document}" ""    ""         ""         ""         ""
  357. X
  358. X
  359. X   0     # number of output SHIFT sequences, only one set of output characters
  360. X
  361. X# conversion table
  362. X# inp_set     inp_seq           out_set    out_seq
  363. X
  364. X     3   [\001-\255]                0     "\00"      # delete LaTeX preamble
  365. X     4   [\001-\255]                0     "\00"      # delete end{document}
  366. X
  367. X     1      [A-Za-z]                0    [A-Za-z]    #Latin letters A-Z and a-z
  368. X
  369. X# If double backslash is followed by new line, skip the double backslash
  370. X     0   {\\\\[\0x09-\0x0d]*}       0   "\0x0D\0x0A"    #restore new lines
  371. X
  372. X     0       "\\040"                0         " "    # protected space
  373. X
  374. X
  375. X# Convert some special TeX characters
  376. X
  377. X#  these do not require going out of {\cyr ....}
  378. X     0       "$[$"                    0         "["             
  379. X     0       "$]$"                    0         "]"             
  380. X     0       "$\wedge$"               0         "^"             
  381. X     0       "$\lbrace$"              0         "{"             
  382. X     0       "$\rbrace$"              0         "}"             
  383. X     0       "$\sim$"                 0         "~"             
  384. X     0       "$\backslash$"           0         "\"             
  385. X     0       "$\mid$"                 0         "|"             
  386. X     0       "$\star$"                0         "*"             
  387. X     0       "$<$"                    0         "<"             
  388. X     0       "$>$"                    0         ">"             
  389. X     0       "\$"                     0         "$"             
  390. X     0       "\%"                     0         "%"             
  391. X
  392. X#  These were represented correctly only in Latin charset
  393. X     1       "\_"                     0         "_"       
  394. X     1       "\&"                     0         "&"       
  395. X     1       "\#"                     0         "#"       
  396. X     1       "\@"                     0         "@"       
  397. X     
  398. X
  399. X# Cyrillic letters  
  400. X
  401. X# note that TS and ts sequences are checked before the \cydot is removed
  402. X
  403. X 2  {\\T[Ss][ \0x09-\0x0d]*}    0         "\0xE3"
  404. X 2       {T[Ss]}                0         "\0xE3"           # Tse
  405. X
  406. X 2  {\\ts][ \0x09-\0x0d]*}      0         "\0xC3"
  407. X 2       {t[Ss]}                0         "\0xC3"           # tse
  408. X
  409. X 2 {\\S[Hh][Cc][Hh][ \0x09-\0x0d]*} 0     "\0xFD"
  410. X 2 {S[Hh][Cc][Hh]}              0         "\0xFD"           
  411. X
  412. X 2 {\\s[Hh][Cc][Hh][ \0x09-\0x0d]*} 0     "\0xDD"
  413. X 2 {s[Hh][Cc][Hh]}              0         "\0xDD"           
  414. X
  415. X 2  {\\Cdprime[ \0x09-\0x0d]*}  0         "\0xFF"           # Tverdyj znak 
  416. X 2  {\\T[Zz][ \0x09-\0x0d]*}    0         "\0xFF"
  417. X
  418. X 2  {\\Cprime[ \0x09-\0x0d]*}   0         "\0xF8"           # Myagkij znak 
  419. X 2  {\\M[Zz][ \0x09-\0x0d]*}    0         "\0xF8"
  420. X
  421. X 2  {\\cdprime[ \0x09-\0x0d]*}  0         "\0xDF"           # tverdyj znak
  422. X 2  {\\tz[ \0x09-\0x0d]*}       0         "\0xDF"
  423. X 2  {\\cprime[ \0x09-\0x0d]*}   0         "\0xD8"           # myagkij znak
  424. X 2  {\\mz[ \0x09-\0x0d]*}       0         "\0xD8"
  425. X
  426. X 2  {\\u[ \0x09-\0x0d]*I}       0         "\0xEA"          # I kratkoje 
  427. X 2  "\u{I}"                     0         "\0xEA"
  428. X 2  {\\[Uu]I[ \0x09-\0x0d]*}    0         "\0xEA"
  429. X
  430. X 2  {\\u[ \0x09-\0x0d]*i}       0         "\0xCA"          # i kratkoje
  431. X 2  {\\ui[ \0x09-\0x0d]*}       0         "\0xCA"
  432. X 2  "\u{i}"                     0         "\0xCA"
  433. X
  434. X 2  {\\`[ \0x09-\0x0d]*E}       0         "\0xFC"          # E obortnoye
  435. X 2  "\`{E}"                     0         "\0xFC"
  436. X
  437. X 2  {\\`[ \0x09-\0x0d]*e}       0         "\0xDC"          # e oborotnoye
  438. X 2  "\`{e}"                     0         "\0xDC"
  439. X
  440. X 2 {\\K[Hh][ \0x09-\0x0d]*}     0         "\0xE8"           
  441. X 2 {K[Hh]}                      0         "\0xE8"           
  442. X
  443. X 2 {\\k[Hh][ \0x09-\0x0d]*}     0         "\0xC8"           
  444. X 2 {k[Hh]}                      0         "\0xC8"           
  445. X
  446. X 2 {\\T[Cc][Hh][ \0x09-\0x0d]*} 0         "\0xFE"
  447. X 2 {\\C[Hh][ \0x09-\0x0d]*}     0         "\0xFE"
  448. X 2 {C[Hh]}                      0         "\0xFE"           
  449. X
  450. X
  451. X 2 {\\S[Hh][ \0x09-\0x0d]*}     0         "\0xFB"           
  452. X 2 {S[Hh]}                      0         "\0xFB"           
  453. X
  454. X 2 {\\c[Hh][ \0x09-\0x0d]*}     0         "\0xDE"           
  455. X 2 {\\t[Cc][Hh][ \0x09-\0x0d]*} 0         "\0xDE"
  456. X 2 {c[Hh]}                      0         "\0xDE"           
  457. X
  458. X 2 {\\s[Hh][ \0x09-\0x0d]*}     0         "\0xDB"           
  459. X 2 {s[Hh]}                      0         "\0xDB"           
  460. X
  461. X 2 {\\Z[Hh][ \0x09-\0x0d]*}     0         "\0xF6"           
  462. X 2 {Z[Hh]}                      0         "\0xF6"           
  463. X
  464. X 2 {\\z[Hh][ \0x09-\0x0d]*}     0         "\0xD6"           
  465. X 2 {z[Hh]}                      0         "\0xD6"           
  466. X
  467. X 2 {\\Y[Uu][ \0x09-\0x0d]*}     0         "\0xE0"           
  468. X 2 {Y[Uu]}                      0         "\0xE0"           
  469. X
  470. X 2 {\\Y[Aa][ \0x09-\0x0d]*}     0         "\0xF1"           
  471. X 2 {Y[Aa]}                      0         "\0xF1"           
  472. X
  473. X 2 {\\y[Uu][ \0x09-\0x0d]*}     0         "\0xC0"           
  474. X 2 {y[Uu]}                      0         "\0xC0"           
  475. X
  476. X 2 {\\y[Aa][ \0x09-\0x0d]*}     0         "\0xD1"           
  477. X 2 {y[Aa]}                      0         "\0xD1"           
  478. X
  479. X 2 {\\"[ \0x09-\0x0D]*e}        0         "\0xA3"           # small \"e (yo)
  480. X 2 "\\0o42{e}"                  0         "\0xA3"
  481. X 2 {\\y[Oo][ \0x09-\0x0D]*}     0         "\0xA3"
  482. X
  483. X 2 {\\"[ \0x09-\0x0D]*E}        0         "\0xB3"           # capital \"E (Yo)
  484. X 2 "\\0o42{E}"                  0         "\0xB3"
  485. X 2 {\\Y[Oo][ \0x09-\0x0D]*}     0         "\0xB3"
  486. X
  487. X 2  {\\cydot[ \0x09-\0x0d]*}    0         ""                #\cydot out
  488. X
  489. X    2       "H"                 0         "\0xE8"           
  490. X    2       "h"                 0         "\0xC8"           
  491. X    2       "W"                 0         "\0xFD"           
  492. X    2       "w"                 0         "\0xDD"           
  493. X    2       "X"                 0         "\0xFB"           
  494. X    2       "x"                 0         "\0xDB"           
  495. X
  496. X    2       "A"                 0         "\0xE1"           
  497. X    2       "B"                 0         "\0xE2"           
  498. X    2       "V"                 0         "\0xF7"           
  499. X    2       "G"                 0         "\0xE7"           
  500. X    2       "D"                 0         "\0xE4"           
  501. X    2       "E"                 0         "\0xE5"           
  502. X    2       "Z"                 0         "\0xFA"           
  503. X    2       "I"                 0         "\0xE9"           
  504. X    2       "K"                 0         "\0xEB"           
  505. X    2       "L"                 0         "\0xEC"           
  506. X    2       "M"                 0         "\0xED"           
  507. X    2       "N"                 0         "\0xEE"           
  508. X    2       "O"                 0         "\0xEF"           
  509. X    2       "P"                 0         "\0xF0"           
  510. X    2       "R"                 0         "\0xF2"           
  511. X    2       "S"                 0         "\0xF3"           
  512. X    2       "T"                 0         "\0xF4"           
  513. X    2       "U"                 0         "\0xF5"           
  514. X    2       "F"                 0         "\0xE6"           
  515. X    2       "C"                 0         "\0xE3"           
  516. X    2       "Y"                 0         "\0xF9"           
  517. X    2       "a"                 0         "\0xC1"           
  518. X    2       "b"                 0         "\0xC2"           
  519. X    2       "v"                 0         "\0xD7"           
  520. X    2       "g"                 0         "\0xC7"           
  521. X    2       "d"                 0         "\0xC4"           
  522. X    2       "e"                 0         "\0xC5"           
  523. X    2       "z"                 0         "\0xDA"           
  524. X    2       "i"                 0         "\0xC9"           
  525. X    2       "k"                 0         "\0xCB"           
  526. X    2       "l"                 0         "\0xCC"           
  527. X    2       "m"                 0         "\0xCD"           
  528. X    2       "n"                 0         "\0xCE"           
  529. X    2       "o"                 0         "\0xCF"           
  530. X    2       "p"                 0         "\0xD0"           
  531. X    2       "r"                 0         "\0xD2"           
  532. X    2       "s"                 0         "\0xD3"           
  533. X    2       "t"                 0         "\0xD4"           
  534. X    2       "u"                 0         "\0xD5"           
  535. X    2       "f"                 0         "\0xC6"           
  536. X    2       "c"                 0         "\0xC3"           
  537. X    2       "y"                 0         "\0xD9"           
  538. X
  539. X# Trash {}
  540. X    0       "{"                 0         ""
  541. END_OF_FILE
  542.   if test 10491 -ne `wc -c <'tex-koi8.rus'`; then
  543.     echo shar: \"'tex-koi8.rus'\" unpacked with wrong size!
  544.   fi
  545.   # end of 'tex-koi8.rus'
  546. fi
  547. if test -f 'translit.txt.A' -a "${1}" != "-c" ; then 
  548.   echo shar: Will not clobber existing file \"'translit.txt.A'\"
  549. else
  550.   echo shar: Extracting \"'translit.txt.A'\" \(34820 characters\)
  551.   sed "s/^X//" >'translit.txt.A' <<'END_OF_FILE'
  552. X
  553. X
  554. X
  555. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  556. X
  557. X
  558. X
  559. XNAME
  560. X     TRANSLIT
  561. X          Program to transliterate texts in  different  character
  562. X          sets.  The  program  converts input character codes (or
  563. X          sequences of codes) to a different set of output  char-
  564. X          acter  codes  (or  sequences  of  codes).  Intended for
  565. X          transliteration  to/from  phonetic  representation   of
  566. X          foreign  letters  with  Latin  letters  from/to special
  567. X          national codes used for  these  letters.   It  supports
  568. X          simple  matches,  character  lists and flexible matches
  569. X          via  regular  expressions.  The   new   transliteration
  570. X          schemes  are  easily  added by creating simple transli-
  571. X          teration tables. Multiple character sets are  supported
  572. X          for  input and output. It does not yet support UNICODE,
  573. X          but some day it will.
  574. X
  575. X
  576. XCOPYRIGHT
  577. X     Copyright (c) 1993 Jan Labanowski and JKL Enterprises, Inc.
  578. X     You may distribute the Software only as a  complete  set  of
  579. X     files.  You may distribute the modified Software only if you
  580. X     retain the Copyright notice and you do not  delete  original
  581. X     code,   data,   documentation  and  associated  files.   The
  582. X     Software is copyrighted.  You may not sell the  software  or
  583. X     incorporate  it  in  the  commercial product without written
  584. X     permission from Jan Labanowski or JKL Enterprises, Inc.  You
  585. X     are  allowed  to charge for media and copying if you distri-
  586. X     bute the whole unaltered package.
  587. X
  588. X
  589. XSYNOPSIS
  590. X     translit [ -i inpfile ][ -o outfile ][ -d ][ -t  transtbl  |
  591. X     transtbl ]
  592. X
  593. X
  594. XOPTIONS
  595. X     -i inpfile
  596. X          inpfile is a name of input file to  be  transliterated.
  597. X          If "-i" is not specified, the input is taken from stan-
  598. X          dard input.
  599. X
  600. X     -o outfile
  601. X          outfile is an output  file,  where  the  transliterated
  602. X          text  is  stored. If "-o"  is not specified, the output
  603. X          is directed to the standard output.  Program  will  not
  604. X          overwrite  the  existing file. If file exists, you need
  605. X          to delete it first.
  606. X
  607. X     -d   Some information on character codes read from  transli-
  608. X          teration   table   file  are  sent  to  standard  error
  609. X          ("stderr"). Useful when developing new  transliteration
  610. X          tables.
  611. X
  612. X
  613. X
  614. XJKL                 Last change: 23-Jan-1993                    1
  615. X
  616. X
  617. X
  618. X
  619. X
  620. X
  621. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  622. X
  623. X
  624. X
  625. X     -t transtbl
  626. X          transtbl is a transliteration table file which you want
  627. X          to  use. The "-t" option may be omitted if the transtbl
  628. X          is specified as the last parameter on the command line.
  629. X          The  program first tries to locate transtbl file in the
  630. X          current directory, and if not found,  it  searches  the
  631. X          directory  chosen  at  compilation/installation time in
  632. X          "paths.h". If no "transtbl" is given, the default  file
  633. X          name    specified    in   "paths.h"   is   taken.   The
  634. X          compile/installation time defaults in "paths.h" for the
  635. X          search  directory  and  the  default  file  name can be
  636. X          overiden by setting environment variables:  TRANSP  and
  637. X          TRANSF, respectively (see below).
  638. X
  639. X
  640. XENVIRONMENT VARIABLES
  641. X     The default path to the  directory  holding  transliteration
  642. X     tables  can  be  overiden  by  setting  environment variable
  643. X     TRANSP. The default name for the transliteration  table  can
  644. X     be overiden by setting TRANSF environment variable. However,
  645. X     when the transliteration file is given on the command  line,
  646. X     it  will overide the defaults and environment setting.  Here
  647. X     are some examples of setting environment variables for  dif-
  648. X     ferent operating systems:
  649. X
  650. X       UN*X System
  651. X         If you are using csh (C-shell):
  652. X              setenv TRANSP /home/john/translit/
  653. X              setenv TRANSF koi8-tex.rus
  654. X         If you are using sh (Bourne Shell):
  655. X              set TRANSP=/home/john/translit/
  656. X              export TRANSP
  657. X              set TRANSF=koi8-tex.rus
  658. X              export TRANSF
  659. X       VAX-VMS System
  660. X              TRANSP:==SYS$USER:[JOHN.TRANSLIT]
  661. X              TRANSF:==KOI8-TEX.TBL
  662. X       PC-DOS or MS-DOS
  663. X              SET TRANSP=C:\JOHN\TRANSLIT\
  664. X              SET TRANSF=KOI8-TEX.TBL
  665. X     Note that the  directory  path  has  to  include  concluding
  666. X     slashes, \ or /.
  667. X
  668. X
  669. X
  670. XEXAMPLES
  671. X          cat text.koi8 | translit koi8-tex.rus > text.tex
  672. X     in UN*X is equivalent to:
  673. X
  674. X          translit -t koi8-tex.rus -o text.tex -i text.koi8
  675. X     and converts file text.koi8 to file text.tex using  transli-
  676. X     teration specified in the file koi8-tex.rus.
  677. X
  678. X
  679. X
  680. XJKL                 Last change: 23-Jan-1993                    2
  681. X
  682. X
  683. X
  684. X
  685. X
  686. X
  687. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  688. X
  689. X
  690. X
  691. X          translit -i text.koi8 koi8-cl.rus
  692. X     displays the converted text from file text.koi8 on your ter-
  693. X     minal. The conversion table is koi8-cl.rus (KOI8 --> Library
  694. X     of Congress).
  695. X
  696. X          translit -i text.alt  -t  alt-koi8.rus  |  translit  -o
  697. X     text.tex -t koi8-tex.rus
  698. X     is essentially equivalent to the following two  commands  in
  699. X     UN*X or MS-DOS:
  700. X          translit -i text.alt -o junkfile -t alt-koi8.rus
  701. X          translit -i junkfile -o text.tex -t koi8-tex.rus
  702. X     and converts the file in ALT character set to a  LaTeX  file
  703. X     for printing.
  704. X
  705. X          translit  -i  russ.txt  pho-koi8.rus  |   translit   -o
  706. X     russ.tex koi8-tex.rus
  707. X     converts file  russ.txt  from  phonetic  transliteration  to
  708. X     LaTeX file russ.tex for printing.
  709. X
  710. X
  711. X
  712. X
  713. XTRANSLITERATION TABLES
  714. X     The following transliteration files are available  with  the
  715. X     current distribution. Consult the comments in the individual
  716. X     files for details.
  717. X
  718. X     koi8-tex.rus
  719. X          Conversion table which changes the file in KOI8 (8  bit
  720. X          character  set  used by RELCOM news service) to a LaTeX
  721. X          file for printing with AMS WNCYR fonts.
  722. X
  723. X     tex-koi8.rus
  724. X          Conversion table for the LaTeX to KOI8 conversion. Note
  725. X          that  it will not handle complicated cases, since LaTeX
  726. X          is a program, and only TeX can convert a LaTeX   source
  727. X          to  the characters. However, it should work OK for sim-
  728. X          ple cases of text only files, and may need some editing
  729. X          for complicated cases.
  730. X
  731. X     alt-gos.rus
  732. X          This is a transliteration data file for converting from
  733. X          ALT (Bryabrins alternativnyj variant used in many popu-
  734. X          lar wordprocessors) to GOSTSCII 84  (approx.  ISO-8859-
  735. X          5?)
  736. X
  737. X     alt-koi8.rus
  738. X          This is a transliteration data file for converting from
  739. X          ALT  to  KOI8.   KOI8  is meant to be GOST 19768-74 (as
  740. X          used by RELCOM).
  741. X
  742. X     gos-alt.rus
  743. X
  744. X
  745. X
  746. XJKL                 Last change: 23-Jan-1993                    3
  747. X
  748. X
  749. X
  750. X
  751. X
  752. X
  753. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  754. X
  755. X
  756. X
  757. X          This is a  transliteration  data  file  for  converting
  758. X          GOSTSCII  84  (approx.  ISO-8859-5?)  to ALT (Bryabrins
  759. X          alternativnyj variant)
  760. X
  761. X     gos-koi8.rus
  762. X          This is a  transliteration  data  file  for  converting
  763. X          GOSTSCII  84 (approx. ISO-8859-5?) to KOI8 used by REL-
  764. X          COM KOI8 is meant to be GOST 19768-74
  765. X
  766. X     koi8-alt.rus
  767. X          This is a transliteration data file for converting from
  768. X          KOI8.   KOI8  is  meant  to  be  GOST  19768-74, to ALT
  769. X          (Bryabrins alternativnyj variant)
  770. X
  771. X     koi8-gos.rus
  772. X          This is a transliteration data file for converting from
  773. X          KOI8  (Relcom).   KOI8 is meant to be GOST 19768-74, to
  774. X          GOSTSCII 84 (approx. ISO-8859-5)
  775. X
  776. X     koi8-7.rus
  777. X          This file converts from KOI8 to KOI7.
  778. X
  779. X     koi7-8.rus
  780. X          This file  converts  from  KOI7  to  KOI8.  Before  you
  781. X          attempt  the  conversion,  you  might need to perform a
  782. X          simple edit on your file. You MUST read the comments in
  783. X          koi7-8.rus before you attempt this conversion.
  784. X
  785. X     koi7nl-8.rus
  786. X          This file assumes that there are only  Russian  letters
  787. X          (no  Latin)  in  the  input  file.  If  you  have Latin
  788. X          letters, and you inserted SHIFT-OUT/IN characters,  use
  789. X          file koi7-8.rus.
  790. X
  791. X     koi8-lc.rus
  792. X          This file converts KOI8  to  the  Library  of  Congress
  793. X          transliteration.  Some extensions are added.
  794. X
  795. X     koi8-php.rus
  796. X          This file converts KOI8 to the  Pokrovsky  translitera-
  797. X          tion.
  798. X
  799. X     php-koi8.rus
  800. X          This file converts from  Pokrovsky  transliteration  to
  801. X          KOI8.
  802. X
  803. X     koi8-phg.rus
  804. X          This file converts from KOI8 to GOST transliteration.
  805. X
  806. X     phg-koi8.rus
  807. X          This file converts from GOST transliteration to KOI8.
  808. X
  809. X
  810. X
  811. X
  812. XJKL                 Last change: 23-Jan-1993                    4
  813. X
  814. X
  815. X
  816. X
  817. X
  818. X
  819. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  820. X
  821. X
  822. X
  823. X     pho-koi8.rus
  824. X          This is a table which will convert from many "phonetic"
  825. X          transliteration schemes to KOI8. It is elaborate and it
  826. X          takes a lot of time to  transliterate  the  file  using
  827. X          this  table.  Some  transliterations  are  hopeless and
  828. X          internally inconsistent (as humans...), so the  results
  829. X          cannot be bug free.  You might want to modify the file,
  830. X          if your transliteration  patterns  are  different  than
  831. X          those  assumed  in this file. You may also want to sim-
  832. X          plify this file if the phonetic transliteration you are
  833. X          converting is a sound one (most are not, e.g., they use
  834. X          e for je and e oborotnoye, ts for c and t-s, h for kha,
  835. X          i for i-kratkoe, etc.).
  836. X
  837. X
  838. X
  839. XINTRODUCTION
  840. X     If you do not  intend  to  write  your  own  transliteration
  841. X     tables, you may skip this description and go directly to the
  842. X     installation and copyright sections. However, you might want
  843. X     to read this material anyhow, to better understand the traps
  844. X     and  complexities  of  transliteration.   It  is  frequently
  845. X     necessary  to transliterate text, i.e., to change one set of
  846. X     characters (or  composite  characters,  phonemes,  etc.)  to
  847. X     another set.
  848. X
  849. X     On computers, the transliteration operation consists of con-
  850. X     verting  the  input file in some character set to the output
  851. X     file in another character set.
  852. X
  853. X     In the simplest case, the  single  characters  are  transli-
  854. X     terated,  i.e,  their  codes  are  changed according to some
  855. X     transliteration table. This is called remapping and,  assum-
  856. X     ing  the one-to-one mapping, the task can be accomplished by
  857. X     a simple pseudo program:
  858. X          new_char_code = character_map[old_char_code];
  859. X
  860. X     If the one-to-one correspondence does not exist (i.e.,  some
  861. X     codes may be present in one set, but do not have correspond-
  862. X     ing codes in another set), precise  transliteration  is  not
  863. X     possible. In such cases there are 3 obvious possibilities:
  864. X          1. skip characters which do not have counterparts,
  865. X          2. retain unchanged codes of these characters,
  866. X          3. convert the codes to multicharacter sequences.
  867. X     In some cases, the file can contain more than one  character
  868. X     sets,  e.g.,  the  file  can  contain Latin characters (e.g.
  869. X     English text) and Cyrillic characters (e.g.  Russian  text).
  870. X     If  the  character codes assigned to characters in different
  871. X     sets do not overlap, this is still a simple mapping problem.
  872. X     This  is  a  case  with KOI8 or GOSTCII character tables for
  873. X     Russian, which reserve the  lower  127  codes  for  standard
  874. X     ASCII   codes  (which  include  all  Latin  characters)  and
  875. X
  876. X
  877. X
  878. XJKL                 Last change: 23-Jan-1993                    5
  879. X
  880. X
  881. X
  882. X
  883. X
  884. X
  885. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  886. X
  887. X
  888. X
  889. X     characters with codes above 127 for Cyrillic letters.
  890. X
  891. X     If character codes overlap, there  is  a  SHIFT-OUT/SHIFT-IN
  892. X     technique  in which the meaning of the character sequence is
  893. X     determined by an opening code  (or  sequence  of  characters
  894. X     codes).  In  this case, the meaning of the series of charac-
  895. X     ters is determined by the SHIFT-OUT character (or  sequence)
  896. X     which  precedes  them.  The SHIFT-IN character (or sequence)
  897. X     following the series of characters returns the  "reader"  to
  898. X     the default or previous status.  To schemes are used:
  899. X          (char_set_1)(SHIFT-IN[1])(SHIFT-OUT[2])(char_set_2)...
  900. X     or
  901. X          (char_set_1)(SHIFT-OUT[2])(char_set_2)(SHIFT-
  902. X     OUT[1])char_set_1...
  903. X
  904. X     Since computer keyboards, screens, printers, software, etc.,
  905. X     are  by  necessity language specific (the most popular being
  906. X     ASCII), there is a problem of typing foreign  language  text
  907. X     which  contains letters different than standard Latin alpha-
  908. X     bet. For  this  reason,  many  transliteration  schemes  use
  909. X     several  Latin  letters  to  represent  a  single  letter of
  910. X     foreign alphabet, for example:
  911. X     zh is used to represent cyrillic letter  zhe,   \"o  may  be
  912. X     used to represent the o umlaut, etc.
  913. X
  914. X     If there is one-to-one mapping of such sequences to  another
  915. X     alphabet,  it is also easy to process. However, it is neces-
  916. X     sary to substitute longest sequences first. For  example,  a
  917. X     frequently used transliteration for cyrillic letters:
  918. X       shch --- letter shcza 221 (decimal KOI8 code)
  919. X       sh   --- letter sha   219
  920. X       ch   --- letter cze   222
  921. X       c    --- letter tse   195
  922. X       h    --- letter kha   200
  923. X       a    --- letter a     193
  924. X
  925. X     Obviously, in this case, we should proceed first  with  con-
  926. X     verting  all  shch  sequences  to  shcha  letter,  then two-
  927. X     character sh and ch, and then  single  character  c  and  h.
  928. X     Generally,  for  the one-to-one transliteration, the longest
  929. X     sequences should  be  precessed  first,  and  the  order  of
  930. X     conversion  within  sequences  of  the  same length makes no
  931. X     difference.  For example, converting the  word  "shchah"  to
  932. X     KOI8 should proceed in a following way:
  933. X       shchah --> (221)ah, (221)ah -->  (221)(193)h,  (221)(193)h
  934. X     --> (221)(193)(200)
  935. X     There is a multitude of reasons why transliteration is done.
  936. X     I wrote this program having in mind the following ones:
  937. X       1) to print cyrillic text  using  TeX/LaTeX  and  cyrillic
  938. X     fonts
  939. X       2) to read KOI8 encoded messages from Russia on  my  ASCII
  940. X     terminal.
  941. X
  942. X
  943. X
  944. XJKL                 Last change: 23-Jan-1993                    6
  945. X
  946. X
  947. X
  948. X
  949. X
  950. X
  951. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  952. X
  953. X
  954. X
  955. X     However, I was trying to make  it  flexible  to  accommodate
  956. X     other uses.
  957. X
  958. X
  959. XPROGRAM OPERATION
  960. X     The program converts the input file to an output file  using
  961. X     transliteration  rules  from  the  transliteration rule file
  962. X     which you specify with option -t.  Some examples of transli-
  963. X     teration  rule  files  are  enclosed.  Before program can be
  964. X     used, the transliteration rules need to be specified.
  965. X
  966. X     These are given as a file which  consist  of  the  following
  967. X     parts described below:
  968. X       1) File format number (it is 1 at this moment)
  969. X       2) Delimiters used to enclose a) simple strings, b)  char-
  970. X            acter lists, c) regular expressions
  971. X       3) Starting sequence for output
  972. X       4) Ending sequence for output
  973. X       5) Number of input "character sets"
  974. X       6) SHIFT-OUT/SHIFT-IN sequences for each  input  character
  975. X            set
  976. X       7) Number of output "character sets"
  977. X       8) SHIFT-OUT/SHIFT-IN sequences for each output  character
  978. X            set
  979. X       9) Transliteration table
  980. X
  981. X     GENERAL COMMENTS
  982. X     The transliteration rules  file  consists  of  comments  and
  983. X     data.  The comments may be included in the file as:
  984. X        a) line comments --- lines starting with ! or # character
  985. X          (#  or  !  must  be  in the first column of a line) are
  986. X          treated as comments and are not read in by the program.
  987. X        b) comments following all required entries on  the  line.
  988. X          They  must  be separated by at least one space from the
  989. X          last data entry on the line and need not start with any
  990. X          particular  character.  These  comments  cannot be used
  991. X          within multiline sequences.
  992. X
  993. X     The data entries consist of  integer  numbers  and  strings.
  994. X     The strings may represent:
  995. X       a) plain strings
  996. X       b) character lists
  997. X       c) regular expressions
  998. X
  999. X     All strings which appear in the file, are processed  through
  1000. X     the  "string  processor",  which allows entering unprintable
  1001. X     characters as codes.  The character code is specified  as  a
  1002. X     backslash  "\"  followed  by  at least 2 digit(s) (i.e., \01
  1003. X     produces code=1, but \1 is passed unchanged). The  following
  1004. X     formats are supported:
  1005. X       \0123    character of octal code 123  (when  leading  zero
  1006. X     present)
  1007. X
  1008. X
  1009. X
  1010. XJKL                 Last change: 23-Jan-1993                    7
  1011. X
  1012. X
  1013. X
  1014. X
  1015. X
  1016. X
  1017. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  1018. X
  1019. X
  1020. X
  1021. X       \123     character of decimal code 123 (when leading digit
  1022. X     is not zero)
  1023. X       \0o123  or \0O123  character of octal code 123
  1024. X       \0d123  or \0D123  character of decimal code 123
  1025. X       \0xA3   or \0XA3 or \0xa3   character of hexadecimal  code
  1026. X     A3
  1027. X
  1028. X     The allowed digits are 0-7 for octal codes, 0-9 for  decimal
  1029. X     codes  and  0-F  (and/or  0-f)  for hexadecimal codes.  In a
  1030. X     situation when code has to be followed by a digit character,
  1031. X     you  need  to  enter  the digit as a code. E.g., if you want
  1032. X     character \0xA3 followed by a letter C, you need to  specify
  1033. X     letter  C  as  a code (\0x43 or \103 or \0o103 or \0d67) and
  1034. X     type the sequence as, e.g.,  \0xA3\103.  Character resulting
  1035. X     in  a  code 0 (zero) (e.g., \00) is special. It tells: "skip
  1036. X     everything what follows me in this  string".   It  does  not
  1037. X     make  sense  to  use  it, since you can always terminate the
  1038. X     sequence with a delimiter. When you use  an empty string  as
  1039. X     a  matching  sequence,  remember that it does not match any-
  1040. X     thing.
  1041. X
  1042. X     If the line with entries is  too  long,  you  can  break  it
  1043. X     between  the  fields.   If  the  string is too long to fit a
  1044. X     line, you can break it before any nonblank character by  the
  1045. X     \  (backslash)  followed  by  white  space (i.e., new lines,
  1046. X     spaces, tabs, etc.). The \ and  the  following  white  space
  1047. X     will  be removed from the string by the string preprocessor.
  1048. X     However, you are not allowed to break the individual charac-
  1049. X     ter  codes  (and  you  probably  would  not  do  it ever for
  1050. X     aestetic purposes).  For example:
  1051. X       "experi\
  1052. X       mental design"
  1053. X     is equivalent to:
  1054. X       "experimental design"
  1055. X     while:
  1056. X       "experimental\
  1057. X       design"
  1058. X     is equivalent to:
  1059. X       "experimentaldesign"
  1060. X     If you need to have \ followed by a space  in  your  string,
  1061. X     you need to enter either a backslash or a space following it
  1062. X     as an explicit character code, for example:
  1063. X       "\\0o40"
  1064. X     will produce a \ followed by the space, while the string:
  1065. X       "\    "
  1066. X     will be empty.
  1067. X
  1068. X     The preprocessor knows only about  comments,  plain  charac-
  1069. X     ters, character codes, and continuation lines. However, some
  1070. X     characters and their combinations may have a special meaning
  1071. X     in lists and regular expressions.
  1072. X
  1073. X
  1074. X
  1075. X
  1076. XJKL                 Last change: 23-Jan-1993                    8
  1077. X
  1078. X
  1079. X
  1080. X
  1081. X
  1082. X
  1083. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  1084. X
  1085. X
  1086. X
  1087. X     DETAILS OF FILE STRUCTURE
  1088. X
  1089. X
  1090. X     Ad.1) File format number. This is simply a digit 1 on a line
  1091. X        by  itself at the moment. This entry is included to allow
  1092. X        future extensions of the transliteration description file
  1093. X        without the need to modify older transliteration descrip-
  1094. X        tions (program will read data according  to  the  current
  1095. X        file format number given in the file).
  1096. X
  1097. X     Ad.2) String delimiters.  The  subsequent  3  lines  specify
  1098. X        pairs  of single character delimiters for 3 types of text
  1099. X        data.  The line format is:
  1100. X          opening_character    closing_character.
  1101. X        These are needed to mark the beginning/end and  the  type
  1102. X        of  the  text  data.   Each  string (text datum) is saved
  1103. X        starting from the first character  after  opening  delim-
  1104. X        iter,  and  ends at the last character before the closing
  1105. X        delimiter. If you  need  to  use  the  closing  delimiter
  1106. X        within  a  string,  you  need  to  specify it as its code
  1107. X        (e.g., if you are using () pair  as  delimiters,  specify
  1108. X        ")"  as  \0x29). The opening delimiter may be the same or
  1109. X        different from the closing delimiter.
  1110. X
  1111. X        a) The first line contains  characters  used  to  enclose
  1112. X          (bracket)  a  plain  string. Plain strings are directly
  1113. X          matched to input data or directly sent  to  output.   I
  1114. X          suggest  to  stick to "  " pair for plain strings.  The
  1115. X          ASCII code for " is \0d34 = \0x22 = \0o42 if  you  need
  1116. X          it inside the string itself.
  1117. X
  1118. X        b) The second line contains characters to mark the begin-
  1119. X          ning  and  the  end  of  the  list.  Lists  are used to
  1120. X          translate single character codes.  I suggest  [  and  ]
  1121. X          delimiters  for the list (ASCII code of "]" is: \0d93 =
  1122. X          \0x5D = \0o135). The  lists  may  include  ranges,  for
  1123. X          example:  [a-zA-Z0-9]  will  include  all Latin letters
  1124. X          (small and capital) and digits.   Note  that  order  is
  1125. X          important:  [a-d]  is equivalent to [abcd], while [d-a]
  1126. X          will result in an error. If you  want  to  include  "-"
  1127. X          (minus)  in the list, you need to place it as the first
  1128. X          or the last character. There are only two special char-
  1129. X          acters  on  the  list, the "-" described above, and the
  1130. X          "]" character. You need to enter the "]" as  its  code.
  1131. X          E.g.,  for ASCII character table [*--] is equivalent to
  1132. X          [*+,-], is equivalent to [\42\43\44\45]. The  order  of
  1133. X          characters in the list does not matter unless the input
  1134. X          list corresponds to  the  output  list  (this  will  be
  1135. X          explained later). Empty lists do not make sense.
  1136. X
  1137. X        c) The third line  of  delimiter  specification  contains
  1138. X          delimiters  for  regular  expressions  and substitution
  1139. X
  1140. X
  1141. X
  1142. XJKL                 Last change: 23-Jan-1993                    9
  1143. X
  1144. X
  1145. X
  1146. X
  1147. X
  1148. X
  1149. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  1150. X
  1151. X
  1152. X
  1153. X          expressions.  These strings  are  used  for  "flexible"
  1154. X          matches  to  the  text in the input file. They are very
  1155. X          similar to the ones used in UN*X for searching text  in
  1156. X          utilities  like:  grep, sed, vi, awk, etc., though only
  1157. X          a subset of full UN*X regular expression syntax is used
  1158. X          here.   I  suggest enclosing them within braces { and }
  1159. X          (ASCII code for } is \0d125 = \0x7D  =  \0o175).  Actu-
  1160. X          ally,  regular  expressions  can only be used for input
  1161. X          sequences, and for output sequences the {} are used  to
  1162. X          enclose  substitution sequences. This will be explained
  1163. X          below.   The   description   of    the    syntax    for
  1164. X          regular/substitution  expressions  is  adapted from the
  1165. X          documentation for the regexp package of Henry  Spencer,
  1166. X          University of Toronto --- this regular expression pack-
  1167. X          age was incorporated, after minute modifications,  into
  1168. X          the program.
  1169. X
  1170. X
  1171. X                         REGULAR EXPRESSION SYNTAX
  1172. X          A  regular  expression  is  zero  or   more   branches,
  1173. X          separated   by  `|'.   It matches anything that matches
  1174. X          one of the branches.  The `|' simply means "or".
  1175. X            A branch is zero or more  pieces,  concatenated.   It
  1176. X          matches  a match  for  the  first,  followed by a match
  1177. X          for the second, etc.
  1178. X            A piece is an atom possibly followed  by  `*',   `+',
  1179. X          or   `?'.   An   atom   followed   by   `*'   matches a
  1180. X          sequence of 0 or more matches of  the  atom.   An  atom
  1181. X          followed   by   `+'   matches   a sequence of 1 or more
  1182. X          matches of the atom.  An atom followed by  `?'  matches
  1183. X          zero or one occurrences of atom.
  1184. X            An  atom  is  a  regular  expression  in  parentheses
  1185. X          (matching   a  match   for  the  regular expression), a
  1186. X          range (see below), `.' (matching  any  single   charac-
  1187. X          ter),  a `\'  followed  by a single character (matching
  1188. X          that character), or a single character  with  no  other
  1189. X          significance  (matching  that character).
  1190. X            A range is a  sequence  of  characters  enclosed   in
  1191. X          `[]'.    It  normally matches any single character from
  1192. X          the sequence.  If the  sequence  begins  with  `^',  it
  1193. X          matches  any single  character not from the rest of the
  1194. X          sequence.   If  two  characters  in  the  sequence  are
  1195. X          separated  by `-', this is shorthand for the full  list
  1196. X          of   ASCII   characters  between  them  (e.g.   `[0-9]'
  1197. X          matches  any  decimal digit).  To include a literal `]'
  1198. X          in the sequence,  make it the first character  (follow-
  1199. X          ing a possible `^').  To include a literal `-', make it
  1200. X          the first  or  last character. The  regular  expression
  1201. X          can  contains subexpressions which are enclosed in a ()
  1202. X          pair. These subexpressions are numbered 1 to 9 and  can
  1203. X          be  nested. The numbering of subexpressions is given in
  1204. X          the  order  of  their  opening  parentheses  "(".   For
  1205. X
  1206. X
  1207. X
  1208. XJKL                 Last change: 23-Jan-1993                   10
  1209. X
  1210. X
  1211. X
  1212. X
  1213. X
  1214. X
  1215. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  1216. X
  1217. X
  1218. X
  1219. X          example:
  1220. X                (111)...(22(333)222(444)222)...(555)
  1221. X          Note that expression 2 contains within  itself  expres-
  1222. X          sions 3 and 4.
  1223. X          These subexpressions can be referenced in the substitu-
  1224. X          tion  string  which is described below in the paragraph
  1225. X          below, or can be used to delimit atoms.
  1226. X            Examples:
  1227. X            {[\0d32\0d09]\0d10} --- will match space or tab  fol-
  1228. X              lowed by new line
  1229. X            {[Tt][Ss]} --- will match TS, Ts, tS and ts
  1230. X            {TS|Ts|tS|ts} --- same as above
  1231. X            {[\0d09-\0d15 ][^hH][^uU][a-zA-Z]*[\0d09-\0d15 ]} ---
  1232. X              all  words  which do not start with hu, Hu, hU, HU.
  1233. X              There is a space between \0d15 and ].
  1234. X              Note that specifying expressions like  {.*}  (i.e.,
  1235. X              match  all  characters)  does  not make much sense,
  1236. X              since it would mean here:  match  the  whole  input
  1237. X              file.  However,  expressions  like {A.*B} should be
  1238. X              acceptable, since they match a pair of A and B, and
  1239. X              everything in between them, e.g. for a string like:
  1240. X              "This is Mr. Allen and this  is  Mr.  Brown."  this
  1241. X              expression should match the string: "Allen and this
  1242. X              is Mr. B".
  1243. X          Remember to put a backslash "\" in front of the follow-
  1244. X          ing  characters:  .[()|?+*\  if  you want their literal
  1245. X          meaning outside the range enclosed in  [].  Inside  the
  1246. X          range they have their literal meaning.  If you know the
  1247. X          syntax of UN*X regular expressions, please note that  ^
  1248. X          and $ anchors are not supported and are treated as nor-
  1249. X          mal characters (with the exception of ^ negation within
  1250. X          []).
  1251. X
  1252. X                         SUBSTITUTION EXPRESSIONS
  1253. X          After finding a match for a regular expression  in  the
  1254. X          input text, a substitution is made.  It can be a simple
  1255. X          substitution  where  the  whole  matching   string   is
  1256. X          replaced  by  another string, or it may reuse a portion
  1257. X          or the whole matching string. The  subexpressions  (the
  1258. X          ones   enclosed  in  parentheses)  within  the  regular
  1259. X          expression which matched the input text can  be  refer-
  1260. X          enced in the substitution expression.  Only the follow-
  1261. X          ing characters have special meaning within substitution
  1262. X          expression:
  1263. X            &  --- will put the whole matching string.
  1264. X            \1 --- will put the match for the  1st  subexpression
  1265. X              in ().
  1266. X            \2 --- will put the string which matched  2nd  subex-
  1267. X              pression, etc.
  1268. X            \9 --- will place in a  replacement  string  the  9th
  1269. X              subexpression  (provided  that there was 9 () pairs
  1270. X              in the regular expression)
  1271. X
  1272. X
  1273. X
  1274. XJKL                 Last change: 23-Jan-1993                   11
  1275. X
  1276. X
  1277. X
  1278. X
  1279. X
  1280. X
  1281. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  1282. X
  1283. X
  1284. X
  1285. X          Only 9 subexpressions are allowed.  All  other  charac-
  1286. X          ters  and  sequences within the substitution expression
  1287. X          will be placed in a substitution string as written.  To
  1288. X          be  able  to  put a single backslash there, you need to
  1289. X          put two of them.  To be able  to  place  the  unchanged
  1290. X          codes  of  the  above  characters  (i.e.,  to make them
  1291. X          literals), you need to precede them  with  a  backslash
  1292. X          "\",  i.e.,  to  get & in the output string you need to
  1293. X          write it as \&. Similarly, to  place  literal  \1,  \2,
  1294. X          etc., you need to enter it as \\1, \\2, etc.  Note that
  1295. X          characters .+[]()^, etc. which had a special meaning in
  1296. X          the  regular expressions, do not have any special mean-
  1297. X          ing in the substitution expression and will  be  output
  1298. X          as written.
  1299. X            Example:
  1300. X            The regular expression:
  1301. X            {([Tt])([Ss])}  and  the  corresponding  substitution
  1302. X              expression  {\1.\2} puts a period between adjoining
  1303. X              letters t and s preserving their letter case.
  1304. X              The expression:
  1305. X            {([A-Za-z]+)-[  \0x09]*([\0x0A-\0x0D]+)[  \0x09]*([A-
  1306. X              Za-z,.?;:"\)'`!]+)[ \0x09]}
  1307. X              and the substitution expression {\1\3\2}  dehyphen-
  1308. X              ate  words (when you understand this one, you are a
  1309. X              guru...). For example: con-   (NL)cert  is  changed
  1310. X              to  concert(NL),  where  NL stands for New Line. It
  1311. X              looks for one or more letters (saves them  as  sub-
  1312. X              string  1)  followed by a hyphen (which may be fol-
  1313. X              lowed by zero or more spaces or tabs).  The  hyphen
  1314. X              must  be  followed  by  a NewLine (ASCII characters
  1315. X              0A-0D hex form  various  new  line  sequences)  and
  1316. X              saves  NewLine sequence as a subexpression 2.  Then
  1317. X              it looks for zero or more tabs and spaces  (at  the
  1318. X              beginning  of the line). Then it looks for the rest
  1319. X              of the hyphenated word and saves it as substring 3.
  1320. X              The  word  may  have punctuation attached.  Then it
  1321. X              looks again for some spaces or tabs. The  substitu-
  1322. X              tion  expression junks all sequences which were not
  1323. X              within (), i.e., hyphen and spaces/tabs and inserts
  1324. X              only  substrings  but  in a different order. The \1
  1325. X              (word beginning) is followed by \3 (word  end)  and
  1326. X              followed  by the NewLine --- \2. The {\2\1\3} would
  1327. X              be probably equally good, though you would need  to
  1328. X              move  the  punctuation matching to the beginning of
  1329. X              the regular expression.
  1330. X     Ad.3) Starting sequence. This sequence will be sent  to  the
  1331. X        output  before  any  text.  It is enclosed in the pair of
  1332. X        string delimiters. I use it  to  output  LaTeX  preamble.
  1333. X        However,  it  can  be empty, if not used.  The (sequence)
  1334. X        may contain any characters, including new lines, etc.
  1335. X          Example:
  1336. X            ""          # empty sequence
  1337. X
  1338. X
  1339. X
  1340. XJKL                 Last change: 23-Jan-1993                   12
  1341. X
  1342. X
  1343. X
  1344. X
  1345. X
  1346. X
  1347. XTRANSLIT(JKL)              Version 1.0              TRANSLIT(JKL)
  1348. X
  1349. X
  1350. X
  1351. X          Example:
  1352. X            "\documentstyle{article}
  1353. X            \input cyracc
  1354. X            \begin{document}
  1355. X            "
  1356. X          is right (note a new line at the end), but
  1357. X            "\documentstyle{article}
  1358. X            \input cyracc       # this comment will be included!
  1359. X            \begin{document}"   # while this will not
  1360. X          is wrong.
  1361. X
  1362. X     Ad.4) Ending sequence. Similar to 1), but will  be  appended
  1363. X        at the end of the output file.
  1364. X          For example:
  1365. X            "\end{document}
  1366. X            "
  1367. X
  1368. X     Ad.5) Number of input character sets. For example,  in  some
  1369. X        incarnation  of KOI7, there are two character sets: Latin
  1370. X        and Cyrillic. Cyrillic character sequence follows  SHIFT-
  1371. X        OUT  character  (CTRL-N),  \0x0e,  and  is  terminated by
  1372. X        SHIFT-IN character (CTRL-O), \0x0f.  Another way of look-
  1373. X        ing  at  it  is  that  Latin characters follow CTRL-O and
  1374. X        cyrillic ones follow CTRL-N.
  1375. X
  1376. X        If there is only one character set on  input  you  should
  1377. X        specify 0 as a number of input char sets, since the input
  1378. X        file  obviously  does  not   contain   any   SHIFT-OUT/IN
  1379. X        sequences.
  1380. X
  1381. X     Ad.6) SHIFT-OUT/SHIFT-IN sequences for each input  character
  1382. X        set.   These  lines  appear only if you specified nonzero
  1383. X        number of character sets. These lines contain also "nest-
  1384. X        ing  sequences",  which  will  be explained later in this
  1385. X        section.  You do not use "nesting sequences"  frequently,
  1386. X        and  let  us  assume  for  a moment that nesting data are
  1387. X        empty strings.  The strings or regular expressions speci-
  1388. X        fied here are matched with the contents of input text. If
  1389. X        match was found, the matching sequence is usually deleted
  1390. X        from the input text and:
  1391. X          a) for SHIFT-OUT sequence: the current input  character
  1392. X            set number is changed to the new one corresponding to
  1393. X            the SHIFT-OUT sequence, or
  1394. X          b) for SHIFT-IN sequence: the previous input  character
  1395. X            set number is restored, (i.e., the one which preceded
  1396. X            the SHIFT-OUT sequence for the  current  set).   Note
  1397. X            that  only  the SHIFT-IN sequence for the current set
  1398. X            is matched.  The SHIFT-IN sequences for other charac-
  1399. X            ter  sets  than the current set are not matched.  The
  1400. X            bracketing of sets is assumed perfect. If the  SHIFT-
  1401. X            IN  sequence  for the current set is an empty string,
  1402. X            the  input  set  number  is  changed  when  SHIFT-OUT
  1403. X
  1404. END_OF_FILE
  1405.   if test 34820 -ne `wc -c <'translit.txt.A'`; then
  1406.     echo shar: \"'translit.txt.A'\" unpacked with wrong size!
  1407.   elif test -f 'translit.txt.B'; then
  1408.     echo shar: Combining  \"'translit.txt'\" \(68330 characters\)
  1409.     cat 'translit.txt.A' 'translit.txt.B' > 'translit.txt'
  1410.     if test 68330 -ne `wc -c <'translit.txt'`; then
  1411.       echo shar: \"'translit.txt'\" combined with wrong size!
  1412.     else
  1413.       rm translit.txt.A translit.txt.B
  1414.     fi
  1415.   fi
  1416.   # end of 'translit.txt.A'
  1417. fi
  1418. echo shar: End of archive 6 \(of 10\).
  1419. cp /dev/null ark6isdone
  1420. MISSING=""
  1421. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  1422.     if test ! -f ark${I}isdone ; then
  1423.     MISSING="${MISSING} ${I}"
  1424.     fi
  1425. done
  1426. if test "${MISSING}" = "" ; then
  1427.     echo You have unpacked all 10 archives.
  1428.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1429. else
  1430.     echo You still must unpack the following archives:
  1431.     echo "        " ${MISSING}
  1432. fi
  1433. exit 0
  1434. exit 0 # Just in case...
  1435.