0028643: Coding rules - eliminate GCC compiler warnings -Wmisleading-indentation
[occt.git] / src / Interface / Interface_StaticStandards.cxx
old mode 100755 (executable)
new mode 100644 (file)
index a94fd2d..0561f9b
@@ -1,36 +1,36 @@
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-//#74 rln 10.03.99 S4135: new parameters, values and default values
-//    gka 10.04.99 S4136: eliminate parameter 'lastpreci'
-//S4181 pdn 23.04.99: adding new parameter handling writing of elementary surfaces
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
 #include <Interface_Static.hxx>
+
 #include <Message_MsgFile.hxx>
 #include <TCollection_ExtendedString.hxx>
-//tatouage de la librairie
 #include <Precision.hxx>
+
 #include <stdio.h>
 
+#include "../XSMessage/XSMessage_XSTEP_us.pxx"
 
-static int deja = 0;
+static int THE_Interface_Static_deja = 0;
 
 void  Interface_Static::Standards ()
 {
-  if (deja) return;  deja = 1;
+  if (THE_Interface_Static_deja)
+  {
+    return;
+  }
+
+  THE_Interface_Static_deja = 1;
 
 //   read precision
   //#74 rln 10.03.99 S4135: new values and default value
@@ -92,33 +92,16 @@ void  Interface_Static::Standards ()
 //    (0 pour dire : pas codee)
 //:S4136  Interface_Static::Init("std"    ,"lastpreci", 'r',"0.");
 
-
-//  ****  MESSAGERIE DE BASE  ****
-
-//  Chargement "manuel" au cas ou les fichiers, env, etc sont KO
-
-  Message_MsgFile::AddMsg ("XSTEP_1","Beginning of IGES file memory loading.");
-  Message_MsgFile::AddMsg ("XSTEP_2","File opening error");
-  Message_MsgFile::AddMsg ("XSTEP_3","Reason : No such file or directory");
-  Message_MsgFile::AddMsg ("XSTEP_4","Reason : Not enough space");
-  Message_MsgFile::AddMsg ("XSTEP_5","Reason : Permission denied");
-  Message_MsgFile::AddMsg ("XSTEP_6","Reason : Too many open files");
-  Message_MsgFile::AddMsg ("XSTEP_7","Reason : Undetermined");
-  Message_MsgFile::AddMsg ("XSTEP_8","End of loading IGES file to memory (Elapsed time : %s).");
-
-  Message_MsgFile::AddMsg ("XSTEP_11","Internal error during the file header reading. The process continues");
-  Message_MsgFile::AddMsg ("XSTEP_13","Internal error during the reading of the entity %d");
-  Message_MsgFile::AddMsg ("XSTEP_14","Internal error during the reading of the entity %d (parameter %d)");
-  Message_MsgFile::AddMsg ("XSTEP_15","Total number of loaded entities : %d.");
-  Message_MsgFile::AddMsg ("XSTEP_16","Beginning of the model loading");
-  Message_MsgFile::AddMsg ("XSTEP_17","End of the model loading");
-  Message_MsgFile::AddMsg ("XSTEP_21","Number of ignored Null Entities : %d");
-  Message_MsgFile::AddMsg ("XSTEP_22","Entity %s : unknown");
-  Message_MsgFile::AddMsg ("XSTEP_23","Entity %s, Type %s : recovered");
-  Message_MsgFile::AddMsg ("XSTEP_24","Report : %d unknown entities");
-  Message_MsgFile::AddMsg ("XSTEP_25","Number of fail in memory loading : %d.");
-  Message_MsgFile::AddMsg ("XSTEP_26","Number of warning in memory loading : %d.");
-
-//  Chargement du vrai fichier langue
-  Message_MsgFile::LoadFromEnv ("CSF_XSMessage","XSTEP");
+  // load messages if needed
+  if (!Message_MsgFile::HasMsg ("XSTEP_1"))
+  {
+    if (!Message_MsgFile::LoadFromEnv ("CSF_XSMessage", "XSTEP"))
+    {
+      Message_MsgFile::LoadFromString (XSMessage_XSTEP_us, sizeof(XSMessage_XSTEP_us) - 1);
+    }
+    if (!Message_MsgFile::HasMsg ("XSTEP_1"))
+    {
+      throw Standard_ProgramError("Critical Error - message resources for Interface_Static are invalid or undefined!");
+    }
+  }
 }