_MEDfileObjectsUnmount30.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 void _MEDfileObjectsUnmount30(int dummy, ...) {
00025 
00026   va_list params;
00027   va_start(params,dummy);
00028 
00029   const med_idt         fid           = va_arg(params,const med_idt          );
00030   const med_idt         mid           = va_arg(params,const med_idt          );
00031   const med_class       medclass      = va_arg(params,const med_class        );
00032   med_err *             fret          = va_arg(params, med_err *);
00033 
00034   med_err _ret = -1;
00035   char _link[2*MED_NAME_SIZE+1];
00036 /*   char _mountPath[2*MED_NAME_SIZE+1]; */
00037   char    _mountPath[MED_TAILLE_MNT+2*MED_NAME_SIZE+2]=MED_MNT;
00038 
00039   _MEDmodeErreurVerrouiller();
00040 
00041   switch(medclass) {
00042 
00043   case MED_MESH :
00044     strcpy(_link,MED_MAA);
00045     break;
00046 
00047   case MED_MESH_SUPPORT :
00048     strcpy(_link,MED_SUP_MAA);
00049     break;
00050 
00051   case MED_ELSTRUCT :
00052     strcpy(_link,MED_STRCT);
00053     break;
00054 
00055   case MED_FAMILY :
00056     strcpy(_link,MED_FAS);
00057     break;
00058 
00059   case MED_EQUIVALENCE :
00060     strcpy(_link,MED_EQS);
00061     break;
00062 
00063   case MED_JOINT :
00064     strcpy(_link,MED_JNT);
00065     break;
00066 
00067   case MED_FIELD :         /* Ajouter aussi MED_CHA_INTERP*/
00068     strcpy(_link,MED_CHA);
00069     break;
00070 
00071   case MED_LOCALIZATION :
00072     strcpy(_link,MED_GAUSS);
00073     break;
00074 
00075   case MED_PROFILE :
00076     strcpy(_link,MED_PROFILS);
00077     break;
00078 
00079   case MED_INTERPOLATION :
00080     strcpy(_link,MED_JNT);
00081     break;
00082 
00083   case MED_NUMERICAL_DATA :
00084     strcpy(_link,MED_NUM_DATA);
00085     break;
00086 
00087   default :
00088     goto ERROR;
00089   }
00090 
00091   /* link destruction in the local file */
00092   _link[strlen(_link)-1] = '\0';
00093   if (_MEDdatagroupLienSupprimer(fid,_link) < 0) {
00094     MED_ERR_(_ret,MED_ERR_ULINK,MED_ERR_FILE,_link);
00095     goto ERROR;
00096   }
00097 
00098   /*
00099    * The file is unmounted
00100    */
00101   strcpy(&_mountPath[strlen(_mountPath)-1],_link);
00102 
00103 /*   strncpy(_mountPath,MED_MNT,strlen(MED_MNT)-1); */
00104 /*   _mountPath[strlen(MED_MNT)-1] = '\0'; */
00105   if (_MEDfichierDemonter(fid,_mountPath) < 0) {
00106     MED_ERR_(_ret,MED_ERR_UMOUNT,MED_ERR_FILE,_mountPath);
00107     goto ERROR;
00108   }
00109 
00110 
00111   _ret = 0;
00112  ERROR:
00113 
00114   /*
00115    * The unmounted file is closed
00116    */
00117   if (mid > 0)
00118     if (_MEDfichierFermer(mid) < 0) {
00119       MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILE,"");
00120       _ret = -1;
00121   }
00122 
00123   va_end(params);
00124   *fret = _ret;
00125   return;
00126 }

Généré le Mon May 16 17:10:22 2011 pour MED fichier par  doxygen 1.6.1