Salome HOME
Copyright update 2020
[modules/smesh.git] / src / MEDWrapper / MED_Wrapper.cxx
index dbabc2a2d5a7c2c8d4114bd5bb06097dc2d7b2bf..7a7e968a89b6ef5d5ef3bbb31b68de52f52dc508 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -26,6 +26,7 @@
 
 #include <med.h>
 #include <med_err.h>
+#include <med_proto.h>
 
 #include <boost/version.hpp>
 
@@ -77,11 +78,16 @@ namespace MED
     TFile(const TFile&);
 
   public:
-    TFile(const std::string& theFileName):
+    TFile(const std::string& theFileName, TInt theMajor=-1, TInt theMinor=-1):
       myCount(0),
       myFid(0),
-      myFileName(theFileName)
-    {}
+      myFileName(theFileName),
+      myMajor(theMajor),
+      myMinor(theMinor)
+    {
+      if ((myMajor < 0) || (myMajor > MED_MAJOR_NUM)) myMajor = MED_MAJOR_NUM;
+      if ((myMinor < 0) || (myMajor == MED_MAJOR_NUM && myMinor > MED_MINOR_NUM)) myMinor = MED_MINOR_NUM;
+    }
 
     ~TFile()
     {
@@ -94,12 +100,12 @@ namespace MED
     {
       if (myCount++ == 0) {
         const char* aFileName = myFileName.c_str();
-        myFid = MEDfileOpen(aFileName, med_access_mode(theMode));
+        myFid = MEDfileVersionOpen(aFileName,med_access_mode(theMode), myMajor, myMinor, MED_RELEASE_NUM);
       }
       if (theErr)
         *theErr = TErr(myFid);
       else if (myFid < 0)
-        EXCEPTION(std::runtime_error, "TFile - MEDfileOpen('"<<myFileName<<"',"<<theMode<<")");
+        EXCEPTION(std::runtime_error,"TFile - MEDfileVersionOpen('"<<myFileName<<"',"<<theMode<<"',"<< MED_MAJOR_NUM<<"',"<< myMinor<<"',"<< MED_RELEASE_NUM<<")");
     }
 
     const TIdt&
@@ -121,19 +127,25 @@ namespace MED
     TInt myCount;
     TIdt myFid;
     std::string myFileName;
+    TInt myMajor;
+    TInt myMinor;
   };
 
   //---------------------------------------------------------------
   class TFileWrapper
   {
     PFile myFile;
+    TInt myMinor;
 
   public:
     TFileWrapper(const PFile& theFile,
                  EModeAcces theMode,
-                 TErr* theErr = NULL):
-      myFile(theFile)
+                 TErr* theErr = NULL,
+                 TInt theMinor=-1):
+      myFile(theFile),
+      myMinor(theMinor)
     {
+      if (myMinor < 0) myMinor = MED_MINOR_NUM;
       myFile->Open(theMode, theErr);
     }
 
@@ -178,22 +190,21 @@ namespace MED
 
   //---------------------------------------------------------------
   TWrapper
