Salome HOME
ajout properties.py
[tools/eficas.git] / Exemples / ex15 / main.py
1 """
2    Exemple d'utilisation d'un JDC
3
4    Dans un premier temps on importe un catalogue
5    de définition contenu dans un module et on le valide ::
6
7       import cata
8       from cata import JdC
9       cr=JdC.report()
10       if cr.estvide(): ...
11
12    Dans un deuxième temps, on construit un jeu de commandes
13    a partir d'une chaine de caractères et on vérifie sa
14    conformité.
15 """
16
17 import sys
18 sys.path[:0]=['../..']
19
20 import cata
21 import cata1
22 from cata import JdC
23
24 cr=JdC.report()
25 print cr
26
27 text="""
28 DEBUT()
29 a=OP1(a=1)
30 b=OP2(a=1,
31            b=a)
32 c=OP1(a=1,
33          b=10)
34 d=MA_MACRO(A=1)
35 """
36
37 j=JdC(procedure=text,cata=(cata,cata1),nom="bidon")
38
39 j.compile()
40 if not j.cr.estvide():
41    print j.cr
42    sys.exit()
43
44 j.exec_compile()
45 if not j.cr.estvide():
46    print j.cr
47    sys.exit()
48
49 cr=j.report()
50 if not j.cr.estvide():
51    print j.cr
52    sys.exit()
53