#!/usr/bin/perl
#-*-Perl-*-

# Csx2tex converts TeX files using the CSX encoding
# developed for use with Indian languages into accented
# Roman script. If no input file is specified, csx2tex
# reads from standard input.

while (<>) {
    s/\200/\\c{C}/g;
    s/\201/\\"u/g;
    s/\202/\\'e/g;
    s/\203/\\^a/g;
    s/\204/\\"a/g;
    s/\205/\\`a/g;
    s/\206/{\\aa}/g;
    s/\207/\\c{c}/g;
    s/\210/\\^e/g;
    s/\211/\\"e/g;
    s/\212/\\`e/g;
    s/\213/\\"i/g;
    s/\214/\\^i/g;
    s/\215/\\`i/g;
    s/\216/\\"A/g;
    s/\217/{\\AA}/g;
    s/\220/\\'E/g;
    s/\221/{\\ae}/g;
    s/\222/{\\AE}/g;
    s/\223/\\^o/g;
    s/\224/\\"o/g;
    s/\225/\\`o/g;
    s/\226/\\^u/g;
    s/\227/\\`u/g;
    s/\230/\\"y/g;
    s/\231/\\"O/g;
    s/\232/\\"U/g;
    s/\237/\\b{r}/g;
    s/\240/\\'a/g;
    s/\241/\\'i/g;
    s/\242/\\'o/g;
    s/\243/\\'u/g;
    s/\244/\\~n/g;
    s/\245/\\~N/g;
    s/\246/{\\accent"7E l}/g;
    s/\247/\\:m/g;
    s/\250/\\mb{a}/g;
    s/\251/\\mb{i}/g;
    s/\252/\\mb{u}/g;
    s/\253/\\!a/g;
    s/\254/\\!i/g;
    s/\255/\\b{n}/g;
    s/\265/\\ma{a}/g;
    s/\266/\\mg{a}/g;
    s/\267/\\ma{i}/g;
    s/\270/\\mg{i}/g;
    s/\275/\\ma{u}/g;
    s/\276/\\mg{u}/g;
    s/\306/\\'r/g;
    s/\307/\\`r/g;
    s/\317/\\ma{r}/g;
    s/\320/\\~a/g;
    s/\321/\\~i/g;
    s/\322/\\~u/g;
    s/\323/\\~e/g;
    s/\324/\\~o/g;
    s/\325/\\u{e}/g;
    s/\326/\\u{o}/g;
    s/\327/\\b{l}/g;
    s/\330/\\!u/g;
    s/\340/\\=a/g;
    s/\341/{\\ss}/g;
    s/\342/\\=A/g;
    s/\343/\\=i/g;
    s/\344/\\=I/g;
    s/\345/\\=u/g;
    s/\346/\\=U/g;
    s/\347/\\.r/g;
    s/\350/\\.R/g;
    s/\351/\\=r/g;
    s/\352/\\=R/g;
    s/\353/\\.l/g;
    s/\354/\\.L/g;
    s/\355/\\=l/g;
    s/\356/\\=L/g;
    s/\357/\\:n/g;
    s/\360/\\:N/g;
    s/\361/\\.t/g;
    s/\362/\\.T/g;
    s/\363/\\.d/g;
    s/\364/\\.D/g;
    s/\365/\\.n/g;
    s/\366/\\.N/g;
    s/\367/\\'s/g;
    s/\370/\\'S/g;
    s/\371/\\.s/g;
    s/\372/\\.S/g;
    s/\374/\\.m/g;
    s/\375/\\.M/g;
    s/\376/\\.h/g;
    s/\377/\\.H/g;
    print;
}
