X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=Traducteur%2Fload.py;h=f6815a2e93bb84059be9323d7036062310a2e9a4;hb=9f4ff7ed9afd87c96e11d61e442e39e5511f60d1;hp=b8f0a5aa48ef0b0d471a77eb59af9a1feb29c39b;hpb=f915c06cd9182a855ff99527a373ff976fbcd815;p=tools%2Feficas.git diff --git a/Traducteur/load.py b/Traducteur/load.py index b8f0a5aa..f6815a2e 100644 --- a/Traducteur/load.py +++ b/Traducteur/load.py @@ -1,21 +1,43 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2007-2013 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# import os import re -import parseur -from mocles import parseKeywords +from Traducteur import parseur +from Traducteur.mocles import parseKeywords +import sets +jdcSet=sets.Set() -JDCdict={} -class JDC: +class JDCTrad: """Cet objet conserve toutes les informations relatives à un fichier de commandes .comm""" - def __init__(self,filename,src,atraiter): + def __init__(self,src,atraiter): #---------------------------------------- - self.filename = os.path.abspath(filename) self.atraiter=atraiter self.init(src,atraiter) + commands= self.root.childNodes[:] + commands.reverse() + for c in commands: + jdcSet.add(c.name) def init(self,src,atraiter): #--------------------------- @@ -110,14 +132,16 @@ class JDC: self.lines[numeroLigne]=nouveauTexte def getJDC(filename,atraiter): -#---------------------------_ +#---------------------------- # lit le JDC - jdc=JDCdict.get(filename) - if not jdc: - f=open(filename) - src=f.read() - f.close() - jdc=JDC(filename,src,atraiter) - JDCdict[filename]=jdc + f=open(filename) + src=f.read() + f.close() + jdc=JDCTrad(src,atraiter) return jdc +def getJDCFromTexte(texte,atraiter): +#----------------------------------- +# lit le JDC + jdc=JDCTrad(texte,atraiter) + return jdc