ncdf4a13/fortran/fort-v2compat.c File Reference

#include <config.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "netcdf.h"
#include "nfconfig.inc"
#include "ncfortran.h"
#include "fort-lib.h"

Include dependency graph for fort-v2compat.c:

Go to the source code of this file.

Defines

#define NCOPTS   FINT2CINT
#define PNCOPTS   PCINT2FINT
#define CLOBMODE   FINT2CINT
#define PRCODE   PCINT2FINT
#define RWMODE   FINT2CINT
#define DIMLEN   FINT2CINT
#define PDIMLEN   PCINT2FINT
#define LENSTR   FINT2CINT
#define ATTLEN   FINT2CINT
#define PATTLEN   PCINT2FINT
#define FILLMODE   FINT2CINT
#define V2IMAP_cfINT(N, A, B, X, Y, Z)   DOUBLE_cfINT(N,A,B,X,Y,Z)
#define V2IMAPVVVVVVV_cfTYPE   NF_INTEGER
#define V2IMAP_cfSTR(N, T, A, B, C, D, E)   _(CFARGS,N)(T,V2IMAP,A,B,C,D,E)
#define V2IMAP_cfH(S, U, B)
#define V2IMAP_cfQ(B)   ptrdiff_t B[MAX_NC_DIMS];
#define V2IMAP_cfT(M, I, A, B, D)   f2c_v2imap(*fncid, *fvarid-1, A, B)
#define V2IMAP_cfR(A, B, D)

Functions

static ptrdiff_t * f2c_v2imap (int ncid, int varid, const int *fimap, ptrdiff_t *cimap)
static size_t dimprod (const size_t *count, int rank)
static void c_ncpopt (int val)
 FCALLSCSUB1 (c_ncpopt, NCPOPT, ncpopt, NCOPTS)
 FCALLSCSUB1 (c_ncgopt, NCGOPT, ncgopt, PNCOPTS)
 FCALLSCFUN3 (NF_INT, c_nccre, NCCRE, nccre, STRING, CLOBMODE, PRCODE)
 FCALLSCFUN3 (NF_INT, c_ncopn, NCOPN, ncopn, STRING, RWMODE, PRCODE)
 FCALLSCFUN4 (NF_INT, c_ncddef, NCDDEF, ncddef, NCID, STRING, DIMLEN, PRCODE)
 FCALLSCFUN3 (NF_INT, c_ncdid, NCDID, ncdid, NCID, STRING, PRCODE)
 FCALLSCFUN6 (NF_INT, c_ncvdef, NCVDEF, ncvdef, NCID, STRING, TYPE, NDIMS, DIMIDS, PRCODE)
 FCALLSCFUN3 (NF_INT, c_ncvid, NCVID, ncvid, NCID, STRING, PRCODE)
 FCALLSCFUN2 (NF_INT, c_nctlen, NCTLEN, nctlen, TYPE, PRCODE)
 FCALLSCSUB2 (c_ncclos, NCCLOS, ncclos, NCID, PRCODE)
 FCALLSCSUB2 (c_ncredf, NCREDF, ncredf, NCID, PRCODE)
 FCALLSCSUB2 (c_ncendf, NCENDF, ncendf, NCID, PRCODE)
 FCALLSCSUB6 (c_ncinq, NCINQ, ncinq, NCID, PNDIMS, PNVARS, PNATTS, PDIMID, PRCODE)
 FCALLSCSUB2 (c_ncsnc, NCSNC, ncsnc, NCID, PRCODE)
 FCALLSCSUB2 (c_ncabor, NCABOR, ncabor, NCID, PRCODE)
 FCALLSCSUB5 (c_ncdinq, NCDINQ, ncdinq, NCID, DIMID, PSTRING, PDIMLEN, PRCODE)
 FCALLSCSUB4 (c_ncdren, NCDREN, ncdren, NCID, DIMID, STRING, PRCODE)
 FCALLSCSUB8 (c_ncvinq, NCVINQ, ncvinq, NCID, VARID, PSTRING, PTYPE, PNDIMS, PDIMIDS, PNATTS, PRCODE)
 FCALLSCSUB5 (c_ncvpt1, NCVPT1, ncvpt1, NCID, VARID, COORDS, PVOID, PRCODE)
 FCALLSCSUB5 (c_ncvp1c, NCVP1C, ncvp1c, NCID, VARID, COORDS, CBUF, PRCODE)
 FCALLSCSUB6 (c_ncvpt, NCVPT, ncvpt, NCID, VARID, COORDS, COUNTS, PVOID, PRCODE)
 FCALLSCSUB7 (c_ncvptc, NCVPTC, ncvptc, NCID, VARID, COORDS, COUNTS, CBUF, LENSTR, PRCODE)
 FCALLSCSUB8 (c_ncvptg, NCVPTG, ncvptg, NCID, VARID, COORDS, COUNTS, STRIDES, V2IMAP, PVOID, PRCODE)
 FCALLSCSUB8 (c_ncvpgc, NCVPGC, ncvpgc, NCID, VARID, COORDS, COUNTS, STRIDES, V2IMAP, CBUF, PRCODE)
 FCALLSCSUB5 (c_ncvgt1, NCVGT1, ncvgt1, NCID, VARID, COORDS, PVOID, PRCODE)
 FCALLSCSUB5 (c_ncvg1c, NCVG1C, ncvg1c, NCID, VARID, COORDS, CBUF, PRCODE)
 FCALLSCSUB6 (c_ncvgt, NCVGT, ncvgt, NCID, VARID, COORDS, COUNTS, PVOID, PRCODE)
 FCALLSCSUB7 (c_ncvgtc, NCVGTC, ncvgtc, NCID, VARID, COORDS, COUNTS, CBUF, LENSTR, PRCODE)
 FCALLSCSUB8 (c_ncvgtg, NCVGTG, ncvgtg, NCID, VARID, COORDS, COUNTS, STRIDES, V2IMAP, PVOID, PRCODE)
 FCALLSCSUB8 (c_ncvggc, NCVGGC, ncvggc, NCID, VARID, COORDS, COUNTS, STRIDES, V2IMAP, CBUF, PRCODE)
 FCALLSCSUB4 (c_ncvren, NCVREN, ncvren, NCID, VARID, STRING, PRCODE)
 FCALLSCSUB7 (c_ncapt, NCAPT, ncapt, NCID, VARID, STRING, TYPE, COUNT, PVOID, PRCODE)
 FCALLSCSUB7 (c_ncaptc, NCAPTC, ncaptc, NCID, VARID, STRING, TYPE, COUNT, CBUF, PRCODE)
 FCALLSCSUB6 (c_ncainq, NCAINQ, ncainq, NCID, VARID, STRING, PTYPE, PATTLEN, PRCODE)
 FCALLSCSUB5 (c_ncagt, NCAGT, ncagt, NCID, VARID, STRING, PVOID, PRCODE)
 FCALLSCSUB6 (c_ncagtc, NCAGTC, ncagtc, NCID, VARID, STRING, CBUF, ATTLEN, PRCODE)
 FCALLSCSUB6 (c_ncacpy, NCACPY, ncacpy, NCID1, VARID1, STRING, NCID2, VARID2, PRCODE)
 FCALLSCSUB5 (c_ncanam, NCANAM, ncanam, NCID, VARID, ATTID, PSTRING, PRCODE)
 FCALLSCSUB5 (c_ncaren, NCAREN, ncaren, NCID, VARID, STRING, STRING, PRCODE)
 FCALLSCSUB4 (c_ncadel, NCADEL, ncadel, NCID, VARID, STRING, PRCODE)


Define Documentation

#define ATTLEN   FINT2CINT
 

Definition at line 52 of file fort-v2compat.c.

#define CLOBMODE   FINT2CINT
 

Definition at line 46 of file fort-v2compat.c.

#define DIMLEN   FINT2CINT
 

Definition at line 49 of file fort-v2compat.c.

#define FILLMODE   FINT2CINT
 

Definition at line 54 of file fort-v2compat.c.

