Salome HOME
CCAR: merge de la version de developpement V1_12a2 dans la branche principale
[tools/eficas.git] / Traducteur / traduitV8V9.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 """
4 """
5 usage="""usage: %prog [options]
6 Typical use is:
7   python traduitV7V8.py --infile=xxxx --outfile=yyyy
8 """
9
10 import log
11 import optparse
12
13 from load   import getJDC
14 from mocles import parseKeywords
15 from removemocle  import *
16 from renamemocle  import *
17 from renamemocle  import *
18 from inseremocle  import *
19 from changeValeur import *
20 from movemocle    import *
21 from dictErreurs  import GenereErreurPourCommande
22
23 import calcG
24
25
26 atraiter=( "DEFI_MAILLAGE",)
27
28 def traduc(infile,outfile,flog=None):
29
30     hdlr=log.initialise(flog)
31     jdc=getJDC(infile,atraiter)
32     root=jdc.root
33
34     #Parse les mocles des commandes
35     parseKeywords(root)
36     
37     ####################### traitement erreurs ########################
38     #GenereErreurPourCommande(jdc,("POST_RCCM","DIST_LIGN_3D","IMPR_OAR","COMB_CHAM_NO","COMB_CHAM_ELEM"))
39     GenereErreurPourCommande(jdc,())
40
41     ####################### traitement CALC_META     #######################
42     renameMotCleInFact(jdc,"DEFI_MAILLAGE","DEFI_SUPER_MAILLE","MACR_ELEM_STAT","MACR_ELEM")
43
44     #########################################################################
45
46
47     f=open(outfile,'w')
48     f.write(jdc.getSource())
49     f.close()
50
51     log.ferme(hdlr)
52
53 def main():
54     parser = optparse.OptionParser(usage=usage)
55
56     parser.add_option('-i','--infile', dest="infile", default='toto.comm',
57         help="Le fichier à traduire")
58     parser.add_option('-o','--outfile', dest="outfile", default='tutu.comm',
59         help="Le fichier traduit")
60
61     options, args = parser.parse_args()
62     traduc(options.infile,options.outfile)
63
64 if __name__ == '__main__':
65     main()
66