_MEDprofileRd30.c
Aller à la documentation de ce fichier.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <med_outils.h>
00022
00023 #include <string.h>
00024 #include <stdlib.h>
00025
00026 void _MEDprofileRd30(int dummy, ...) {
00027
00028 va_list params;
00029 va_start(params,dummy);
00030
00031 const med_idt fid = va_arg(params,const med_idt );
00032 const char * const profilename = va_arg(params,const char * const );
00033 med_int * const profilearray = va_arg(params, med_int * const );
00034 med_err * fret = va_arg(params, med_err *);
00035
00036 med_idt _pfid=0;
00037 med_err _ret=-1;
00038 char _path[MED_TAILLE_PROFILS+MED_NAME_SIZE+1]=MED_PROFILS;
00039 med_filter _filter = MED_FILTER_INIT;
00040 med_int _nentity=0;
00041
00042
00043
00044
00045 _MEDmodeErreurVerrouiller();
00046
00047
00048
00049
00050 strcat(_path,profilename);
00051
00052 if ((_pfid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00053 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_PROFILS);
00054 SSCRUTE(_path); goto ERROR;
00055 }
00056
00057
00058
00059
00060 if (_MEDattrEntierLire(_pfid,MED_NOM_NBR,&_nentity) < 0) {
00061 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_PROFILE_MSG);
00062 SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(_nentity);
00063 goto ERROR;
00064 }
00065
00066
00067
00068
00069
00070 if ( MEDfilterEntityCr(fid, _nentity, 1, 1, MED_ALL_CONSTITUENT,
00071 MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
00072 MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
00073 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00074 goto ERROR;
00075 }
00076
00077 if ( _MEDdatasetRd(_pfid,MED_NOM_PFL,MED_INTERNAL_INT,&_filter, (unsigned char * const ) profilearray) < 0) {
00078 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_DATASET,MED_NOM_PFL);SSCRUTE(_path);
00079 goto ERROR;
00080 }
00081
00082 if ( MEDfilterClose(&_filter) < 0 ) {
00083 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_PROFILE_MSG); SSCRUTE(_path);
00084 goto ERROR;
00085 }
00086
00087 _ret = 0;
00088 ERROR:
00089
00090 if ( _pfid > 0 ) if ( _MEDdatagroupFermer(_pfid) < 0) {
00091 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_PROFILS);
00092 ISCRUTE_id(_pfid);
00093 }
00094
00095 va_end(params);
00096 *fret = _ret;
00097
00098 return;
00099 }