#define LENSTR   FINT2CINT
 

Definition at line 51 of file fort-v2compat.c.

#define NCOPTS   FINT2CINT
 

Definition at line 44 of file fort-v2compat.c.

#define PATTLEN   PCINT2FINT
 

Definition at line 53 of file fort-v2compat.c.

#define PDIMLEN   PCINT2FINT
 

Definition at line 50 of file fort-v2compat.c.

#define PNCOPTS   PCINT2FINT
 

Definition at line 45 of file fort-v2compat.c.

#define PRCODE   PCINT2FINT
 

Definition at line 47 of file fort-v2compat.c.

#define RWMODE   FINT2CINT
 

Definition at line 48 of file fort-v2compat.c.

#define V2IMAP_cfH S,
U,
 ) 
 

Definition at line 59 of file fort-v2compat.c.

#define V2IMAP_cfINT N,
A,
B,
X,
Y,
 )     DOUBLE_cfINT(N,A,B,X,Y,Z)
 

Definition at line 56 of file fort-v2compat.c.

#define V2IMAP_cfQ  )     ptrdiff_t B[MAX_NC_DIMS];
 

Definition at line 60 of file fort-v2compat.c.

#define V2IMAP_cfR A,
B,
 ) 
 

Definition at line 62 of file fort-v2compat.c.

#define V2IMAP_cfSTR N,
T,
A,
B,
C,
D,
 )     _(CFARGS,N)(T,V2IMAP,A,B,C,D,E)
 

Definition at line 58 of file fort-v2compat.c.

#define V2IMAP_cfT M,
I,
A,
B,
 )     f2c_v2imap(*fncid, *fvarid-1, A, B)
 

Definition at line 61 of file fort-v2compat.c.

#define V2IMAPVVVVVVV_cfTYPE   NF_INTEGER
 

Definition at line 57 of file fort-v2compat.c.


Function Documentation

static void c_ncpopt int  val  )  [static]
 

Definition at line 209 of file fort-v2compat.c.

References ncopts.

00212 {
00213     ncopts = val;
00214 }

static size_t dimprod const size_t *  count,
int  rank
[static]
 

Definition at line 178 of file fort-v2compat.c.

Referenced by FCALLSCSUB6().

00179 {
00180     int         i;
00181     size_t      prod = 1;
00182 
00183     for (i = 0; i < rank; ++i)
00184         prod *= count[i];
00185 
00186     return prod;
00187 }

static ptrdiff_t* f2c_v2imap int  ncid,
int  varid,
const int *  fimap,
ptrdiff_t *  cimap
[static]
 

Convert a Version 2 Fortran IMAP vector into a Version 3 C imap vector.

Definition at line 69 of file fort-v2compat.c.

References NC_BYTE, NC_CHAR, NC_DOUBLE, NC_FLOAT, nc_inq_dimlen, nc_inq_vardimid, nc_inq_varndims, nc_inq_vartype, NC_INT, NC_MAX_VAR_DIMS, NC_NOERR, NC_SHORT, and size.

00070 {
00071     int         rank;
00072     nc_type     datatype;
00073 
00074     if (nc_inq_vartype(ncid, varid, &datatype) ||
00075         nc_inq_varndims(ncid, varid, &rank) || rank <= 0)
00076     {
00077         return NULL;
00078     }
00079 
00080     /* else */
00081     if (fimap[0] == 0)
00082     {
00083         /*
00084          * Special Fortran version 2 semantics: use external netCDF variable 
00085          * structure.
00086          */
00087         int             dimids[NC_MAX_VAR_DIMS];
00088         int             idim;
00089         size_t  total;
00090 
00091         if (nc_inq_vardimid(ncid, varid, dimids) != NC_NOERR)
00092             return NULL;
00093 
00094         for (total = 1, idim = rank - 1; idim >= 0; --idim)
00095         {
00096             size_t      length;
00097 
00098             cimap[idim] = total;
00099 
00100             if (nc_inq_dimlen(ncid, dimids[idim], &length) != NC_NOERR)
00101                 return NULL;
00102 
00103             total *= length;
00104         }
00105     }
00106     else
00107     {
00108         /*
00109          * Regular Fortran version 2 semantics: convert byte counts to
00110          * element counts.
00111          */
00112         int     idim;
00113         size_t  size;
00114 
00115         switch (datatype)
00116         {
00117 
00118             case NC_CHAR:
00119                 size = sizeof(char);
00120                 break;
00121             case NC_BYTE:
00122 #               if NF_INT1_IS_C_SIGNED_CHAR
00123                     size = sizeof(signed char);
00124 #               elif NF_INT1_IS_C_SHORT
00125                     size = sizeof(short);
00126 #               elif NF_INT1_IS_C_INT
00127                     size = sizeof(int);
00128 #               elif NF_INT1_IS_C_LONG
00129                     size = sizeof(long);
00130 #               endif
00131                 break;
00132             case NC_SHORT:
00133 #               if NF_INT2_IS_C_SHORT
00134                     size = sizeof(short);
00135 #               elif NF_INT2_IS_C_INT
00136                     size = sizeof(int);
00137 #               elif NF_INT2_IS_C_LONG
00138                     size = sizeof(long);
00139 #               endif
00140                 break;
00141             case NC_INT:
00142 #               if NF_INT_IS_C_INT
00143                     size = sizeof(int);
00144 #               elif NF_INT_IS_C_LONG
00145                     size = sizeof(long);
00146 #               endif
00147                 break;
00148             case NC_FLOAT:
00149 #               if NF_REAL_IS_C_FLOAT
00150                     size = sizeof(float);
00151 #               elif NF_REAL_IS_C_DOUBLE
00152                     size = sizeof(double);
00153 #               endif
00154                 break;
00155             case NC_DOUBLE:
00156 #               if NF_DOUBLEPRECISION_IS_C_FLOAT
00157                     size = sizeof(float);
00158 #               elif NF_DOUBLEPRECISION_IS_C_DOUBLE
00159                     size = sizeof(double);
00160 #               endif
00161                 break;
00162             default:
00163                 return NULL;
00164         }
00165 
00166         for (idim = 0; idim < rank; ++idim)
00167             cimap[idim] = fimap[rank - 1 - idim] / size;
00168     }
00169 
00170     return cimap;
00171 }

FCALLSCFUN2 NF_INT  ,
c_nctlen  ,
NCTLEN  ,
nctlen  ,
TYPE  ,
PRCODE 
 

Definition at line 474 of file fort-v2compat.c.

References ncclose(), and ncerr.

00486 {
00487     *rcode = ncclose(ncid) == -1
00488                 ? ncerr
00489                 : 0;
00490 }

FCALLSCFUN3 NF_INT  ,
c_ncvid  ,
NCVID  ,
ncvid  ,
NCID  ,
STRING  ,
PRCODE 
 

Definition at line 451 of file fort-v2compat.c.

References ncerr, and nctypelen().

00463 {
00464     int itype;
00465 
00466     *rcode = ((itype = (int) nctypelen (datatype)) == -1)
00467                 ?  ncerr
00468                 : 0;
00469 
00470     return itype;
00471 }

FCALLSCFUN3 NF_INT  ,
c_ncdid  ,
NCDID  ,
ncdid  ,
NCID  ,
STRING  ,
PRCODE 
 

Definition at line 388 of file fort-v2compat.c.

References nc_advise(), nc_def_var, and ncerr.

00404 {
00405     int varid, status;
00406 
00407     if (status = nc_def_var(ncid, varname, datatype, ndims, dimids, &varid))
00408     {
00409         nc_advise("NCVDEF", status, "");
00410         *rcode = ncerr;
00411         varid = -1;
00412     }
00413     else
00414     {
00415         varid++;
00416         *rcode = 0;
00417     }
00418 
00419     return varid;
00420 }

FCALLSCFUN3 NF_INT  ,
c_ncopn  ,
NCOPN  ,
ncopn  ,
STRING  ,
RWMODE  ,
PRCODE 
 

