Salome HOME
PN bug notation scientifique
[tools/eficas.git] / Exemples / ex14 / 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 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,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