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