Definition at line 331 of file fort-v2compat.c.

References ncdimdef(), and ncerr.

00345 {
00346     int dimid;
00347 
00348     if ((dimid = ncdimdef (ncid, dimname, (long)dimlen)) == -1)
00349         *rcode = ncerr;
00350     else
00351     {
00352         dimid++;
00353         *rcode = 0;
00354     }
00355 
00356     return dimid;
00357 }

FCALLSCFUN3 NF_INT  ,
c_nccre  ,
NCCRE  ,
nccre  ,
STRING  ,
CLOBMODE  ,
PRCODE 
 

Definition at line 282 of file fort-v2compat.c.

References cdf_routine_name, nc_advise(), NC_EINVAL, NC_NOWRITE, NC_WRITE, ncerr, ncid, and ncopen().

00295 {
00296     int ncid = -1;
00297 
00298 #if CDF_ROUTINE_NAME
00299     cdf_routine_name = "NCOPN";
00300 #endif
00301 
00302     if (rwmode != NC_NOWRITE && rwmode != NC_WRITE)
00303     {
00304         *rcode = NC_EINVAL;
00305         nc_advise("NCOPN", *rcode,
00306                 "bad flag, did you forget to include netcdf.inc?");
00307     }
00308     else
00309     {
00310         if (pathname == NULL) {
00311             *rcode = NC_EINVAL;
00312         }
00313         else
00314         {
00315             *rcode = ((ncid = ncopen (pathname, rwmode)) == -1)
00316                         ? ncerr
00317                         : 0;
00318         }
00319 
00320         if (*rcode != 0)
00321         {
00322             nc_advise("NCOPN", *rcode, "");
00323             *rcode = ncerr;
00324         }
00325     }
00326 
00327     return ncid;
00328 }

FCALLSCFUN4 NF_INT  ,
c_ncddef  ,
NCDDEF  ,
ncddef  ,
NCID  ,
STRING  ,
DIMLEN  ,
PRCODE 
 

Definition at line 360 of file fort-v2compat.c.

References ncdimid(), and ncerr.

00373 {
00374     int dimid;
00375 
00376     if ((dimid = ncdimid (ncid, dimname)) == -1)
00377         *rcode = ncerr;
00378     else
00379     {
00380         dimid++;
00381         *rcode = 0;
00382     }
00383 
00384     return dimid;
00385 }

FCALLSCFUN6 NF_INT  ,
c_ncvdef  ,
NCVDEF  ,
ncvdef  ,
NCID  ,
STRING  ,
TYPE  ,
NDIMS  ,
DIMIDS  ,
PRCODE 
 

Definition at line 423 of file fort-v2compat.c.

References ncerr, and ncvarid().

00436 {
00437     int varid;
00438 
00439     if ((varid = ncvarid (ncid, varname)) == -1)
00440         *rcode = ncerr;
00441     else
00442     {
00443         varid++;
00444         *rcode = 0;
00445     }
00446 
00447     return varid;
00448 }

FCALLSCSUB1 c_ncgopt  ,
NCGOPT  ,
ncgopt  ,
PNCOPTS 
 

Definition at line 233 of file fort-v2compat.c.

References cdf_routine_name, nc_advise(), NC_CLOBBER, NC_EINVAL, NC_NOCLOBBER, nccreate(), ncerr, and ncid.

00247 {
00248     int ncid = -1;
00249 
00250 #if CDF_ROUTINE_NAME
00251     cdf_routine_name = "NCCRE";
00252 #endif
00253 
00254     if (clobmode != NC_CLOBBER && clobmode != NC_NOCLOBBER)
00255     {
00256         *rcode = NC_EINVAL;
00257         nc_advise("NCCRE", *rcode,
00258                 "bad flag, did you forget to include netcdf.inc?");
00259     }
00260     else
00261     {
00262         if (pathname == NULL)
00263             *rcode = NC_EINVAL;
00264         else
00265         {
00266             *rcode = ((ncid = nccreate (pathname, clobmode)) == -1)
00267                         ? ncerr
00268                         : 0;
00269         }
00270 
00271         if (*rcode != 0)
00272         {
00273             nc_advise("NCCRE", *rcode, "");
00274             *rcode = ncerr;
00275         }
00276     }
00277 
00278     return ncid;
00279 }

FCALLSCSUB1 c_ncpopt  ,
NCPOPT  ,
ncpopt  ,
NCOPTS 
 

Definition at line 217 of file fort-v2compat.c.

References ncopts.

00228 {
00229     *val = ncopts;
00230 }

FCALLSCSUB2 c_ncabor  ,
NCABOR  ,
ncabor  ,
NCID  ,
PRCODE 
 

Definition at line 595 of file fort-v2compat.c.

References ncdiminq(), and ncerr.

00610 {
00611     long siz;
00612 
00613     if (ncdiminq (ncid, dimid, dimname, &siz) == -1)
00614         *rcode = ncerr;
00615     else
00616     {
00617         *size = siz;
00618         *rcode = 0;
00619     }
00620 }

FCALLSCSUB2 c_ncsnc  ,
NCSNC  ,
ncsnc  ,
NCID  ,
PRCODE 
 

Definition at line 574 of file fort-v2compat.c.

References ncabort(), and ncerr.

00588 {
00589     *rcode = ncabort(ncid) == -1
00590                 ? ncerr
00591                 : 0;
00592 }

FCALLSCSUB2 c_ncendf  ,
NCENDF  ,
ncendf  ,
NCID  ,
PRCODE 
 

Definition at line 531 of file fort-v2compat.c.

References ncerr, and ncinquire().

00547 {
00548     *rcode = ncinquire(ncid, indims, invars, inatts, irecdim) == -1
00549                 ? ncerr
00550                 : 0;
00551 }

FCALLSCSUB2 c_ncredf  ,
NCREDF  ,
ncredf  ,
NCID  ,
PRCODE 
 

Definition at line 512 of file fort-v2compat.c.

References ncendef(), and ncerr.

00524 {
00525     *rcode = ncendef (ncid) == -1
00526                 ? ncerr
00527                 : 0;
00528 }

FCALLSCSUB2 c_ncclos  ,
NCCLOS  ,
ncclos  ,
NCID  ,
PRCODE 
 

Definition at line 493 of file fort-v2compat.c.

References ncerr, and ncredef().

00505 {
00506     *rcode = ncredef(ncid) == -1
00507                 ? ncerr
00508                 : 0;
00509 }

FCALLSCSUB4 c_ncadel  ,
NCADEL  ,
ncadel  ,
NCID  ,
VARID  ,
STRING  ,
PRCODE 
 

Definition at line 1966 of file fort-v2compat.c.

References ncerr, and ncsetfill().

01979 {
01980     int retval;
01981 
01982     *rcode = ((retval = ncsetfill(ncid, fillmode)) == -1)
01983                 ? ncerr
01984                 : 0;
01985 
01986     return retval;
01987 }

FCALLSCSUB4 c_ncvren  ,
NCVREN  ,
ncvren  ,
NCID  ,
VARID  ,
STRING  ,
PRCODE 
 

Definition at line 1576 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, NC_INT, nc_put_att_double, nc_put_att_float, nc_put_att_int, nc_put_att_long, nc_put_att_schar, nc_put_att_short, NC_SHORT, and ncerr.

