Salome HOME
travail sur monPlusieurs
[tools/eficas.git] / Noyau / nommage.py
index 431d3b067a823d0ca3857b665d1a9cbaac6504d2..e8bb5e844fa27ce760912f25dd2cbf106f287f38 100644 (file)
@@ -1,25 +1,23 @@
-#@ MODIF nommage Noyau  DATE 25/10/2011   AUTEUR COURTOIS M.COURTOIS 
 # -*- coding: iso-8859-1 -*-
-# RESPONSABLE COURTOIS M.COURTOIS
-#            CONFIGURATION MANAGEMENT OF EDF VERSION
-# ======================================================================
-# COPYRIGHT (C) 1991 - 2011  EDF R&D                  WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
+
+# 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 PROGRAM 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
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+# 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 GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# 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
 #
-# ======================================================================
 
 
 """
@@ -72,7 +70,6 @@ def _GetNomConceptResultat(ope, level=2):
   co = f.f_code
   filename = co.co_filename
   name = co.co_name
-  #print "NOMOP,FICHIER, LIGNE ",ope,filename,lineno
   #pattern pour identifier le debut de la commande
   pattern_oper=re.compile(regex1 % ope)
 
@@ -81,13 +78,10 @@ def _GetNomConceptResultat(ope, level=2):
     line = linecache.getline(filename, lineno)
     lineno=lineno-1
     if pattern_comment.match(line):continue
-    #print "LIGNE ",line
     list.append(line)
     if pattern_oper.search(line):
       l=pattern_oper.split(line)
       list.reverse()
-      #print "COMMANDE ",string.join(list)
-      #print "SPLIT ",l
       # On suppose que le concept resultat a bien ete
       # isole en tete de la ligne de source
       m=evalnom(string.strip(l[0]),f.f_locals)
@@ -106,13 +100,11 @@ def evalnom(text,d):
       evaluant la partie indice dans le contexte de l'appelant d
   """
   l=re.split('([\[\]]+)',text)
-  #print l
   if l[-1] == '' :l=l[:-1]
   lll=[]
   i=0
   while i<len(l):
     s=l[i]
-    ll=string.split(s,',')
     ll=re.split('[ ,]+',s)
     if ll[0] == '' :ll=ll[1:]
     if len(ll) == 1:
@@ -150,8 +142,10 @@ def f_lineno(f):
    return line
 
 
-class NamingSystem:
+class NamingSystem(N_utils.Singleton):
     """Cette classe définit un système de nommage dynamique des concepts."""
+    _singleton_id = 'nommage.NamingSystem'
+    
     def __init__(self):
         """Initialisation"""
         self.native = _GetNomConceptResultat