summaryrefslogtreecommitdiff
path: root/language/malayalam/bin/mal
blob: 85dc73d3117137f7a87cab8251bfc226978eaedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
#
#
# Shell script for pre-processing Malayalam LaTeX files
#
# Alex A.J. <tex@alex.org.in>
#
#
# 10 Nov 2007: Added support for ILDC-CDAC Fonts
# 07 Jun 2005: Version 0.9.2
# 21 Jan 2005: Added support for ISM
# 26 Feb 2003: Update
# 25 Feb 2003: Initial version
#
#
#

echo -e "\nUtility for pre-processing Malayalam LaTeX source files"
echo -e "Alex A.J. <tex@alex.org.in>\n"

if [ $# -eq 1 ]
then
   script="Rachana (new lipi)"
   trs=mm_rch.trs
   scr=mmr_rch.scr
   vix=vim_rch
elif [ $# -eq 2 ]
then
   case "$2" in
   rachana)
      script="Rachana (old lipi)"
      trs=mm_rch.trs
      scr=mm_rch.scr
      vix=vim_rch
   ;;
   rachana2)
      script="Rachana (new lipi)"
      trs=mm_rch.trs
      scr=mmr_rch.scr
      vix=vim_rch
   ;;
   keli)
      script="keli (new lipi)"
      trs=mmr_keli.trs
      scr=mmr_keli.scr
      vix=vim_keli
   ;;
   ism)
      script="ISM (new lipi)"
      trs=mmr_ism.trs
      scr=mmr_ism.scr
      vix=vim_ism
   ;;
#   thoolika)
#      trs=mmr_thl.trs
#      scr=mmr_thl.scr
#   ;;
   ildc)
      script="CDAC fonts from ILDC (new lipi)"
      trs=mmr_ildc_cdac.trs
      scr=mmr_ildc_cdac.scr
      vix=vim_ildc_cdac
   ;;
   *)
      echo -e "--> $2"
      echo -e "Invalid <fontname>.\n"
      echo -e "Available <fontname> options are:\n"
      echo -e "\trachana  - for old lipi"
      echo -e "\trachana2 - for new lipi (default)"
      echo -e "\tkeli"
      echo -e "\tildc - For ILDC fonts (CDAC)"
      echo -e "\tism - For CDAC ISM fonts\n"
      exit 1
   esac
else
   echo -e "Usage: mal <sourcefile> <fontname>\n"
   echo -e "Available <fontname> options are:\n"
   echo -e "\trachana  - for old lipi"
   echo -e "\trachana2 - for new lipi (default)"
   echo -e "\tkeli"
   echo -e "\tildc - For ILDC fonts (CDAC)"
   echo -e "\tism - For CDAC ISM fonts\n"
   echo -e "If <fontname> is unspecified, Rachana new lipi will be used.\n"
   exit 0
fi

mmdir="/usr/share/malayalam/cfg" # directory for scr and trs files

if [ -e "$1" ]
then
   echo -e "Using $script...\n"
   mlym -t "$mmdir/$trs" -s "$mmdir/$scr" $1 2> mmerr.log
   if [ -s "mmerr.log" ]
   then
	echo -e "Some error occured with the preprocessor"
	echo -e "Error log:\n"
	cat mmerr.log
	echo -e "\n-----------------\nEnd of error log.\n"
	echo -e "Log saved in mmerr.log\n"
	exit 1
   else
	rm -f mmerr.log
	echo -e "#!/bin/sh">00_mm.sh
	echo -e "vi -s $mmdir/$vix $1 >/dev/null 2>/dev/null">>00_mm.sh
	vi -s $mmdir/vim_tmp 00_mm.sh >/dev/null 2>/dev/null
	sh 00_mm.sh
	rm -f 00_mm.sh
	echo -e "File successfully preprocessed.\n"
	echo -e "Please run (pdf)LaTeX on the generated tex file.\n"
	exit 0
   fi
else
   echo -e "--> $1"
   echo -e "File not found. Perhaps a mistype?\n"
   exit 1
fi

#
# End of file