#!/usr/bin/perl # # mac2atx -- Filter, in perl, to convert Mac AIS arabic text to ArabTeX intput. # # Usage: # ----- # mac2atx < document.mac > document.tex # # where "document.mac" is the file name of the Arabic/Latin document, # saved as plain text under AIS (the Macintosh Arabic operating # system). The resulting file "document.tex" cannot be processed by # LaTeX/ArabTex untill it is embedded in a proper document file. See # the LaTeX and ArabTex documentation for help with this. # Created: 1992.08.20; Abdelsalam Heddaya, Boston University. # Modified: 1994.04.08; Improved the comments. # The following statement declares an associative array, with keys # being the Mac codes, and values being the corresponding ArabTeX # strings. Read each character from and print the corresponding one # until EOF is reached. %ArabTeX = ( " ", " ", ",", ",", ".", ".", "0", "0", "1", "1", "2", "2", "3", "3", "4", "4", "5", "5", "6", "6", "7", "7", "8", "8", "9", "9", "@", "@", "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F", "G", "G", "H", "H", "I", "I", "J", "J", "K", "K", "L", "L", "M", "M", "N", "N", "O", "O", "P", "P", "Q", "Q", "R", "R", "S", "S", "T", "T", "U", "U", "V", "V", "W", "W", "X", "X", "Y", "Y", "Z", "Z", "\015", "\012", "\214", "(", "\223", "\$\ldots\$", "\230", ")", "\233", "\$\div\$", "\240", " ", "\241", "!", "\242", "", "\243", "\#", "\244", "\$", "\245", "\%", "\246", "\&", "\250", "(", "\251", ")", "\252", "\$\times\$", "\253", "+", "\254", ",", "\255", "----", "\256", ".", "\257", "/", "\260", "0", "\261", "1", "\262", "2", "\263", "3", "\264", "4", "\265", "5", "\266", "6", "\267", "7", "\270", "8", "\271", "9", "\272", ":", "\273", ";", "\274", "\<", "\275", "=", "\276", "\>", "\300", "*", "\301", "'", "\302", "'A", "\303", "'a", "\304", "w\"'", "\305", "'i", "\306", "e'i", "\307", "A", "\310", "b", "\311", "T", "\312", "t", "\313", "_t", "\314", "^g", "\315", ".h", "\316", "_h", "\317", "d", "\320", "_d", "\321", "r", "\322", "z", "\323", "s", "\324", "^s", "\325", ".s", "\326", ".d", "\327", ".t", "\330", ".z", "\331", "`", "\332", ".g", "\333", "[", "\334", "\$\Box\$", "\335", "]", "\336", "\$\Box\$", "\340", "-", "\341", "f", "\342", "q", "\343", "k", "\344", "l", "\345", "m", "\346", "n", "\347", "h", "\350", "w", "\351", "Y", "\352", "y", "\353", "aN", "\354", "uN", "\355", "iN", "\356", "a", "\357", "u", "\360", "i", "\361", "", "\362", "-", "\363", "p", "\365", "^c", "\367", "f", "\370", "g", "\373", "\{", "\374", "\$\Box\$", "\375", "\}", "a", "a", "b", "b", "c", "c", "d", "d", "e", "e", "f", "f", "g", "g", "h", "h", "i", "i", "j", "j", "k", "k", "l", "l", "m", "m", "n", "n", "o", "o", "p", "p", "q", "q", "r", "r", "s", "s", "t", "t", "u", "u", "v", "v", "w", "w", "x", "x", "y", "y", "z", "z", ); do { $Char=getc(STDIN); print(STDOUT $ArabTeX{$Char}); } until eof(STDIN);