-  ::TWrapper(const std::string& theFileName):
-    myFile(new TFile(theFileName))
+  ::TWrapper(const std::string& theFileName, bool write, TInt theMajor, TInt theMinor):
+    myFile(new TFile(theFileName, theMajor, theMinor)),
+    myMajor(theMajor),
+    myMinor(theMinor)
   {
     TErr aRet;
-    myFile->Open(eLECTURE_ECRITURE, &aRet);
-    // if (aRet < 0)
-    //   myFile->Close();
-    //   myFile->Open(eLECTURE_AJOUT, &aRet);
-    // }
-    if (aRet < 0) {
-      myFile->Close();
-      myFile->Open(eLECTURE, &aRet);
+    if ( write ) {
+      myFile->Open(eLECTURE_ECRITURE, &aRet);
+      if (aRet < 0) {
+        myFile->Close();
+        myFile->Open(eCREATION, &aRet);
+      }
     }
-    if (aRet < 0) {
-      myFile->Close();
-      myFile->Open(eCREATION, &aRet);
+    else {
+      myFile->Open(eLECTURE, &aRet);
     }
   }
 
@@ -208,7 +219,7 @@ namespace MED
   TWrapper
   ::GetNbMeshes(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -223,7 +234,7 @@ namespace MED
                 MED::TMeshInfo& theInfo,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -284,7 +295,7 @@ namespace MED
                 EModeAcces theMode,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -368,7 +379,7 @@ namespace MED
   ::GetNbFamilies(const MED::TMeshInfo& theInfo,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -385,7 +396,7 @@ namespace MED
                  const MED::TMeshInfo& theInfo,
                  TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -404,7 +415,7 @@ namespace MED
                   const MED::TMeshInfo& theInfo,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -423,7 +434,7 @@ namespace MED
                   MED::TFamilyInfo& theInfo,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -481,7 +492,7 @@ namespace MED
                   EModeAcces theMode,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -603,7 +614,7 @@ namespace MED
              EGeometrieElement theGeom,
              TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -652,7 +663,7 @@ namespace MED
              EGeometrieElement theGeom,
              TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -694,7 +705,7 @@ namespace MED
                   EGeometrieElement theGeom,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -743,7 +754,7 @@ namespace MED
                   EGeometrieElement theGeom,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -785,7 +796,7 @@ namespace MED
                 EGeometrieElement theGeom,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -843,7 +854,7 @@ namespace MED
                 EGeometrieElement theGeom,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -890,7 +901,7 @@ namespace MED
                ETable theTable,
                TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -918,7 +929,7 @@ namespace MED
   ::GetNodeInfo(MED::TNodeInfo& theInfo,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1009,7 +1020,7 @@ namespace MED
                 EModeAcces theMode,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1320,7 +1331,7 @@ namespace MED
                         EConnectivite theConnMode,
                         TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return 0;
@@ -1353,7 +1364,7 @@ namespace MED
   ::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1412,7 +1423,7 @@ namespace MED
                     EModeAcces theMode,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1564,7 +1575,7 @@ namespace MED
                         EConnectivite theConnMode,
                         TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       EXCEPTION(std::runtime_error, "GetPolyedreConnSize - (...)");
@@ -1610,7 +1621,7 @@ namespace MED
   ::GetPolyedreInfo(TPolyedreInfo& theInfo,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1673,7 +1684,7 @@ namespace MED
                     EModeAcces theMode,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -1869,7 +1880,7 @@ namespace MED
   {
     TEntityInfo anInfo;
 
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return anInfo;
@@ -1981,7 +1992,7 @@ namespace MED
                EConnectivite theConnMode,
                TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2030,7 +2041,7 @@ namespace MED
   ::GetCellInfo(MED::TCellInfo& theInfo,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2051,6 +2062,24 @@ namespace MED
     TValueHolder<EConnectivite, med_connectivity_mode> aConnMode    (theInfo.myConnMode);
 
     TErr aRet;
+    med_bool dummy;
+    aRet = MEDmeshnEntity(myFile->Id(),
+                          &aMeshName,
+                          MED_NO_DT,
+                          MED_NO_IT,
+                          anEntity,
+                          aGeom,
+                          MED_NAME,
+                          aConnMode,
+                          &dummy, &dummy);
+    if ( aRet > 0 )
+    {
+      // names are present in the file, they will be read in spite of theInfo.myIsElemNames
+      theInfo.myIsElemNames = eVRAI;
+      theInfo.myElemNames.reset( new TString( theInfo.myNbElem * GetPNOMLength() + 1 ));
+      anElemNames.myRepresentation = & ((TString&) theInfo.myElemNames )[0];
+    }
+
     aRet = MEDmeshElementRd(myFile->Id(),
                             &aMeshName,
                             MED_NO_DT,
@@ -2073,11 +2102,11 @@ namespace MED
       EXCEPTION(std::runtime_error, "GetCellInfo - MEDmeshElementRd(...)");
 
     if (anIsFamNum == MED_FALSE)
-      {
-        int mySize = (int) theInfo.myFamNum->size();
-        theInfo.myFamNum->clear();
-        theInfo.myFamNum->resize(mySize, 0);
-      }
+    {
+      int mySize = (int) theInfo.myFamNum->size();
+      theInfo.myFamNum->clear();
+      theInfo.myFamNum->resize(mySize, 0);
+    }
 
   }
 
@@ -2097,7 +2126,7 @@ namespace MED
                 EModeAcces theMode,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2161,7 +2190,7 @@ namespace MED
     if (theErr)
       *theErr = aRet;
     else if (aRet < 0)
-      EXCEPTION(std::runtime_error, "SetCellInfo - MEDmeshElementWr(...)");
+      EXCEPTION(std::runtime_error, "SetCellInfo - MEDmeshElementWr(...), ret="<< aRet);
   }
 
   //----------------------------------------------------------------------------
@@ -2275,7 +2304,8 @@ namespace MED
   TWrapper
   ::GetBallGeom(const TMeshInfo& theMeshInfo)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE);
+    TErr anError;
+    TFileWrapper aFileWrapper(myFile, eLECTURE, &anError, myMinor);
 
     // read med_geometry_type of "MED_BALL" element
     char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
@@ -2287,7 +2317,8 @@ namespace MED
   TWrapper
   ::GetNbBalls(const TMeshInfo& theMeshInfo)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE);
+    TErr anError;
+    TFileWrapper aFileWrapper(myFile, eLECTURE, &anError, myMinor);
 
     EGeometrieElement ballType = GetBallGeom(theMeshInfo);
     if (ballType < 0)
@@ -2302,7 +2333,7 @@ namespace MED
   ::GetBallInfo(TBallInfo& theInfo,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     // check geometry of MED_BALL
     if (theInfo.myGeom == eBALL)
@@ -2352,7 +2383,7 @@ namespace MED
                 EModeAcces theMode,
                 TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     TErr ret;
     char ballsupportname[MED_NAME_SIZE+1] = "BALL_SUPPORT_MESH";
@@ -2480,7 +2511,7 @@ namespace MED
   TWrapper
   ::GetNbFields(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2494,7 +2525,7 @@ namespace MED
   ::GetNbComp(TInt theFieldId,
               TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2509,7 +2540,7 @@ namespace MED
                  MED::TFieldInfo& theInfo,
                  TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2574,7 +2605,7 @@ namespace MED
                  EModeAcces theMode,
                  TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2661,7 +2692,7 @@ namespace MED
   TWrapper
   ::GetNbGauss(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -2675,7 +2706,7 @@ namespace MED
   ::GetGaussPreInfo(TInt theId,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return TGaussInfo::TInfo(TGaussInfo::TKey(ePOINT1, ""), 0);
@@ -2715,7 +2746,7 @@ namespace MED
                  TGaussInfo& theInfo,
                  TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -2761,7 +2792,7 @@ namespace MED
                     TErr* theErr)
   {
     theEntity = EEntiteMaillage(-1);
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr) {
       if (theEntityInfo.empty())
@@ -2884,7 +2915,7 @@ namespace MED
                      MED::TTimeStampInfo& theInfo,
                      TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
 
@@ -3037,7 +3068,7 @@ namespace MED
   TWrapper
   ::GetNbProfiles(TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return -1;
@@ -3051,7 +3082,7 @@ namespace MED
   ::GetProfilePreInfo(TInt theId,
                       TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return TProfileInfo::TInfo();
@@ -3079,7 +3110,7 @@ namespace MED
                    TProfileInfo& theInfo,
                    TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3124,7 +3155,7 @@ namespace MED
                    EModeAcces theMode,
                    TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3177,7 +3208,7 @@ namespace MED
                       const TKey2Gauss& theKey2Gauss,
                       TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3361,7 +3392,7 @@ namespace MED
                       EModeAcces theMode,
                       TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3698,7 +3729,7 @@ namespace MED
   ::GetGrilleInfo(TGrilleInfo& theInfo,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -3868,7 +3899,7 @@ namespace MED
   {
     if (theInfo.myMeshInfo->myType != eSTRUCTURE)
       return;
-    TFileWrapper aFileWrapper(myFile, theMode, theErr);
+    TFileWrapper aFileWrapper(myFile, theMode, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;
@@ -4003,7 +4034,7 @@ namespace MED
                   EGrilleType& theGridType,
                   TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       EXCEPTION(std::runtime_error, " GetGrilleType - aFileWrapper (...)");
@@ -4029,7 +4060,7 @@ namespace MED
                     TIntVector& theStruct,
                     TErr* theErr)
   {
-    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+    TFileWrapper aFileWrapper(myFile, eLECTURE, theErr, myMinor);
 
     if (theErr && *theErr < 0)
       return;