Salome HOME
CCAR: mise en coherence de Build_sd de mACRO_ETAPE avec celle de ETAPE
[tools/eficas.git] / Exemples / ex14 / 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 from cata import JdC
22
23 cr=JdC.report()
24 print cr
25
26 text="""
27 DEBUT()
28 a=OP1(a=1)
29 b=OP2(a=1,
30            b=a)
31 c=OP1(a=1,
32          b=10)
33 d=MA_MACRO(A=1)
34 """
35
36 j=JdC(procedure=text,cata=cata,nom="bidon")
37
38 j.compile()
39 if not j.cr.estvide():
40    print j.cr
41    sys.exit()
42
43 j.exec_compile()
44 if not j.cr.estvide():
45    print j.cr
46    sys.exit()
47
48 cr=j.report()
49 if not j.cr.estvide():
50    print j.cr
51    sys.exit()
52