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
00029
00030 med_idt _pfid=0;
00031 med_err _ret=-1;
00032 char _path[MED_TAILLE_PROFILS+MED_NAME_SIZE+1]=MED_PROFILS;
00033 med_filter _filter = MED_FILTER_INIT;
00034 med_int _nentity=0;
00035
00036
00037 MED_VARGS_DECL(const, med_idt , , fid );
00038 MED_VARGS_DECL(const, char * , const , profilename );
00039 MED_VARGS_DECL(, med_int *, const , profilearray );
00040 MED_VARGS_DECL(, med_err * ,, fret );
00041
00042 va_list params;
00043 va_start(params,dummy);
00044
00045 MED_VARGS_DEF(const, med_idt , , fid );
00046 MED_VARGS_DEF(const, char * , const , profilename );
00047 MED_VARGS_DEF(, med_int *, const , profilearray );
00048 MED_VARGS_DEF(, med_err * ,, fret );
00049
00050
00051
00052
00053 _MEDmodeErreurVerrouiller();
00054
00055
00056
00057
00058 strcat(_path,profilename);
00059
00060 if ((_pfid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00061 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_PROFILS);
00062 SSCRUTE(_path); goto ERROR;
00063 }
00064
00065
00066
00067
00068 if (_MEDattrEntierLire(_pfid,MED_NOM_NBR,&_nentity) < 0) {
00069 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_PROFILE_MSG);
00070 SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(_nentity);
00071 goto ERROR;
00072 }
00073
00074
00075
00076
00077
00078 if ( MEDfilterEntityCr(fid, _nentity, 1, 1, MED_ALL_CONSTITUENT,
00079 MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
00080 MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
00081 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00082 goto ERROR;
00083 }
00084
00085 if ( _MEDdatasetRd(_pfid,MED_NOM_PFL,MED_INTERNAL_INT,&_filter, (unsigned char * const ) profilearray) < 0) {
00086 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_DATASET,MED_NOM_PFL);SSCRUTE(_path);
00087 goto ERROR;
00088 }
00089
00090 if ( MEDfilterClose(&_filter) < 0 ) {
00091 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_PROFILE_MSG); SSCRUTE(_path);
00092 goto ERROR;
00093 }
00094
00095 _ret = 0;
00096 ERROR:
00097
00098 if ( _pfid > 0 ) if ( _MEDdatagroupFermer(_pfid) < 0) {
00099 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_PROFILS);
00100 ISCRUTE_id(_pfid);
00101 }
00102
00103 va_end(params);
00104 *fret = _ret;
00105
00106 return;
00107 }