Salome HOME
PN bug notation scientifique
[tools/eficas.git] / Exemples / ex5 / main.py
1 # -*- coding: utf-8 -*-
2 import sys
3 sys.path[:0]=['../..','../../..']
4
5 from Accas import SIMP,FACT
6
7 cata= FACT(sect1=FACT(a=SIMP(typ='I'),b=SIMP(typ='I')),
8            sect2=FACT(c=SIMP(typ='I'),d=SIMP(typ='I')),
9           )
10
11 cr=cata.report()
12 if cr.estvide():
13    print "Verification sans erreur"
14 else:
15    print cr
16
17 # On récupère les plugins de la famille convert
18 import convert
19
20 p=convert.plugins['ini']()
21 p.readfile('toto.ini')
22 s=p.convert('eval')
23 if not p.cr.estvide():
24    print p.cr
25    sys.exit(0)
26
27 o=cata(eval(s),'mcf1',None)
28 print o
29 print o.report()
30
31 o=cata(p.convert('dict'),'mcf2',None)
32 print o
33 print o.report()
34
35 # On récupère les plugins de la famille generator
36 import generator
37
38 g=generator.plugins['ini']()
39 g.gener(o)
40 g.writefile('titi.ini')
41
42 g=generator.plugins['pyth']()
43 g.gener(o)
44 g.writefile('titi.pyth')
45
46 p=convert.plugins['pyth']()
47 p.readfile('toto.pyth')
48 d=p.convert('dict')
49 if not p.cr.estvide():
50    print p.cr
51    sys.exit(0)
52
53 o=cata(d,'mcf3',None)
54 print o
55 print o.report()