summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorVladimir Volovich <vvv@vsu.ru>2008-06-05 02:14:06 +0000
committerVladimir Volovich <vvv@vsu.ru>2008-06-05 02:14:06 +0000
commit4e6868bd16be33f9da208832266441c678896ef6 (patch)
treefd999df6478b84635cfca336a6aef8f26e393f3b /Master/texmf-dist/scripts
parent13737083187fd3061846640ad83b7b60a77e2bf4 (diff)
per discussion with Karl: install remaining LIVESCRIPTS as LINKED_SCRIPTS:
simpdftex: master copy in Master/texmf/scripts/simpdftex/simpdftex slave copy in Build/source/texk/texlive/linked_scripts/simpdftex symlink in bin/ARCH/simpdftex => ../../texmf/scripts/simpdftex/simpdftex ebong: master copy in Master/texmf-dist/scripts/bengali/ebong.py slave copy in Build/source/texk/texlive/linked_scripts/ebong.py symlink in bin/ARCH/ebong => ../../texmf-dist/scripts/bengali/ebong.py giftopng temporarily drop, pending Karl's decision whether and where to keep it it is used in Master/texmf-dist/tex/xmltex/passivetex/fotex.sty git-svn-id: svn://tug.org/texlive/trunk@8575 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/bengali/ebong.py346
1 files changed, 346 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/bengali/ebong.py b/Master/texmf-dist/scripts/bengali/ebong.py
new file mode 100755
index 00000000000..c4162cf0ef6
--- /dev/null
+++ b/Master/texmf-dist/scripts/bengali/ebong.py
@@ -0,0 +1,346 @@
+#!/usr/bin/env python
+# look in newbong
+import sre
+A='A'
+B='B'
+S='S'
+s='s'
+F='F'
+X='X'
+
+NCLINE = 0
+global NCWORD,CWORD
+
+AKSAR={
+ 'k' :[B,'k'],
+ 'kh' :[B,'kh'],
+ 'g' :[B,'g'],
+ 'gh' :[B,'gh'],
+ 'ng' :[B,'NG'],
+
+ 'ch' :[B,'c'],
+ '^ch' :[B,'ch'],
+ 'j' :[B,'j'],
+ 'j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RII' :[s,'rR',1],
+ 'e' :[s,'e',-1],
+ 'oi' :[s,'oi',-2],
+ 'oo' :[s,'oo',11],
+ 'o' :[X,'o',1],
+ 'ou' :[s,'ou',12],
+
+ '.' :[F,'.'],
+ '..' :[F,'..'],
+ '...' :[F,'...'],
+ '|' :[F,'|'],
+
+ '~' :[F,'~'],
+ '`' :[F,'`'],
+ '!' :[F,'!'],
+ '1' :[F,'1'],
+ '2' :[F,'2'],
+ 'at' :[F,'@'],
+ '#' :[F,'#'],
+ '3' :[F,'3'],
+ '$' :[F,'$'],
+ '4' :[F,'4'],
+ '%' :[F,'%'],
+ '5' :[F,'5'],
+ '6' :[F,'6'],
+ '&' :[F,'&'],
+ '7' :[F,'7'],
+ '*' :[F,'*'],
+ '8' :[F,'8'],
+ '(' :[F,'('],
+ '9' :[F,'9'],
+ ')' :[F,')'],
+ '0' :[F,'0'],
+ 'dash' :[F,'-'],
+ '+' :[F,'+'],
+ '=' :[F,'='],
+ '|' :[F,'|'],
+ '{' :[F,'{'],
+ '[' :[F,'['],
+ '}' :[F,'}'],
+ ']' :[F,']'],
+ ':' :[F,':'],
+ ';' :[F,';'],
+ '"' :[F,'"'],
+ "'" :[F,"'"],
+ '<' :[F,'<'],
+ ',' :[F,','],
+ '>' :[F,'>'],
+ '.' :[F,'.'],
+ '?' :[F,'?'],
+ '/' :[F,'/']}
+
+CATCODES = {'SS' :[S,'','','',1],
+ 'SB' :[B,'','','',1],
+ 'BS' :[S,'','','',1],
+ 'BB' :[B,'','/','',1],
+ 'BF' :[F,'','','',1],
+ 'Bs1' :[S,'','','',1],
+ 'Bs-1':[S,'\*','','*',1],
+ 'Bs-2':[S,'\*','','*{oi}',0],
+ 'Bs11':[S,'\*','','*ea',0],
+ 'Bs12':[S,'\*','','*eou',0],
+ 'Fs1' :[S,'','','',1],
+ 'Fs-1':[S,'\*','','*',1],
+ 'Fs-2':[S,'\*','','*{oi}',0],
+ 'Fs11':[S,'\*','','*ea',0],
+ 'Fs12':[S,'\*','','*eou',0],
+ 'FF' :[F,'','','',1],
+ 'AX' :[F,'','','',1]}
+
+def blocked(line):
+ #print '@ blocked', line , '->',
+ m = sre.findall('@[^@]+@',line)
+ outline = line
+ if not m :
+ #print outline
+ return(outline)
+ else:
+ for i in range(len(m)):
+ s=m[i][:-1].replace(' ','%X%')
+ outline = outline.replace(m[i],s,1)
+ #print outline
+ return(outline)
+
+def unblock(line):
+ #print '@unblock', line, '->',
+ m = sre.findall('@[^\s]+',line)
+ outline = line
+ if not m :
+ #print outline
+ return(outline)
+ else:
+ for i in range(len(m)):
+ s=m[i].replace('@','').replace('%X%',' ')
+ outline = outline.replace(m[i],s)
+ #print outline
+ return(outline)
+
+def printamp(line):
+ #print '@unblock', line, '->',
+ m = sre.findall('#AT',line)
+ outline = line
+ if not m :
+ #print outline
+ return(outline)
+ else:
+ for i in range(len(m)):
+ outline = outline.replace('#AT','@')
+ #print outline
+ return(outline)
+
+def readsyll(syll):
+ syllparts=[]
+ start = 0; end = len(syll)
+ while syll[start : end]:
+ slice = syll[start : end]
+ #print slice
+ if AKSAR.has_key(slice):
+ syllparts.append(AKSAR[slice])
+ start = start + len(slice)
+ end = len(syll)
+ else :
+ end = end -1
+ return(syllparts)
+
+def fuse(list1,list2):
+ global CCATCODE
+ #print list1,list2
+ Type1 = list1[0]
+ Type2 = list2[0]
+
+ if Type2 == s:
+ Type3 = str(list2[2])
+ elif Type2 == X:
+ Type1=A
+ Type3=''
+ else:
+ Type3 =''
+
+ Type = Type1+Type2+Type3
+
+ #print 'Type:', Type
+
+ try:
+ CATCODE = CATCODES[Type]
+ TARGET = CATCODE[0]
+ PREFIX = CATCODE[1]
+ MIDFIX = CATCODE[2]
+ POSTFIX = CATCODE[3]
+ FLAG = CATCODE[4]
+
+ #print 'TGT:', TARGET, PREFIX,MIDFIX,POSTFIX,FLAG
+ #print 'RAWC', AKSAR[list1[1]][1],AKSAR[list2[1]][1]
+
+ c1=list1[1]
+ c2=list2[1]
+
+ if FLAG == 1 :
+ c = PREFIX + c1 + MIDFIX + POSTFIX + c2
+ else :
+ c = PREFIX + c1 + MIDFIX + POSTFIX
+
+ fused = [TARGET,c]
+ #print CATCODE
+ return(fused)
+ except KeyError:
+ print '\n ERROR AT LINE:', NCLINE, 'WORD:',NCWORD, '(',CWORD,')'
+ return(['ERROR','UNKNOWN CATCODE'])
+
+def fuseatoms(syll):
+ slist=readsyll(syll);
+ #print slist
+ lslist=len(slist);
+ l0=slist[0];
+ for i in range(1,lslist):
+ nextitem = slist[i]
+ l0=fuse(l0,nextitem)
+
+ return(l0[1])
+
+def fuseword(wrd):
+ if wrd[0] == '@' :
+ return(wrd)
+ syllables = wrd.split('-')
+ w0=''
+ for eachsyll in syllables:
+ syll=eachsyll
+ thesyll = fuseatoms(syll)
+ w0 = w0 + thesyll
+ #print 'FUSED WORD',w0
+ return(w0)
+
+def fuseline(line):
+ global NCWORD,CWORD
+ NCWORD = 0
+ #line = blocked(line)
+ words = line.split()
+ l0=''
+ for eachword in words:
+ NCWORD=NCWORD+1
+ word = eachword
+ CWORD=word
+ theword=fuseword(word)
+ #print 'XX',theword
+ l0=l0+' '+theword
+ #print 'FUSED LINE', l0
+ return(l0)
+
+# The main program
+import sys
+OK=1
+finnam = sys.argv[1]
+foutnam = finnam.split('.')[0] + '.' + 'tex'
+
+fin = file(finnam,'rt')
+fout = file(foutnam,'wt')
+
+textin = fin.readlines()
+nlines = len(textin)
+
+textout = []
+
+fin.close()
+
+for eachline in textin:
+ NCLINE = NCLINE+1
+ if eachline[0] == '#' :
+ lineout = eachline[1:]
+ elif eachline[0] == '\\' :
+ lineout = eachline
+ elif eachline == '\n':
+ lineout = eachline
+ else :
+ line1 = eachline.strip()
+ line2 = blocked(line1)
+ lineout = fuseline(line2) + '\n'
+ lineout = lineout[1:]
+ #print ':::', lineout
+ if lineout.find('UNKNOWN CATCODE') == -1 :
+ lineout = unblock(lineout)
+ #print ':::', lineout
+ textout.append(printamp(lineout))
+ else :
+ OK = 0
+ fout.close()
+
+if OK == 1:
+ fout.writelines(textout)
+ fout.close()
+ print 'done'
+else:
+ print 'Unknown CATCODE, Fix The errors and try again'