01594 {
01595     int         status;
01596 
01597     switch (datatype)
01598     {
01599     case NC_CHAR:
01600         status = NC_ECHAR;
01601         break;
01602     case NC_BYTE:
01603 #       if NF_INT1_IS_C_SIGNED_CHAR
01604             status = nc_put_att_schar(ncid, varid, attname, datatype,
01605                                        attlen, (const signed char*)value);
01606 #       elif NF_INT1_IS_C_SHORT
01607             status = nc_put_att_short(ncid, varid, attname, datatype,
01608                                        attlen, (const short*)value);
01609 #       elif NF_INT1_IS_C_INT
01610             status = nc_put_att_int(ncid, varid, attname, datatype,
01611                                        attlen, (const int*)value);
01612 #       elif NF_INT1_IS_C_LONG
01613             status = nc_put_att_long(ncid, varid, attname, datatype,
01614                                        attlen, (const long*)value);
01615 #       endif
01616         break;
01617     case NC_SHORT:
01618 #       if NF_INT2_IS_C_SHORT
01619             status = nc_put_att_short(ncid, varid, attname, datatype,
01620                                        attlen, (const short*)value);
01621 #       elif NF_INT2_IS_C_INT
01622             status = nc_put_att_int(ncid, varid, attname, datatype,
01623                                        attlen, (const int*)value);
01624 #       elif NF_INT2_IS_C_LONG
01625             status = nc_put_att_long(ncid, varid, attname, datatype,
01626                                        attlen, (const long*)value);
01627 #       endif
01628         break;
01629     case NC_INT:
01630 #       if NF_INT_IS_C_INT
01631             status = nc_put_att_int(ncid, varid, attname, datatype,
01632                                        attlen, (const int*)value);
01633 #       elif NF_INT_IS_C_LONG
01634             status = nc_put_att_long(ncid, varid, attname, datatype,
01635                                        attlen, (const long*)value);
01636 #       endif
01637         break;
01638     case NC_FLOAT:
01639 #       if NF_REAL_IS_C_FLOAT
01640             status = nc_put_att_float(ncid, varid, attname, datatype,
01641                                        attlen, (const float*)value);
01642 #       elif NF_REAL_IS_C_DOUBLE
01643             status = nc_put_att_double(ncid, varid, attname, datatype,
01644                                        attlen, (const double*)value);
01645 #       endif
01646         break;
01647     case NC_DOUBLE:
01648 #       if NF_DOUBLEPRECISION_IS_C_FLOAT
01649             status = nc_put_att_float(ncid, varid, attname, datatype,
01650                                        attlen, (const float*)value);
01651 #       elif NF_DOUBLEPRECISION_IS_C_DOUBLE
01652             status = nc_put_att_double(ncid, varid, attname, datatype,
01653                                        attlen, (const double*)value);
01654 #       endif
01655         break;
01656     }
01657 
01658     if (status == 0)
01659         *rcode = 0;
01660     else
01661     {
01662         nc_advise("NCAPT", status, "");
01663         *rcode = ncerr;
01664     }
01665 }

FCALLSCSUB4 c_ncdren  ,
NCDREN  ,
ncdren  ,
NCID  ,
DIMID  ,
STRING  ,
PRCODE 
 

Definition at line 644 of file fort-v2compat.c.

References ncerr, and ncvarinq().

00662 {
00663     *rcode = ncvarinq(ncid, varid, varname, datatype, indims,
00664                       dimarray, inatts) == -1
00665                 ? ncerr
00666                 : 0;
00667 }

FCALLSCSUB5 c_ncaren  ,
NCAREN  ,
ncaren  ,
NCID  ,
VARID  ,
STRING  ,
STRING  ,
PRCODE 
 

Definition at line 1945 of file fort-v2compat.c.

References ncattdel(), and ncerr.

01959 {
01960     *rcode = ncattdel(ncid, varid, attname) == -1
01961                 ? ncerr
01962                 : 0;
01963 }

FCALLSCSUB5 c_ncanam  ,
NCANAM  ,
ncanam  ,
NCID  ,
VARID  ,
ATTID  ,
PSTRING  ,
PRCODE 
 

Definition at line 1923 of file fort-v2compat.c.

References ncattrename(), and ncerr.

01938 {
01939     *rcode = ncattrename(ncid, varid, attname, newname) == -1
01940                 ? ncerr
01941                 : 0;
01942 }

FCALLSCSUB5 c_ncagt  ,
NCAGT  ,
ncagt  ,
NCID  ,
VARID  ,
STRING  ,
PVOID  ,
PRCODE 
 

Definition at line 1821 of file fort-v2compat.c.

References len, nc_advise(), NC_CHAR, NC_ECHAR, NC_ESTS, nc_get_att_text, nc_inq_attlen, nc_inq_atttype, and ncerr.

01838 {
01839     int         status;
01840     nc_type     datatype;
01841 
01842     if ((status = nc_inq_atttype(ncid, varid, attname, &datatype)) == 0)
01843     {
01844         if (datatype != NC_CHAR)
01845             status = NC_ECHAR;
01846         else
01847         {
01848             size_t      len;
01849 
01850             status = nc_inq_attlen(ncid, varid, attname, &len);
01851             if (status == 0)
01852             {
01853                 if (attlen < len)
01854                     status = NC_ESTS;
01855                 else
01856                 {
01857                     status = nc_get_att_text(ncid, varid, attname, 
01858                                                value);
01859                     if (status == 0)
01860                         (void) memset(value+len, ' ', attlen - len);
01861                 }
01862             }
01863         }
01864     }
01865 
01866     if (status == 0)
01867         *rcode = 0;
01868     else
01869     {
01870         nc_advise("NCAGTC", status, "");
01871         *rcode = ncerr;
01872     }
01873 }

FCALLSCSUB5 c_ncvg1c  ,
NCVG1C  ,
ncvg1c  ,
NCID  ,
VARID  ,
COORDS  ,
CBUF  ,
PRCODE 
 

Definition at line 1248 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, nc_get_vara_double, nc_get_vara_float, nc_get_vara_int, nc_get_vara_long, nc_get_vara_schar, nc_get_vara_short, nc_inq_vartype, NC_INT, NC_SHORT, and ncerr.

01265 {
01266     int         status;
01267     nc_type     datatype;
01268 
01269     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
01270     {
01271         switch (datatype)
01272         {
01273         case NC_CHAR:
01274             status = NC_ECHAR;
01275             break;
01276         case NC_BYTE:
01277 #           if NF_INT1_IS_C_SIGNED_CHAR
01278                 status = nc_get_vara_schar(ncid, varid, start, count,
01279                                            (signed char*)value);
01280 #           elif NF_INT1_IS_C_SHORT
01281                 status = nc_get_vara_short(ncid, varid, start, count,
01282                                            (short*)value);
01283 #           elif NF_INT1_IS_C_INT
01284                 status = nc_get_vara_int(ncid, varid, start, count,
01285                                            (int*)value);
01286 #           elif NF_INT1_IS_C_LONG
01287                 status = nc_get_vara_long(ncid, varid, start, count,
01288                                            (long*)value);
01289 #           endif
01290             break;
01291         case NC_SHORT:
01292 #           if NF_INT2_IS_C_SHORT
01293                 status = nc_get_vara_short(ncid, varid, start, count,
01294                                            (short*)value);
01295 #           elif NF_INT2_IS_C_INT
01296                 status = nc_get_vara_int(ncid, varid, start, count,
01297                                            (int*)value);
01298 #           elif NF_INT2_IS_C_LONG
01299                 status = nc_get_vara_long(ncid, varid, start, count,
01300                                            (long*)value);
01301 #           endif
01302             break;
01303         case NC_INT:
01304 #           if NF_INT_IS_C_INT
01305                 status = nc_get_vara_int(ncid, varid, start, count,
01306                                            (int*)value);
01307 #           elif NF_INT_IS_C_LONG
01308                 status = nc_get_vara_long(ncid, varid, start, count,
01309                                            (long*)value);
01310 #           endif
01311             break;
01312         case NC_FLOAT:
01313 #           if NF_REAL_IS_C_FLOAT
01314                 status = nc_get_vara_float(ncid, varid, start, count,
01315                                            (float*)value);
01316 #           elif NF_REAL_IS_C_DOUBLE
01317                 status = nc_get_vara_double(ncid, varid, start, count,
01318                                            (double*)value);
01319 #           endif
01320             break;
01321         case NC_DOUBLE:
01322 #           if NF_DOUBLEPRECISION_IS_C_FLOAT
01323                 status = nc_get_vara_float(ncid, varid, start, count,
01324                                            (float*)value);
01325 #           elif NF_DOUBLEPRECISION_IS_C_DOUBLE
01326                 status = nc_get_vara_double(ncid, varid, start, count,
01327                                            (double*)value);
01328 #           endif
01329             break;
01330         }
01331     }
01332 
01333     if (status == 0)
01334         *rcode = 0;
01335     else
01336     {
01337         nc_advise("NCVGT", status, "");
01338         *rcode = ncerr;
01339     }
01340 }

