_MEDfileObjectsUnmount236.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2011  EDF R&D, CEA/DEN
00004  *  MED is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 3 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  MED is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <med_outils.h>
00022 #include <string.h>
00023 
00024 #include <2.3.6/med23v30.h>
00025 #include <2.3.6/med23v30_proto.h>
00026 #include "2.3.6/med23v30_misc.h"
00027 
00028 void _MEDfileObjectsUnmount236(int dummy, ...) {
00029 
00030   med_err _ret = -1;
00031   char _link[2*MED_NAME_SIZE+1];
00032   char _mountPath[2*MED_NAME_SIZE+1];
00033 
00034   MED_VARGS_DECL(const, med_idt         , , fid           );
00035   MED_VARGS_DECL(const, med_idt         , , mid           );
00036   MED_VARGS_DECL(const, med_class       , , medclass      );
00037   MED_VARGS_DECL(, med_err *             ,, fret          );
00038 
00039   va_list params;
00040   va_start(params,dummy);
00041 
00042   MED_VARGS_DEF(const, med_idt         , , fid           );
00043   MED_VARGS_DEF(const, med_idt         , , mid           );
00044   MED_VARGS_DEF(const, med_class       , , medclass      );
00045   MED_VARGS_DEF(, med_err *             ,, fret          );
00046 
00047 
00048   _MEDmodeErreurVerrouiller();
00049 
00050   switch(medclass) {
00051 
00052   case MED_MESH :
00053     strcpy(_link,MED_MAA);
00054     break;
00055 
00056   case MED_MESH_SUPPORT :
00057     strcpy(_link,MED_SUP_MAA);
00058     break;
00059 
00060   case MED_ELSTRUCT :
00061     strcpy(_link,MED_STRCT);
00062     break;
00063 
00064   case MED_FAMILY :
00065     strcpy(_link,MED_FAS);
00066     break;
00067 
00068   case MED_EQUIVALENCE :
00069     strcpy(_link,MED_EQS);
00070     break;
00071 
00072   case MED_JOINT :
00073     strcpy(_link,MED_JNT);
00074     break;
00075 
00076   case MED_FIELD :         /* Ajouter aussi MED_CHA_INTERP*/
00077     strcpy(_link,MED_CHA);
00078     break;
00079 
00080   case MED_LOCALIZATION :
00081     strcpy(_link,MED_GAUSS);
00082     break;
00083 
00084   case MED_PROFILE :
00085     strcpy(_link,MED_PROFILS);
00086     break;
00087 
00088   case MED_INTERPOLATION :
00089     strcpy(_link,MED_JNT);
00090     break;
00091 
00092   case MED_NUMERICAL_DATA :
00093     strcpy(_link,MED_NUM_DATA);
00094     break;
00095 
00096   default :
00097     goto ERROR;
00098   }
00099 
00100   /* link destruction in the local file */
00101   _link[strlen(_link)-1] = '\0'; 
00102   if (_MEDdatagroupLienSupprimer(fid,_link) < 0) {
00103     MED_ERR_(_ret,MED_ERR_ULINK,MED_ERR_FILE,_link);
00104     goto ERROR;
00105   }
00106 
00107   /*
00108    * The file is unmounted
00109    */
00110   strncpy(_mountPath,MED_MNT,strlen(MED_MNT)-1);
00111   _mountPath[strlen(MED_MNT)-1] = '\0';
00112   if (_MEDfichierDemonter(fid,_mountPath) < 0) {
00113     MED_ERR_(_ret,MED_ERR_UMOUNT,MED_ERR_FILE,_mountPath);
00114     goto ERROR;
00115   }
00116 
00117 
00118   _ret = 0;
00119  ERROR:
00120 
00121   /*
00122    * The unmounted file is closed
00123    */
00124   if (mid > 0)
00125     if (_MEDfichierFermer(mid) < 0) {
00126       MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,"");
00127       _ret = -1;
00128   }
00129 
00130   va_end(params);
00131   *fret = _ret;
00132   return;
00133 }

Généré le Mon Nov 7 16:21:23 2011 pour MED fichier par  doxygen 1.6.1