Salome HOME
Modify fmod() by '%' operator to operate with integers.
[modules/smesh.git] / src / SMESH_I / SMESH_2smeshpy.cxx
index f3e8d5746facbb9067fac8ea38b0f8374c827e31..4340ab41b8bd7a4a28dc174102638f7354e59b55 100644 (file)
@@ -1,26 +1,25 @@
-//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  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
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  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
+//
+//  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
 //  File   : SMESH_2D_Algo_i.hxx
 //  Author : Paul RASCLE, EDF
 //  Module : SMESH
@@ -29,7 +28,7 @@
 // File      : SMESH_2smeshpy.cxx
 // Created   : Fri Nov 18 13:20:10 2005
 // Author    : Edward AGAPOV (eap)
-
+//
 #include "SMESH_2smeshpy.hxx"
 
 #include "utilities.h"
@@ -1714,8 +1713,22 @@ const TCollection_AsciiString & _pyCommand::GetObject()
   {
     // beginning
     int begPos = GetBegPos( RESULT_IND ) + myRes.Length();
-    if ( begPos < 1 )
+    if ( begPos < 1 ) {
       begPos = myString.Location( "=", 1, Length() ) + 1;
+      // is '=' in the string argument (for example, name) or not
+      int nb1 = 0; // number of ' character at the left of =
+      int nb2 = 0; // number of " character at the left of =
+      for ( int i = 1; i < begPos-1; i++ ) {
+       if ( IsEqual(myString.Value( i ), "'" ) )
+         nb1 += 1;
+       else if ( IsEqual( myString.Value( i ), '"' ) )
+         nb2 += 1;
+      }
+      // if number of ' or " is not divisible by 2,
+      // then get an object at the start of the command
+      if ( nb1 % 2 != 0 || nb2 % 2 != 0 )
+       begPos = 1;
+    }
     // store
     myObj = GetWord( myString, begPos, true );
     SetBegPos( OBJECT_IND, begPos );