FCALLSCSUB5 c_ncvgt1  ,
NCVGT1  ,
ncvgt1  ,
NCID  ,
VARID  ,
COORDS  ,
PVOID  ,
PRCODE 
 

Definition at line 1204 of file fort-v2compat.c.

References nc_advise(), NC_CHAR, NC_ECHAR, nc_get_var1_text, nc_inq_vartype, and ncerr.

01220 {
01221     int         status;
01222     nc_type     datatype;
01223 
01224     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
01225     {
01226         switch (datatype)
01227         {
01228         case NC_CHAR:
01229             status = nc_get_var1_text(ncid, varid, indices, value);
01230             break;
01231         default:
01232             status = NC_ECHAR;
01233             break;
01234         }
01235     }
01236 
01237     if (status == 0)
01238         *rcode = 0;
01239     else
01240     {
01241         nc_advise("NCVG1C", status, "");
01242         *rcode = ncerr;
01243     }
01244 }

FCALLSCSUB5 c_ncvp1c  ,
NCVP1C  ,
ncvp1c  ,
NCID  ,
VARID  ,
COORDS  ,
CBUF  ,
PRCODE 
 

Definition at line 799 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, nc_inq_vartype, NC_INT, nc_put_vara_double, nc_put_vara_float, nc_put_vara_int, nc_put_vara_long, nc_put_vara_schar, nc_put_vara_short, NC_SHORT, and ncerr.

00816 {
00817     int         status;
00818     nc_type     datatype;
00819 
00820     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
00821     {
00822         switch (datatype)
00823         {
00824         case NC_CHAR:
00825             status = NC_ECHAR;
00826             break;
00827         case NC_BYTE:
00828 #           if NF_INT1_IS_C_SIGNED_CHAR
00829                 status = nc_put_vara_schar(ncid, varid, start, count,
00830                                            (const signed char*)value);
00831 #           elif NF_INT1_IS_C_SHORT
00832                 status = nc_put_vara_short(ncid, varid, start, count,
00833                                            (const short*)value);
00834 #           elif NF_INT1_IS_C_INT
00835                 status = nc_put_vara_int(ncid, varid, start, count,
00836                                            (const int*)value);
00837 #           elif NF_INT1_IS_C_LONG
00838                 status = nc_put_vara_long(ncid, varid, start, count,
00839                                            (const long*)value);
00840 #           endif
00841             break;
00842         case NC_SHORT:
00843 #           if NF_INT2_IS_C_SHORT
00844                 status = nc_put_vara_short(ncid, varid, start, count,
00845                                            (const short*)value);
00846 #           elif NF_INT2_IS_C_INT
00847                 status = nc_put_vara_int(ncid, varid, start, count,
00848                                            (const int*)value);
00849 #           elif NF_INT2_IS_C_LONG
00850                 status = nc_put_vara_long(ncid, varid, start, count,
00851                                            (const long*)value);
00852 #           endif
00853             break;
00854         case NC_INT:
00855 #           if NF_INT_IS_C_INT
00856                 status = nc_put_vara_int(ncid, varid, start, count,
00857                                            (const int*)value);
00858 #           elif NF_INT_IS_C_LONG
00859                 status = nc_put_vara_long(ncid, varid, start, count,
00860                                            (const long*)value);
00861 #           endif
00862             break;
00863         case NC_FLOAT:
00864 #           if NF_REAL_IS_C_FLOAT
00865                 status = nc_put_vara_float(ncid, varid, start, count,
00866                                            (const float*)value);
00867 #           elif NF_REAL_IS_C_DOUBLE
00868                 status = nc_put_vara_double(ncid, varid, start, count,
00869                                            (const double*)value);
00870 #           endif
00871             break;
00872         case NC_DOUBLE:
00873 #           if NF_DOUBLEPRECISION_IS_C_FLOAT
00874                 status = nc_put_vara_float(ncid, varid, start, count,
00875                                            (const float*)value);
00876 #           elif NF_DOUBLEPRECISION_IS_C_DOUBLE
00877                 status = nc_put_vara_double(ncid, varid, start, count,
00878                                            (const double*)value);
00879 #           endif
00880             break;
00881         }
00882     }
00883 
00884     if (status == 0)
00885         *rcode = 0;
00886     else
00887     {
00888         nc_advise("NCVPT", status, "");
00889         *rcode = ncerr;
00890     }
00891 }

FCALLSCSUB5 c_ncvpt1  ,
NCVPT1  ,
ncvpt1  ,
NCID  ,
VARID  ,
COORDS  ,
PVOID  ,
PRCODE 
 

Definition at line 763 of file fort-v2compat.c.

References nc_advise(), NC_CHAR, NC_ECHAR, nc_inq_vartype, nc_put_var1_text, and ncerr.

00778 {
00779     int         status;
00780     nc_type     datatype;
00781 
00782     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
00783     {
00784         status = datatype != NC_CHAR
00785                     ? NC_ECHAR
00786                     : nc_put_var1_text(ncid, varid, indices, value);
00787     }
00788 
00789     if (status == 0)
00790         *rcode = 0;
00791     else
00792     {
00793         nc_advise("NCVP1C", status, "");
00794         *rcode = ncerr;
00795     }
00796 }

FCALLSCSUB5 c_ncdinq  ,
NCDINQ  ,
ncdinq  ,
NCID  ,
DIMID  ,
PSTRING  ,
PDIMLEN  ,
PRCODE 
 

Definition at line 623 of file fort-v2compat.c.

References ncdimrename(), and ncerr.

00637 {
00638     *rcode = ncdimrename(ncid, dimid, dimname) == -1
00639                 ? ncerr
00640                 : 0;
00641 }

FCALLSCSUB6 c_ncacpy  ,
NCACPY  ,
ncacpy  ,
NCID1  ,
VARID1  ,
STRING  ,
NCID2  ,
VARID2  ,
PRCODE 
 

Definition at line 1900 of file fort-v2compat.c.

References ncattname(), and ncerr.

01916 {
01917     *rcode = ncattname(ncid, varid, attnum, attname) == -1
01918                 ? ncerr
01919                 : 0;
01920 }

FCALLSCSUB6 c_ncagtc  ,
NCAGTC  ,
ncagtc  ,
NCID  ,
VARID  ,
STRING  ,
CBUF  ,
ATTLEN  ,
PRCODE 
 

Definition at line 1876 of file fort-v2compat.c.

References ncattcopy(), and ncerr.

01892 {
01893     *rcode = ncattcopy(inncid, invarid, attname, outncid, outvarid)
01894              == -1
01895                 ? ncerr
01896                 : 0;
01897 }

FCALLSCSUB6 c_ncainq  ,
NCAINQ  ,
ncainq  ,
NCID  ,
VARID  ,
STRING  ,
PTYPE  ,
PATTLEN  ,
PRCODE 
 

Definition at line 1728 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, nc_get_att_double, nc_get_att_float, nc_get_att_int, nc_get_att_long, nc_get_att_schar, nc_get_att_short, nc_inq_atttype, NC_INT, NC_SHORT, and ncerr.

