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