From: gst@gnosys.svle.ma.us (Gary S. Trujillo)
Subject: Re: TOOLS Roman (including Esperanto) and Cyrillic over the net
Date: Mon, 27 Jul 1992 23:52:33 GMT

In <1992Jul26.233235.26821@gnosys.svle.ma.us> gst@gnosys.svle.ma.us I wrote:

> Here's a recent article from that list which mentions a software goodie that
> might be useful in dealing with Cyrillic <--> Roman alphabet conversions...

> | Date: Fri, 24 Jul 1992 10:47:30 EDT
> | From: Mark Markish x2799 <gnosys!FEDS46.PRIME.COM!mmarkish>
> | Subject: strange Latino-Russian
> | To: Multiple recipients of list RUSSIA <RUSSIA@INDYCMS.BITNET>
> |
> | A UNIX tool for conversion of Cyrillic into "Latino-Russian" (or, to that
> | matter, for any non-one-to-one ASCII re-coding) is available from the
> | sender upon request.

With Mark's permission, I'm posting his software.  He suggests that we could
probably improve it.  Also we'll have to change the tables, based on indivi-
dual key to Cyrillic key mappings.

Enjoy.

--------------------------------------------------------------------------------

From: feds46.Prime.COM!mmarkish (Mark Markish x2799)
Message-Id: <9207271540.AA10061@feds46.Prime.COM>
To: gst@gnosys.svle.ma.us
Subject: UNIX conversion tool

> I'd be very interested in having this software

Here it goes: the awk-script to produce KOI-to-Latin and Latin-to-KOI 
convertors. You need to come up with an input code file for each of them.
E.g., here is a code file I use for my own Cyrillic-to-Latin conversion:

O   ~  W  Z  I  +  A  F M D U L T P V Q R K C Y J G H X B E ? { _ S N } " : |  
o   `  w  z  i  =  a  f m d u l t p v q r k c y j g h x b e / [ - s n ] ' ; \
@ $ # ^ % & * < >
SCH ZH CS CH SH IU IA A B V G D E Z I I K L M N O P R S T U F X ` Y ' E I E F
sch zh cs ch sh iu ia a b v g d e z i i k l m n o p r s t u f x ` y ' e i e f
+ = - : ; " ' ? /

The convertors are created as sed-scripts. 

If this sounds unfamiliar to you, please get back to me, or just ask
anyone experienced in UNIX. Best wishes, - M.

--------------------------------------------------------------------
# This awk-script serves for translation between any two coding systems.
# Takes 6 lines on input, containing letters or combos, separated by spaces,
# first three containing the OLD codes, and the last three - matching NEW ones. # Produces on output the sed-script, which does the translation.
# Number of input lines can be changed by changing parameter nl.
# Note that complex combination should precede simple ones and single letters.

BEGIN { k = 1; l = 1; discr = ")0("; nl = 6 } 
{  
    for ( i = 1;  i <= NF;  i++ ) {
      if ( $i == "/" )
        sep = "_" 
      else
        sep = "/"
      if ( $i == "\\" )
        code = "\\\\" 
      else if ( $i == "*" || $i == "$"  || $i == "&"  ||  $i == "^" )
        code = "\\"$i;
      else if ( $i == "[" || $i == "]"  || $i == "{"  ||  $i == "}" )
        code = "\\"$i;
      else
        code = $i
      if ( NR <= nl/2 )
        printf( "s%s%s%s%s%d%s%sg\n", sep, code, sep, discr, k++, discr, sep) 
      else
        printf( "s%s%s%d%s%s%s%sg\n", sep, discr, l++, discr, sep, code, sep)
    }
}
--
    Gary S. Trujillo                            gst@gnosys.svle.ma.us
Somerville, Massachusetts              {wjh12,bu.edu,spdcc,ima,cdp}!gnosys!gst
Xref: sparky alt.uu.future:135 alt.education.distance:260