01743 {
01744     int         status;
01745     nc_type     datatype;
01746 
01747     if ((status = nc_inq_atttype(ncid, varid, attname, &datatype)) == 0)
01748     {
01749         switch (datatype)
01750         {
01751         case NC_CHAR:
01752             status = NC_ECHAR;
01753             break;
01754         case NC_BYTE:
01755 #       if NF_INT1_IS_C_SIGNED_CHAR
01756                 status = nc_get_att_schar(ncid, varid, attname, 
01757                                            (signed char*)value);
01758 #       elif NF_INT1_IS_C_SHORT
01759                 status = nc_get_att_short(ncid, varid, attname, 
01760                                            (short*)value);
01761 #       elif NF_INT1_IS_C_INT
01762                 status = nc_get_att_int(ncid, varid, attname, 
01763                                            (int*)value);
01764 #       elif NF_INT1_IS_C_LONG
01765                 status = nc_get_att_long(ncid, varid, attname, 
01766                                            (long*)value);
01767 #       endif
01768             break;
01769         case NC_SHORT:
01770 #       if NF_INT2_IS_C_SHORT
01771                 status = nc_get_att_short(ncid, varid, attname, 
01772                                            (short*)value);
01773 #       elif NF_INT2_IS_C_INT
01774                 status = nc_get_att_int(ncid, varid, attname, 
01775                                            (int*)value);
01776 #       elif NF_INT2_IS_C_LONG
01777                 status = nc_get_att_long(ncid, varid, attname, 
01778                                            (long*)value);
01779 #       endif
01780             break;
01781         case NC_INT:
01782 #           if NF_INT_IS_C_INT
01783                 status = nc_get_att_int(ncid, varid, attname, 
01784                                            (int*)value);
01785 #           elif NF_INT_IS_C_LONG
01786                 status = nc_get_att_long(ncid, varid, attname, 
01787                                            (long*)value);
01788 #           endif
01789             break;
01790         case NC_FLOAT:
01791 #       if NF_REAL_IS_C_FLOAT
01792                 status = nc_get_att_float(ncid, varid, attname, 
01793                                            (float*)value);
01794 #       elif NF_REAL_IS_C_DOUBLE
01795                 status = nc_get_att_double(ncid, varid, attname, 
01796                                            (double*)value);
01797 #       endif
01798             break;
01799         case NC_DOUBLE:
01800 #       if NF_DOUBLEPRECISION_IS_C_FLOAT
01801                 status = nc_get_att_float(ncid, varid, attname, 
01802                                            (float*)value);
01803 #       elif NF_DOUBLEPRECISION_IS_C_DOUBLE
01804                 status = nc_get_att_double(ncid, varid, attname, 
01805                                            (double*)value);
01806 #       endif
01807             break;
01808         }
01809     }
01810 
01811     if (status == 0)
01812         *rcode = 0;
01813     else
01814     {
01815         nc_advise("NCAGT", status, "");
01816         *rcode = ncerr;
01817     }
01818 }

FCALLSCSUB6 c_ncvgt  ,
NCVGT  ,
ncvgt  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
PVOID  ,
PRCODE 
 

Definition at line 1344 of file fort-v2compat.c.

References dimprod(), nc_advise(), NC_CHAR, NC_ECHAR, nc_get_vara_text, nc_inq_varndims, nc_inq_vartype, and ncerr.

01361 {
01362     int         status;
01363     nc_type     datatype;
01364 
01365     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
01366     {
01367         if (datatype != NC_CHAR)
01368             status = NC_ECHAR;
01369         else if ((status = nc_get_vara_text(ncid, varid, start, count, value))
01370                  == 0)
01371         {
01372             int rank;
01373 
01374             if ((status = nc_inq_varndims(ncid, varid, &rank)) == 0)
01375             {
01376                 size_t  total = dimprod(count, rank);
01377 
01378                 (void) memset(value+total, ' ', lenstr - total);
01379             }
01380         }
01381     }
01382 
01383     if (status == 0)
01384         *rcode = 0;
01385     else
01386     {
01387         nc_advise("NCVGTC", status, "");
01388         *rcode = ncerr;
01389     }
01390 }

FCALLSCSUB6 c_ncvpt  ,
NCVPT  ,
ncvpt  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
PVOID  ,
PRCODE 
 

Definition at line 895 of file fort-v2compat.c.

References dimprod(), nc_advise(), NC_CHAR, NC_ECHAR, NC_ESTS, nc_inq_varndims, nc_inq_vartype, nc_put_vara_text, and ncerr.

00912 {
00913     int         status;
00914     nc_type     datatype;
00915 
00916     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
00917     {
00918         if (datatype != NC_CHAR)
00919             status = NC_ECHAR;
00920         else
00921         {
00922             int rank;
00923 
00924             status = nc_inq_varndims(ncid, varid, &rank);
00925             if (status == 0)
00926             {
00927                 if (dimprod(count, rank) > (size_t)lenstr)
00928                     status = NC_ESTS;
00929                 else
00930                     status = nc_put_vara_text(ncid, varid, start, count, value);
00931             }
00932         }
00933     }
00934 
00935     if (status == 0)
00936         *rcode = 0;
00937     else
00938     {
00939         nc_advise("NCVPTC", status, "");
00940         *rcode = ncerr;
00941     }
00942 }

FCALLSCSUB6 c_ncinq  ,
NCINQ  ,
ncinq  ,
NCID  ,
PNDIMS  ,
PNVARS  ,
PNATTS  ,
PDIMID  ,
PRCODE 
 

Definition at line 554 of file fort-v2compat.c.

References ncerr, and ncsync().

00567 {
00568     *rcode = ncsync (ncid) == -1
00569                 ? ncerr
00570                 : 0;
00571 }

FCALLSCSUB7 c_ncaptc  ,
NCAPTC  ,
ncaptc  ,
NCID  ,
VARID  ,
STRING  ,
TYPE  ,
COUNT  ,
CBUF  ,
PRCODE 
 

Definition at line 1703 of file fort-v2compat.c.

References ncattinq(), and ncerr.

01720 {
01721     *rcode = ncattinq(ncid, varid, attname, datatype, attlen)
01722              == -1
01723                 ? ncerr
01724                 : 0;
01725 }

FCALLSCSUB7 c_ncapt  ,
NCAPT  ,
ncapt  ,
NCID  ,
VARID  ,
STRING  ,
TYPE  ,
COUNT  ,
PVOID  ,
PRCODE 
 

Definition at line 1668 of file fort-v2compat.c.

References nc_advise(), NC_CHAR, NC_ECHAR, nc_put_att_text, and ncerr.

01685 {
01686     int         status;
01687 
01688     if (datatype != NC_CHAR)
01689         status = NC_ECHAR;
01690     else
01691         status = nc_put_att_text(ncid, varid, attname, attlen, value);
01692 
01693     if (status == 0)
01694         *rcode = 0;
01695     else
01696     {
01697         nc_advise("NCAPTC", status, "");
01698         *rcode = ncerr;
01699     }
01700 }

FCALLSCSUB7 c_ncvgtc  ,
NCVGTC  ,
ncvgtc  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
CBUF  ,
LENSTR  ,
PRCODE 
 

Definition at line 1393 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, nc_get_varm_double, nc_get_varm_float, nc_get_varm_int, nc_get_varm_long, nc_get_varm_schar, nc_get_varm_short, nc_inq_varndims, nc_inq_vartype, NC_INT, NC_SHORT, and ncerr.

