From 8945e92708169a481b8ff82b0a621ab3c3fd5ac5 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 26 Sep 2011 10:14:55 +0000 Subject: [PATCH] fixed some missing config.h problems --- libsrc4/nc3stub.c | 34 +++---------------------- libsrc4/nc3stub.h | 29 --------------------- libsrc4/nc4dispatch.c | 1 + libsrc4/nc4dispatch.h | 1 + libsrc4/nc4var.c | 2 -- libsrc4/ncfunc.c | 2 -- libsrc4/stub4.c | 3 --- nc_test4/tst_diskless.c | 56 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 61 insertions(+), 67 deletions(-) diff --git a/libsrc4/nc3stub.c b/libsrc4/nc3stub.c index b660705df..6b7cf6dd9 100644 --- a/libsrc4/nc3stub.c +++ b/libsrc4/nc3stub.c @@ -1,39 +1,11 @@ /* - * Copyright 1993-1996 University Corporation for Atmospheric Research/Unidata + * Copyright 1993-2011 University Corporation for Atmospheric + * Research/Unidata * - * Portions of this software were developed by the Unidata Program at the - * University Corporation for Atmospheric Research. - * - * Access and use of this software shall impose the following obligations - * and understandings on the user. The user is granted the right, without - * any fee or cost, to use, copy, modify, alter, enhance and distribute - * this software, and any derivative works thereof, and its supporting - * documentation for any purpose whatsoever, provided that this entire - * notice appears in all copies of the software, derivative works and - * supporting documentation. Further, UCAR requests that the user credit - * UCAR/Unidata in any publications that result from the use of this - * software or in any product that includes this software. The names UCAR - * and/or Unidata, however, may not be used in any advertising or publicity - * to endorse or promote any products or commercial entity unless specific - * written permission is obtained from UCAR/Unidata. The user also - * understands that UCAR/Unidata is not obligated to provide the user with - * any support, consulting, training or assistance of any kind with regard - * to the use, operation and performance of this software nor to provide - * the user with any updates, revisions, new versions or "bug fixes." - * - * THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* "$Id: nc3stub.c,v 1.3 2010/05/26 18:11:10 dmh Exp $" */ -#include #include "config.h" +#include #include "nc.h" #ifndef MPI_INCLUDED diff --git a/libsrc4/nc3stub.h b/libsrc4/nc3stub.h index cd049374d..71c969813 100644 --- a/libsrc4/nc3stub.h +++ b/libsrc4/nc3stub.h @@ -1,36 +1,7 @@ /* * Copyright 1993-1996 University Corporation for Atmospheric Research/Unidata * - * Portions of this software were developed by the Unidata Program at the - * University Corporation for Atmospheric Research. - * - * Access and use of this software shall impose the following obligations - * and understandings on the user. The user is granted the right, without - * any fee or cost, to use, copy, modify, alter, enhance and distribute - * this software, and any derivative works thereof, and its supporting - * documentation for any purpose whatsoever, provided that this entire - * notice appears in all copies of the software, derivative works and - * supporting documentation. Further, UCAR requests that the user credit - * UCAR/Unidata in any publications that result from the use of this - * software or in any product that includes this software. The names UCAR - * and/or Unidata, however, may not be used in any advertising or publicity - * to endorse or promote any products or commercial entity unless specific - * written permission is obtained from UCAR/Unidata. The user also - * understands that UCAR/Unidata is not obligated to provide the user with - * any support, consulting, training or assistance of any kind with regard - * to the use, operation and performance of this software nor to provide - * the user with any updates, revisions, new versions or "bug fixes." - * - * THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* "$Id: nc3stub.h,v 1.2 2010/05/05 22:15:28 dmh Exp $" */ #ifndef _NC3STUB_H #define _NC3STUB_H diff --git a/libsrc4/nc4dispatch.c b/libsrc4/nc4dispatch.c index 3a0053f2b..ca316cba6 100755 --- a/libsrc4/nc4dispatch.c +++ b/libsrc4/nc4dispatch.c @@ -4,6 +4,7 @@ * $Header: /upc/share/CVS/netcdf-3/libsrc4/nc4dispatch.c,v 1.5 2010/05/27 02:19:37 dmh Exp $ *********************************************************************/ +#include "config.h" #include #include "nc.h" #include "ncdispatch.h" diff --git a/libsrc4/nc4dispatch.h b/libsrc4/nc4dispatch.h index 997150ac1..feea0aafe 100644 --- a/libsrc4/nc4dispatch.h +++ b/libsrc4/nc4dispatch.h @@ -9,6 +9,7 @@ #ifndef _NC4DISPATCH_H #define _NC4DISPATCH_H +#include "config.h" #include /* size_t, ptrdiff_t */ #include /* netcdf functions sometimes return system errors */ #include "ncdispatch.h" diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c index f399d8a86..076fc0d22 100644 --- a/libsrc4/nc4var.c +++ b/libsrc4/nc4var.c @@ -7,8 +7,6 @@ This file handles the nc4 variable functions. Copyright 2003-2006, University Corporation for Atmospheric Research. See COPYRIGHT file for copying and redistribution conditions. - -$Id: nc4var.c,v 1.148 2010/05/27 21:34:15 dmh Exp $ */ #include diff --git a/libsrc4/ncfunc.c b/libsrc4/ncfunc.c index b3c10262f..85ce74b8a 100755 --- a/libsrc4/ncfunc.c +++ b/libsrc4/ncfunc.c @@ -9,8 +9,6 @@ function, depending on ncid. Copyright 2003, University Corporation for Atmospheric Research. See netcdf-4/docs/COPYRIGHT file for copying and redistribution conditions. - -$Id: ncfunc.c,v 1.51 2010/05/26 20:13:32 dmh Exp $ */ #include "nc4internal.h" diff --git a/libsrc4/stub4.c b/libsrc4/stub4.c index 150f95520..17cb10f71 100644 --- a/libsrc4/stub4.c +++ b/libsrc4/stub4.c @@ -3,9 +3,6 @@ * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ -/* $Id: stub4.c,v 1.6 2010/05/24 19:48:17 dmh Exp $ */ -/* $Header: /upc/share/CVS/netcdf-3/libsrc4/stub4.c,v 1.6 2010/05/24 19:48:17 dmh Exp $ */ - #include "config.h" #include "netcdf.h" diff --git a/nc_test4/tst_diskless.c b/nc_test4/tst_diskless.c index 7411c7ef9..90a955dd5 100644 --- a/nc_test4/tst_diskless.c +++ b/nc_test4/tst_diskless.c @@ -159,5 +159,61 @@ main(int argc, char **argv) if (nc_close(ncid)) ERR; } SUMMARIZE_ERR; + printf("*** testing diskless file with scalar vars and type conversion..."); + { +#define DUNE "dune" +#define STAR_TREK "capacitor_value" +#define STAR_WARS "number_of_555_timer_chips" + + int ncid, varid0, varid1, varid2; + int ndims_in, nvars_in, natts_in, unlimdimid_in; + char name_in[NC_MAX_NAME + 1]; + nc_type type_in; + size_t len_in; + int i; + float float_data = 3.14, float_data_in; + int int_data = 42, int_data_in; + short short_data = 2, short_data_in; + + /* Create a netCDF file (which exists only in memory). */ + if (nc_create(FILE_NAME, NC_DISKLESS|NC_NETCDF4|NC_CLASSIC_MODEL, + &ncid)) ERR; + + /* Create some variables. */ + if (nc_def_var(ncid, DUNE, NC_INT, 0, NULL, &varid0)) ERR; + if (nc_def_var(ncid, STAR_TREK, NC_FLOAT, 0, NULL, &varid1)) ERR; + if (nc_def_var(ncid, STAR_WARS, NC_SHORT, 0, NULL, &varid2)) ERR; + + /* Write some data to this file. */ + if (nc_put_vara_int(ncid, varid0, NULL, NULL, &int_data)) ERR; + if (nc_put_vara_float(ncid, varid1, NULL, NULL, &float_data)) ERR; + if (nc_put_vara_short(ncid, varid2, NULL, NULL, &short_data)) ERR; + + /* Now check the phony file. */ + if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in)) ERR; + if (ndims_in != 0 || nvars_in != 3 || natts_in != 0 || unlimdimid_in != -1) ERR; + + /* Check variables. */ + if (nc_inq_var(ncid, varid0, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR; + if (strcmp(name_in, DUNE) || type_in != NC_INT || ndims_in != 0 || + natts_in != 0) ERR; + if (nc_inq_var(ncid, varid1, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR; + if (strcmp(name_in, STAR_TREK) || type_in != NC_FLOAT || ndims_in != 0 || + natts_in != 0) ERR; + if (nc_inq_var(ncid, varid2, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR; + if (strcmp(name_in, STAR_WARS) || type_in != NC_SHORT || natts_in != 0) ERR; + + /* Read my absolutely crucial data. */ + if (nc_get_vara_int(ncid, varid0, NULL, NULL, &int_data_in)) ERR; + if (int_data_in != int_data) ERR; + if (nc_get_vara_float(ncid, varid1, NULL, NULL, &float_data_in)) ERR; + if (float_data_in != float_data) ERR; + if (nc_get_vara_short(ncid, varid2, NULL, NULL, &short_data_in)) ERR; + if (short_data_in != short_data) ERR; + + /* Close the file. */ + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; FINAL_RESULTS; }