1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2017 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 from Traducteur.load import jdcSet
25 def ecritErreur(listeGena,ligne=None) :
26 from sys import dict_erreurs
28 for Mot in listeGena :
33 if maClef in dict_erreurs :
35 logging.warning("ligne %d : %s ",ligne,dict_erreurs[maClef])
37 logging.warning("%s",dict_erreurs[maClef])
40 for Mot in listeGena[:-1] :
43 maClef=maCle+"_"+"VALEUR"
44 if maClef in dict_erreurs :
46 logging.warning("ligne %d : %s ",ligne,dict_erreurs[maClef])
48 logging.warning("%s",dict_erreurs[maClef])
52 def genereErreurPourCommande(jdc,listeCommande) :
53 commands= jdc.root.childNodes[:]
56 if type(listeCommande)==list:
57 for Mot in listeCommande :
58 if c.name != Mot :continue
59 ecritErreur((Mot,),c.lineno)
61 if c.name != listeCommande :continue
62 ecritErreur((listeCommande,),c.lineno)
64 def genereErreurMotCleInFact(jdc,command,fact,mocle):
65 for c in jdc.root.childNodes:
66 if c.name != command:continue
67 for mc in c.childNodes:
68 if mc.name != fact:continue
71 for n in ll.childNodes:
75 ecritErreur((command,fact,mocle,),c.lineno)
77 def genereErreurMCF(jdc,command,fact):
78 for c in jdc.root.childNodes:
79 if c.name != command:continue
80 for mc in c.childNodes:
84 ecritErreur((command,fact,),c.lineno)
86 def genereErreurValeur(jdc,command,fact,list_valeur):
87 for c in jdc.root.childNodes:
88 if c.name != command:continue
89 for mc in c.childNodes:
90 if mc.name != fact:continue
92 for valeur in list_valeur:
93 trouve=texte.find(valeur)
95 logging.warning("%s doit etre supprimee ou modifiee dans %s : ligne %d",valeur,c.name,mc.lineno)
97 def genereErreurValeurDsMCF(jdc,command,fact,mocle,list_valeur):
98 for c in jdc.root.childNodes:
99 if c.name != command:continue
100 for mc in c.childNodes:
101 if mc.name != fact:continue
104 for n in ll.childNodes:
105 if n.name != mocle:continue
107 for valeur in list_valeur:
108 trouve=texte.find(valeur)
110 logging.warning("%s doit etre supprimee ou modifiee dans %s : ligne %d",valeur,c.name,n.lineno)