01412 {
01413     int         status;
01414     int         rank;
01415     nc_type     datatype;
01416 
01417     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0 &&
01418         (status = nc_inq_varndims(ncid, varid, &rank)) == 0)
01419     {
01420         switch (datatype)
01421         {
01422         case NC_CHAR:
01423             status = NC_ECHAR;
01424             break;
01425         case NC_BYTE:
01426 #           if NF_INT1_IS_C_SIGNED_CHAR
01427                 status = nc_get_varm_schar(ncid, varid, start, count,
01428                                            strides, imap,
01429                                            (signed char*)value);
01430 #           elif NF_INT1_IS_C_SHORT
01431                 status = nc_get_varm_short(ncid, varid, start, count,
01432                                            strides, imap,
01433                                            (short*)value);
01434 #           elif NF_INT1_IS_C_INT
01435                 status = nc_get_varm_int(ncid, varid, start, count,
01436                                            strides, imap,
01437                                            (int*)value);
01438 #           elif NF_INT1_IS_C_LONG
01439                 status = nc_get_varm_long(ncid, varid, start, count,
01440                                            strides, imap,
01441                                            (long*)value);
01442 #           endif
01443             break;
01444         case NC_SHORT:
01445 #           if NF_INT2_IS_C_SHORT
01446                 status = nc_get_varm_short(ncid, varid, start, count,
01447                                            strides, imap,
01448                                            (short*)value);
01449 #           elif NF_INT2_IS_C_INT
01450                 status = nc_get_varm_int(ncid, varid, start, count,
01451                                            strides, imap,
01452                                            (int*)value);
01453 #           elif NF_INT2_IS_C_LONG
01454                 status = nc_get_varm_long(ncid, varid, start, count,
01455                                            strides, imap,
01456                                            (long*)value);
01457 #           endif
01458             break;
01459         case NC_INT:
01460 #           if NF_INT_IS_C_INT
01461                 status = nc_get_varm_int(ncid, varid, start, count,
01462                                            strides, imap,
01463                                            (int*)value);
01464 #           elif NF_INT_IS_C_LONG
01465                 status = nc_get_varm_long(ncid, varid, start, count,
01466                                            strides, imap,
01467                                            (long*)value);
01468 #           endif
01469             break;
01470         case NC_FLOAT:
01471 #           if NF_REAL_IS_C_FLOAT
01472                 status = nc_get_varm_float(ncid, varid, start, count,
01473                                            strides, imap,
01474                                            (float*)value);
01475 #           elif NF_REAL_IS_C_DOUBLE
01476                 status = nc_get_varm_double(ncid, varid, start, count,
01477                                            strides, imap,
01478                                            (double*)value);
01479 #           endif
01480             break;
01481         case NC_DOUBLE:
01482 #           if NF_DOUBLEPRECISION_IS_C_FLOAT
01483                 status = nc_get_varm_float(ncid, varid, start, count,
01484                                            strides, imap,
01485                                            (float*)value);
01486 #           elif NF_DOUBLEPRECISION_IS_C_DOUBLE
01487                 status = nc_get_varm_double(ncid, varid, start, count,
01488                                            strides, imap,
01489                                            (double*)value);
01490 #           endif
01491             break;
01492         }
01493     }
01494 
01495     if (status == 0)
01496         *rcode = 0;
01497     else
01498     {
01499         nc_advise("NCVGTG", status, "");
01500         *rcode = ncerr;
01501     }
01502 }

FCALLSCSUB7 c_ncvptc  ,
NCVPTC  ,
ncvptc  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
CBUF  ,
LENSTR  ,
PRCODE 
 

Definition at line 946 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, nc_inq_varndims, nc_inq_vartype, NC_INT, nc_put_varm_double, nc_put_varm_float, nc_put_varm_int, nc_put_varm_long, nc_put_varm_schar, nc_put_varm_short, NC_SHORT, and ncerr.

00965 {
00966     int         status;
00967     int         rank;
00968     nc_type     datatype;
00969 
00970     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0 &&
00971         (status = nc_inq_varndims(ncid, varid, &rank)) == 0)
00972     {
00973         switch (datatype)
00974         {
00975         case NC_CHAR:
00976             status = NC_ECHAR;
00977             break;
00978         case NC_BYTE:
00979 #           if NF_INT1_IS_C_SIGNED_CHAR
00980                 status = nc_put_varm_schar(ncid, varid, start, count,
00981                                            strides, imap,
00982                                            (const signed char*)value);
00983 #           elif NF_INT1_IS_C_SHORT
00984                 status = nc_put_varm_short(ncid, varid, start, count,
00985                                            strides, imap,
00986                                            (const short*)value);
00987 #           elif NF_INT1_IS_C_INT
00988                 status = nc_put_varm_int(ncid, varid, start, count,
00989                                            strides, imap,
00990                                            (const int*)value);
00991 #           elif NF_INT1_IS_C_LONG
00992                 status = nc_put_varm_long(ncid, varid, start, count,
00993                                            strides, imap,
00994                                            (const long*)value);
00995 #           endif
00996             break;
00997         case NC_SHORT:
00998 #           if NF_INT2_IS_C_SHORT
00999                 status = nc_put_varm_short(ncid, varid, start, count,
01000                                            strides, imap,
01001                                            (const short*)value);
01002 #           elif NF_INT2_IS_C_INT
01003                 status = nc_put_varm_int(ncid, varid, start, count,
01004                                            strides, imap,
01005                                            (const int*)value);
01006 #           elif NF_INT2_IS_C_LONG
01007                 status = nc_put_varm_long(ncid, varid, start, count,
01008                                            strides, imap,
01009                                            (const long*)value);
01010 #           endif
01011             break;
01012         case NC_INT:
01013 #           if NF_INT_IS_C_INT
01014                 status = nc_put_varm_int(ncid, varid, start, count,
01015                                            strides, imap,
01016                                            (const int*)value);
01017 #           elif NF_INT_IS_C_LONG
01018                 status = nc_put_varm_long(ncid, varid, start, count,
01019                                            strides, imap,
01020                                            (const long*)value);
01021 #           endif
01022             break;
01023         case NC_FLOAT:
01024 #           if NF_REAL_IS_C_FLOAT
01025                 status = nc_put_varm_float(ncid, varid, start, count,
01026                                            strides, imap,
01027                                            (const float*)value);
01028 #           elif NF_REAL_IS_C_DOUBLE
01029                 status = nc_put_varm_double(ncid, varid, start, count,
01030                                            strides, imap,
01031                                            (const double*)value);
01032 #           endif
01033             break;
01034         case NC_DOUBLE:
01035 #           if NF_DOUBLEPRECISION_IS_C_FLOAT
01036                 status = nc_put_varm_float(ncid, varid, start, count,
01037                                            strides, imap,
01038                                            (const float*)value);
01039 #           elif NF_DOUBLEPRECISION_IS_C_DOUBLE
01040                 status = nc_put_varm_double(ncid, varid, start, count,
01041                                            strides, imap,
01042                                            (const double*)value);
01043 #           endif
01044             break;
01045         }
01046     }
01047 
01048     if (status == 0)
01049         *rcode = 0;
01050     else
01051     {
01052         nc_advise("NCVPTG", status, "");
01053         *rcode = ncerr;
01054     }
01055 }

FCALLSCSUB8 c_ncvggc  ,
NCVGGC  ,
ncvggc  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
STRIDES  ,
V2IMAP  ,
CBUF  ,
PRCODE 
 

Definition at line 1555 of file fort-v2compat.c.

References ncerr, and ncvarrename().

01569 {
01570     *rcode = ncvarrename (ncid, varid, varname) == -1
01571                 ? ncerr
01572                 : 0;
01573 }

FCALLSCSUB8 c_ncvgtg  ,
NCVGTG  ,
ncvgtg  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
STRIDES  ,
V2IMAP  ,
PVOID  ,
PRCODE 
 

Definition at line 1505 of file fort-v2compat.c.

References nc_advise(), NC_CHAR, NC_ECHAR, nc_get_varm_text, nc_inq_varndims, nc_inq_vartype, and ncerr.

01524 {
01525     int         status;
01526     int         rank;
01527     nc_type     datatype;
01528 
01529     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0 &&
01530         (status = nc_inq_varndims(ncid, varid, &rank)) == 0)
01531     {
01532         switch (datatype)
01533         {
01534         case NC_CHAR:
01535             status = nc_get_varm_text(ncid, varid, start, count,
01536                                        strides, imap,
01537                                        value);
01538             break;
01539         default:
01540             status = NC_ECHAR;
01541             break;
01542         }
01543     }
01544 
01545     if (status == 0)
01546         *rcode = 0;
01547     else
01548     {
01549         nc_advise("NCVGGC", status, "");
01550         *rcode = ncerr;
01551     }
01552 }

FCALLSCSUB8 c_ncvpgc  ,
NCVPGC  ,
ncvpgc  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
STRIDES  ,
V2IMAP  ,
CBUF  ,
PRCODE 
 

