# fichcf.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2012  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 #include <stdlib.h>
    00024
    00025 extern void *MedVersionedApiF;
    00026 extern void f77ApiIsSet(void * obj);
    00027
    00028 #define nedfouvr F77_FUNC(edfouvr,EDFOUVR)
    00029 #define nedfferm F77_FUNC(edfferm,EDFFERM)
    00030 #define nedflfde F77_FUNC(edflfde,EDFLFDE)
    00031 #define nedffien F77_FUNC(edffien,EDFFIEN)
    00032 #define nedffide F77_FUNC(edffide,EDFFIDE)
    00033 #define nedffoco F77_FUNC(edffoco,EDFFOCO)
    00034 #define nedfveco F77_FUNC(edfveco,EDFVECO)
    00035 #define nedfveli F77_FUNC(edfveli,EDFVELI)
    00036 #define nedfvedo F77_FUNC(edfvedo,EDFVEDO)
    00037 #define nedfmont F77_FUNC(edfmont,EDFMONT)
    00038 #define nedfdemo F77_FUNC(edfdemo,EDFDEMO)
    00039
    00040 #ifdef PPRO_NT
    00041 med_int
    00042  EDFOUVR (char *nom, unsigned int bidon, med_int * acces,
    00043                    med_int *lon)
    00044 #else
    00045 med_int
    00046 nedfouvr (char *nom,med_int * acces,med_int *lon)
    00047 #endif
    00048 {
    00049   char *fn;
    00050   int ret;
    00051
    00052   /* Cette méthode a pour unique but de forcer la construction
    00053    de l'objet MedVersionedApiF et donc la mise à jour de MedVersionedApi
    00054   avec les APis fortran. Certains compilateurs suppriment le symbole MedVersionedApiF
    00055   croyant qu'il nest pas utilisé et la mise à jour de MedVersionedApi n'est
    00056   alors pas effectuée.*/
    00057   f77ApiIsSet(MedVersionedApiF);
    00058
    00059   fn = _MED2cstring(nom, (int) * lon);
    00060   if (!fn)
    00061         return(-1);
    00062
    00063   ret = (med_int) MEDouvrir(fn,(med_mode_acces) *acces);
    00064
    00065   _MEDcstringFree(fn);
    00066
    00067   return(ret);
    00068 }
    00069
    00070 #ifdef PPRO_NT
    00071 med_int
    00072  EDFFERM(med_int * fid)
    00073 #else
    00074 med_int
    00075 nedfferm(med_int * fid)
    00076 #endif
    00077 {
    00078   med_int ret;
    00079   ret = (med_int) MEDfermer((med_idt) * fid);
    00080
    00081   return(ret);
    00082 }
    00083
    00084 #ifdef PPRO_NT
    00085 med_int
    00086  EDFLFDE(med_int *fid)
    00087 #else
    00088 med_int
    00089 nedflfde (med_int *fid)
    00090 #endif
    00091 {
    00092   med_int longueur;
    00093
    00094   longueur = MEDlFichDes((med_idt) *fid);
    00095
    00096   return longueur;
    00097 }
    00098
    00099 #ifdef PPRO_NT
    00100 med_int
    00101  EDFFIEN(med_int *fid,med_int *quoi,char *str, unsigned int bidon1)
    00102 #else
    00103 med_int
    00104 nedffien (med_int *fid,med_int *quoi,char *str)
    00105 #endif
    00106 {
    00107   med_int ret;
    00108   med_int longueur;
    00109   char * fs1;
    00110
    00111   /* Solution temporaire */
    00112   longueur = MEDlFichDes((med_idt) *fid);
    00113 /*   ISCRUTE(longueur); */
    00114   fs1 = (char *) malloc(sizeof(char)*longueur+1);
    00115
    00116   ret = (med_int) MEDfichEntete((med_idt) *fid,(med_fich_info) *quoi,(char *) fs1);
    00117
    00118   strncpy(str,fs1,longueur);
    00119   _MEDfstring(str,longueur);
    00120   free(fs1);
    00121
    00122   return ret;
    00123 }
    00124
    00125 #ifdef PPRO_NT
    00126 int
    00127  EDFFIDE(med_int *fid,char *des, unsigned int bidon1,med_int *lon1)
    00128 #else
    00129 med_int
    00130 nedffide(med_int *fid,char *des,med_int *lon1)
    00131 #endif
    00132 {
    00133   med_int ret;
    00134   char *fn1;
    00135
    00136   fn1 = _MED1cstring((char *)des,(int )*lon1,MED_TAILLE_DESC);
    00137
    00138   ret = MEDfichDesEcr((med_idt) *fid,(char*)fn1);
    00139
    00140   _MEDcstringFree(fn1);
    00141
    00142   return ret;
    00143 }
    00144
    00145
    00146 #ifdef PPRO_NT
    00147 med_int
    00148  EDFFOCO (char *nom, unsigned int bidon, med_int *lon)
    00149 #else
    00150 med_int
    00151 nedffoco (char *nom,med_int *lon)
    00152 #endif
    00153 {
    00154   char *fn;
    00155   int ret;
    00156
    00157   fn = _MED2cstring(nom, (int) * lon);
    00158   if (!fn)
    00159         return(-1);
    00160
    00161   ret = (med_int) MEDformatConforme(fn);
    00162
    00163   _MEDcstringFree(fn);
    00164
    00165   return(ret);
    00166 }
    00167
    00168 #ifdef PPRO_NT
    00169 med_int
    00170  EDFVECO (char *nom, unsigned int bidon, med_int *lon)
    00171 #else
    00172 med_int
    00173 nedfveco (char *nom,med_int *lon)
    00174 #endif
    00175 {
    00176   char *fn;
    00177   med_int ret;
    00178
    00179   fn = _MED2cstring(nom, (int) * lon);
    00180   if (!fn)
    00181         return(-1);
    00182
    00183   ret = (med_int) MEDversionConforme(fn);
    00184
    00185   _MEDcstringFree(fn);
    00186
    00187   return(ret);
    00188 }
    00189
    00190 #ifdef PPRO_NT
    00191 med_int
    00192  EDFVELI (med_int *fid, med_int *maj, med_int *min, med_int *rel)
    00193 #else
    00194 med_int
    00195 nedfveli (med_int *fid, med_int *maj, med_int *min, med_int *rel)
    00196 #endif
    00197 {
    00198   med_int ret;
    00199
    00200   ret = (med_int) MEDversionLire((med_idt) *fid, (med_int *) maj, (med_int *) min, (med_int *) rel);
    00201
    00202   return(ret);
    00203 }
    00204
    00205 #ifdef PPRO_NT
    00206 med_int
    00207  EDFVEDO (med_int *maj, med_int *min, med_int *rel)
    00208 #else
    00209 med_int
    00210 nedfvedo (med_int *maj, med_int *min, med_int *rel)
    00211 #endif
    00212 {
    00213   med_int ret;
    00214
    00215   ret = 0;
    00216
    00217   MEDversionDonner((med_int *) maj, (med_int *) min, (med_int *) rel);
    00218
    00219   return(ret);
    00220 }
    00221
    00222 #ifdef PPRO_NT
    00223 med_int
    00224  EDFMONT (med_int *fid, char *acces, unsigned int bidon, med_int *lon, med_int *type)
    00225 #else
    00226 med_int
    00227 nedfmont (med_int *fid, char *acces, med_int *lon, med_int *type)
    00228 #endif
    00229 {
    00230   char *fn;
    00231   int ret;
    00232
    00233   fn = _MED2cstring(acces, (int) * lon);
    00234   if (!fn)
    00235     return(-1);
    00236
    00237   ret = (med_int) MEDmonter((med_idt) *fid,(const char *) fn, (med_type_donnee) *type);
    00238
    00239   _MEDcstringFree(fn);
    00240
    00241   return(ret);
    00242 }
    00243
    00244
    00245 #ifdef PPRO_NT
    00246 med_int
    00247  EDFDEMO (med_int *fid, med_int *mid, med_int *type)
    00248 #else
    00249 med_int
    00250 nedfdemo (med_int *fid, med_int *mid, med_int *type)
    00251 #endif
    00252 {
    00253   int ret;
    00254
    00255   ret = (med_int) MEDdemonter((med_idt) *fid,(med_idt) * mid, (med_type_donnee) *type);
    00256
    00257   return (ret);
    00258 }