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

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