Definition at line 1110 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, nc_get_var1_double, nc_get_var1_float, nc_get_var1_int, nc_get_var1_long, nc_get_var1_schar, nc_get_var1_short, nc_inq_vartype, NC_INT, NC_SHORT, and ncerr.

01125 {
01126     int         status;
01127     nc_type     datatype;
01128 
01129     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
01130     {
01131         switch (datatype)
01132         {
01133         case NC_CHAR:
01134             status = NC_ECHAR;
01135             break;
01136         case NC_BYTE:
01137 #           if NF_INT1_IS_C_SIGNED_CHAR
01138                 status = nc_get_var1_schar(ncid, varid, indices,
01139                                            (signed char*)value);
01140 #           elif NF_INT1_IS_C_SHORT
01141                 status = nc_get_var1_short(ncid, varid, indices,
01142                                            (short*)value);
01143 #           elif NF_INT1_IS_C_INT
01144                 status = nc_get_var1_int(ncid, varid, indices,
01145                                            (int*)value);
01146 #           elif NF_INT1_IS_C_LONG
01147                 status = nc_get_var1_long(ncid, varid, indices,
01148                                            (long*)value);
01149 #           endif
01150             break;
01151         case NC_SHORT:
01152 #           if NF_INT2_IS_C_SHORT
01153                 status = nc_get_var1_short(ncid, varid, indices,
01154                                            (short*)value);
01155 #           elif NF_INT2_IS_C_INT
01156                 status = nc_get_var1_int(ncid, varid, indices,
01157                                            (int*)value);
01158 #           elif NF_INT2_IS_C_LONG
01159                 status = nc_get_var1_long(ncid, varid, indices,
01160                                            (long*)value);
01161 #           endif
01162             break;
01163         case NC_INT:
01164 #           if NF_INT_IS_C_INT
01165                 status = nc_get_var1_int(ncid, varid, indices,
01166                                            (int*)value);
01167 #           elif NF_INT_IS_C_LONG
01168                 status = nc_get_var1_long(ncid, varid, indices,
01169                                            (long*)value);
01170 #           endif
01171             break;
01172         case NC_FLOAT:
01173 #           if NF_REAL_IS_C_FLOAT
01174                 status = nc_get_var1_float(ncid, varid, indices,
01175                                            (float*)value);
01176 #           elif NF_REAL_IS_C_DOUBLE
01177                 status = nc_get_var1_double(ncid, varid, indices,
01178                                            (double*)value);
01179 #           endif
01180             break;
01181         case NC_DOUBLE:
01182 #           if NF_DOUBLEPRECISION_IS_C_FLOAT
01183                 status = nc_get_var1_float(ncid, varid, indices,
01184                                            (float*)value);
01185 #           elif NF_DOUBLEPRECISION_IS_C_DOUBLE
01186                 status = nc_get_var1_double(ncid, varid, indices,
01187                                            (double*)value);
01188 #           endif
01189             break;
01190         }
01191     }
01192 
01193     if (status == 0)
01194         *rcode = 0;
01195     else
01196     {
01197         nc_advise("NCVGT1", status, "");
01198         *rcode = ncerr;
01199     }
01200 }

FCALLSCSUB8 c_ncvptg  ,
NCVPTG  ,
ncvptg  ,
NCID  ,
VARID  ,
COORDS  ,
COUNTS  ,
STRIDES  ,
V2IMAP  ,
PVOID  ,
PRCODE 
 

Definition at line 1059 of file fort-v2compat.c.

References nc_advise(), NC_CHAR, NC_ECHAR, nc_inq_varndims, nc_inq_vartype, nc_put_varm_text, and ncerr.

01078 {
01079     int         status;
01080     int         rank;
01081     nc_type     datatype;
01082 
01083     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0 &&
01084         (status = nc_inq_varndims(ncid, varid, &rank)) == 0)
01085     {
01086         switch (datatype)
01087         {
01088         case NC_CHAR:
01089             status = nc_put_varm_text(ncid, varid, start, count,
01090                                        strides, imap,
01091                                        value);
01092             break;
01093         default:
01094             status = NC_ECHAR;
01095             break;
01096         }
01097     }
01098 
01099     if (status == 0)
01100         *rcode = 0;
01101     else
01102     {
01103         nc_advise("NCVPGC", status, "");
01104         *rcode = ncerr;
01105     }
01106 }

FCALLSCSUB8 c_ncvinq  ,
NCVINQ  ,
ncvinq  ,
NCID  ,
VARID  ,
PSTRING  ,
PTYPE  ,
PNDIMS  ,
PDIMIDS  ,
PNATTS  ,
PRCODE 
 

Definition at line 670 of file fort-v2compat.c.

References nc_advise(), NC_BYTE, NC_CHAR, NC_DOUBLE, NC_ECHAR, NC_FLOAT, nc_inq_vartype, NC_INT, nc_put_var1_double, nc_put_var1_float, nc_put_var1_int, nc_put_var1_long, nc_put_var1_schar, nc_put_var1_short, NC_SHORT, and ncerr.

00685 {
00686     int         status;
00687     nc_type     datatype;
00688 
00689     if ((status = nc_inq_vartype(ncid, varid, &datatype)) == 0)
00690     {
00691         switch (datatype)
00692         {
00693         case NC_CHAR:
00694             status = NC_ECHAR;
00695             break;
00696         case NC_BYTE:
00697 #           if NF_INT1_IS_C_SIGNED_CHAR
00698                 status = nc_put_var1_schar(ncid, varid, indices,
00699                                            (const signed char*)value);
00700 #           elif NF_INT1_IS_C_SHORT
00701                 status = nc_put_var1_short(ncid, varid, indices,
00702                                            (const short*)value);
00703 #           elif NF_INT1_IS_C_INT
00704                 status = nc_put_var1_int(ncid, varid, indices,
00705                                            (const int*)value);
00706 #           elif NF_INT1_IS_C_LONG
00707                 status = nc_put_var1_long(ncid, varid, indices,
00708                                            (const long*)value);
00709 #           endif
00710             break;
00711         case NC_SHORT:
00712 #           if NF_INT2_IS_C_SHORT
00713                 status = nc_put_var1_short(ncid, varid, indices,
00714                                            (const short*)value);
00715 #           elif NF_INT2_IS_C_INT
00716                 status = nc_put_var1_int(ncid, varid, indices,
00717                                            (const int*)value);
00718 #           elif NF_INT2_IS_C_LONG
00719                 status = nc_put_var1_long(ncid, varid, indices,
00720                                            (const long*)value);
00721 #           endif
00722             break;
00723         case NC_INT:
00724 #           if NF_INT_IS_C_INT
00725                 status = nc_put_var1_int(ncid, varid, indices,
00726                                            (const int*)value);
00727 #           elif NF_INT_IS_C_LONG
00728                 status = nc_put_var1_long(ncid, varid, indices,
00729                                            (const long*)value);
00730 #           endif
00731             break;
00732         case NC_FLOAT:
00733 #           if NF_REAL_IS_C_FLOAT
00734                 status = nc_put_var1_float(ncid, varid, indices,
00735                                            (const float*)value);
00736 #           elif NF_REAL_IS_C_DOUBLE
00737                 status = nc_put_var1_double(ncid, varid, indices,
00738                                            (const double*)value);
00739 #           endif
00740             break;
00741         case NC_DOUBLE:
00742 #           if NF_DOUBLEPRECISION_IS_C_FLOAT
00743                 status = nc_put_var1_float(ncid, varid, indices,
00744                                            (const float*)value);
00745 #           elif NF_DOUBLEPRECISION_IS_C_DOUBLE
00746                 status = nc_put_var1_double(ncid, varid, indices,
00747                                            (const double*)value);
00748 #           endif
00749             break;
00750         }
00751     }
00752 
00753     if (status == 0)
00754         *rcode = 0;
00755     else
00756     {
00757         nc_advise("NCVPT1", status, "");
00758         *rcode = ncerr;
00759     }
00760 }


Generated on Thu Mar 16 18:10:34 2006 for nco by  doxygen 1.4.4