Salome HOME
CCAR : remplacement separateur New24.gif par Sep.gif
[tools/eficas.git] / Exemples / ex13 / 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=OP1(a=1,b=a)
30 c=OP1(a=1,b=10)
31 """
32
33 j=JdC(procedure=text,cata=cata,nom="bidon")
34
35 j.compile()
36 if not j.cr.estvide():
37    print j.cr
38    sys.exit()
39
40 j.exec_compile()
41 if not j.cr.estvide():
42    print j.cr
43    sys.exit()
44
45 cr=j.report()
46 if not j.cr.estvide():
47    print j.cr
48    sys.exit()