--- ./libsrc/ncx.m4.orig 2004-10-01 03:47:12.000000000 +0900 +++ ./libsrc/ncx.m4 2005-06-20 11:32:43.000000000 +0900 @@ -76,6 +76,7 @@ #undef LONG_MIN /* workaround cpp bug */ #define LONG_MIN -4294967295L #endif +#define LOOP_MAX 5 #endif /* _SX */ static const char nada[X_ALIGN] = {0, 0, 0, 0}; @@ -2346,10 +2347,96 @@ return ENOERR; } #else +# ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_getn_int_long(const void **xpp, size_t nelems, long *tp) +{ + const int *xp = (const int *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_INT != 0 || (long)tp%SIZEOF_LONG != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + tp[i] = (long) xp[i]; +# if IX_INT_MAX > LONG_MAX /* unlikely */ + if (xp[i] > LONG_MAX || xp[i] < LONG_MIN) status = NC_ERANGE; +# endif + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + tp[i] = (long) xp[i]; +# if IX_INT_MAX > LONG_MAX /* unlikely */ + if (xp[i] > LONG_MAX || xp[i] < LONG_MIN) status = NC_ERANGE; +# endif + } + } + + *xpp = (const void *)xp; + return status; +} +# else NCX_GETN(int, long) +# endif #endif +#ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_getn_int_float(const void **xpp, size_t nelems, float *tp) +{ + const int *xp = (const int *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_INT != 0 || (long)tp%SIZEOF_FLOAT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + tp[i] = (float) xp[i]; +# if 0 /* TODO: determine when necessary */ + if (xp[i] > FLT_MAX || xp[i] < (-FLT_MAX)) status = NC_ERANGE; +# endif + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + tp[i] = (float) xp[i]; +# if 0 /* TODO: determine when necessary */ + if (xp[i] > FLT_MAX || xp[i] < (-FLT_MAX)) status = NC_ERANGE; +# endif + } + } + + *xpp = (const void *)xp; + return status; +} + +int +ncx_getn_int_double(const void **xpp, size_t nelems, double *tp) +{ + const int *xp = (const int *) *xpp; + int i; + + if ((long)xp%SIZEOF_INT != 0 || (long)tp%SIZEOF_DOUBLE != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + tp[i] = (double) xp[i]; + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + tp[i] = (double) xp[i]; + } + } + + *xpp = (const void *)xp; + return ENOERR; +} +#else NCX_GETN(int, float) NCX_GETN(int, double) +#endif NCX_PUTN(int, schar) NCX_PUTN(int, uchar) @@ -2384,10 +2471,95 @@ return ENOERR; } #else +# ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_putn_int_long(void **xpp, size_t nelems, const long *tp) +{ + int *xp = (int *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_INT != 0 || (long)tp%SIZEOF_LONG != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + xp[i] = (int) tp[i]; +# if IX_INT_MAX < LONG_MAX + if(tp[i] > X_INT_MAX || tp[i] < X_INT_MIN) status = NC_ERANGE; +# endif + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + xp[i] = (int) tp[i]; +# if IX_INT_MAX < LONG_MAX + if(tp[i] > X_INT_MAX || tp[i] < X_INT_MIN) status = NC_ERANGE; +# endif + } + } + + *xpp = (void *)xp; + return status; +} +# else NCX_PUTN(int, long) +# endif #endif +#ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_putn_int_float(void **xpp, size_t nelems, const float *tp) +{ + int *xp = (int *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_INT != 0 || (long)tp%SIZEOF_FLOAT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + xp[i] = (int) tp[i]; + if(tp[i] > (double)X_INT_MAX || tp[i] < (double)X_INT_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + xp[i] = (int) tp[i]; + if(tp[i] > (double)X_INT_MAX || tp[i] < (double)X_INT_MIN) status = NC_ERANGE; + } + } + + *xpp = (void *)xp; + return status; +} + +int +ncx_putn_int_double(void **xpp, size_t nelems, const double *tp) +{ + int *xp = (int *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_INT != 0 || (long)tp%SIZEOF_DOUBLE != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + xp[i] = (int) tp[i]; + if(tp[i] > X_INT_MAX || tp[i] < X_INT_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + xp[i] = (int) tp[i]; + if(tp[i] > X_INT_MAX || tp[i] < X_INT_MIN) status = NC_ERANGE; + } + } + + *xpp = (void *)xp; + return status; +} +#else NCX_PUTN(int, float) NCX_PUTN(int, double) +#endif /* float */ @@ -2395,8 +2567,61 @@ NCX_GETN(float, schar) NCX_GETN(float, uchar) NCX_GETN(float, short) +#ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_getn_float_int(const void **xpp, size_t nelems, int *tp) +{ + const float *xp = (const float *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_FLOAT != 0 || (long)tp%SIZEOF_INT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + tp[i] = (int) xp[i]; + if(xp[i] > (double)INT_MAX || xp[i] < (double)INT_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + tp[i] = (int) xp[i]; + if(xp[i] > (double)INT_MAX || xp[i] < (double)INT_MIN) status = NC_ERANGE; + } + } + + *xpp = (const void *)xp; + return status; +} + +int +ncx_getn_float_long(const void **xpp, size_t nelems, long *tp) +{ + const float *xp = (const float *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_FLOAT != 0 || (long)tp%SIZEOF_LONG != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for (i = 0; i < (int) nelems; i++) { + tp[i] = (long) xp[i]; + if(xp[i] > LONG_MAX || xp[i] < LONG_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for (i = 0; i < (int) nelems; i++) { + tp[i] = (long) xp[i]; + if(xp[i] > LONG_MAX || xp[i] < LONG_MIN) status = NC_ERANGE; + } + } + + *xpp = (const void *)xp; + return status; +} +#else NCX_GETN(float, int) NCX_GETN(float, long) +#endif #if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT) /* optimized version */ int @@ -2455,13 +2680,97 @@ } #endif +#if _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_getn_float_double(const void **xpp, size_t nelems, double *tp) +{ + const float *xp = (const float *) *xpp; + int i; + + if ((long)xp%SIZEOF_FLOAT != 0 || (long)tp%SIZEOF_DOUBLE != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + tp[i] = (double) xp[i]; + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + tp[i] = (double) xp[i]; + } + } + + return ENOERR; +} +#else NCX_GETN(float, double) +#endif NCX_PUTN(float, schar) NCX_PUTN(float, uchar) NCX_PUTN(float, short) +#if _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_putn_float_int(void **xpp, size_t nelems, const int *tp) +{ + float *xp = (float *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_FLOAT != 0 || (long)tp%SIZEOF_INT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (float) tp[i]; +#if 1 /* TODO: figure this out */ + if((float)tp[i] > X_FLOAT_MAX || (float)tp[i] < X_FLOAT_MIN) status = NC_ERANGE; +#endif + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (float) tp[i]; +#if 1 /* TODO: figure this out */ + if((float)tp[i] > X_FLOAT_MAX || (float)tp[i] < X_FLOAT_MIN) status = NC_ERANGE; +#endif + } + } + + *xpp = (void *)xp; + return status; +} +int +ncx_putn_float_long(void **xpp, size_t nelems, const long *tp) +{ + float *xp = (float *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_FLOAT != 0 || (long)tp%SIZEOF_LONG != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (float) tp[i]; +#if 1 /* TODO: figure this out */ + if((float)tp[i] > X_FLOAT_MAX || (float)tp[i] < X_FLOAT_MIN) status = NC_ERANGE; +#endif + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (float) tp[i]; +#if 1 /* TODO: figure this out */ + if((float)tp[i] > X_FLOAT_MAX || (float)tp[i] < X_FLOAT_MIN) status = NC_ERANGE; +#endif + } + } + + *xpp = (void *)xp; + return status; +} +#else NCX_PUTN(float, int) NCX_PUTN(float, long) +#endif #if X_SIZEOF_FLOAT == SIZEOF_FLOAT && !defined(NO_IEEE_FLOAT) /* optimized version */ int @@ -2520,7 +2829,35 @@ } #endif +#ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_putn_float_double(void **xpp, size_t nelems, const double *tp) +{ + float *xp = *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_FLOAT != 0 || (long)tp%SIZEOF_DOUBLE != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (float) tp[i]; + if (tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (float) tp[i]; + if (tp[i] > X_FLOAT_MAX || tp[i] < X_FLOAT_MIN) status = NC_ERANGE; + } + } + + *xpp = (void *)xp; + return status; +} +#else NCX_PUTN(float, double) +#endif /* double */ @@ -2528,9 +2865,98 @@ NCX_GETN(double, schar) NCX_GETN(double, uchar) NCX_GETN(double, short) +#ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_getn_double_int(const void **xpp, size_t nelems, int *tp) +{ + const double *xp = (const double *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_DOUBLE != 0 || (long)tp%SIZEOF_INT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + tp[i] = (int) xp[i]; + if(xp[i] > INT_MAX || xp[i] < INT_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + tp[i] = (int) xp[i]; + if(xp[i] > INT_MAX || xp[i] < INT_MIN) status = NC_ERANGE; + } + } + + *xpp = (void *)xp; + return status; +} + +int +ncx_getn_double_long(const void **xpp, size_t nelems, long *tp) +{ + const double *xp = (const double *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_DOUBLE != 0 || (long)tp%SIZEOF_LONG != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + tp[i] = (long) xp[i]; + if(xp[i] > LONG_MAX || xp[i] < LONG_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + tp[i] = (long) xp[i]; + if(xp[i] > LONG_MAX || xp[i] < LONG_MIN) status = NC_ERANGE; + } + } + *xpp = (void *)xp; + return status; +} + +int +ncx_getn_double_float(const void **xpp, size_t nelems, float *tp) +{ + const double *xp = (const double *) *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_DOUBLE != 0 || (long)tp%SIZEOF_FLOAT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + if (xp[i] > FLT_MAX || xp[i] < (-FLT_MAX)) { + tp[i] = FLT_MAX; + status = NC_ERANGE; + } else if (xp[i] < (-FLT_MAX)) { + tp[i] = (-FLT_MAX); + status = NC_ERANGE; + } else + tp[i] = (float) xp[i]; + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + if (xp[i] > FLT_MAX || xp[i] < (-FLT_MAX)) { + tp[i] = FLT_MAX; + status = NC_ERANGE; + } else if (xp[i] < (-FLT_MAX)) { + tp[i] = (-FLT_MAX); + status = NC_ERANGE; + } else + tp[i] = (float) xp[i]; + } + } + + *xpp = (void *)xp; + return status; +} +#else NCX_GETN(double, int) NCX_GETN(double, long) NCX_GETN(double, float) +#endif dnl NCX_GETN(double, double) #if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT) /* optimized version */ @@ -2594,9 +3020,95 @@ NCX_PUTN(double, schar) NCX_PUTN(double, uchar) NCX_PUTN(double, short) +#ifdef _SX +/* optimized version for NEC SX-5,6,7,8, or ES by T.Kagimoto (2005/04/12) */ +int +ncx_putn_double_int(void **xpp, size_t nelems, const int *tp) +{ + double *xp = *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_DOUBLE != 0 || (long)tp%SIZEOF_INT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (double) tp[i]; +#if 0 /* TODO: figure this out */ + if((double)tp[i] > X_DOUBLE_MAX || (double)tp[i] < X_DOUBLE_MIN) status = NC_ERANGE; +#endif + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (double) tp[i]; +#if 0 /* TODO: figure this out */ + if((double)tp[i] > X_DOUBLE_MAX || (double)tp[i] < X_DOUBLE_MIN) status = NC_ERANGE; +#endif + } + } + + *xpp = (void *)xp; + return status; +} + +int +ncx_putn_double_long(void **xpp, size_t nelems, const long *tp) +{ + double *xp = *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_DOUBLE != 0 || (long)tp%SIZEOF_LONG != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (double) tp[i]; +#if 1 /* TODO: figure this out */ + if((double)tp[i] > X_DOUBLE_MAX || (double)tp[i] < X_DOUBLE_MIN) status = NC_ERANGE; +#endif + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (double) tp[i]; +#if 1 /* TODO: figure this out */ + if((double)tp[i] > X_DOUBLE_MAX || (double)tp[i] < X_DOUBLE_MIN) status = NC_ERANGE; +#endif + } + } + + *xpp = (void *)xp; + return status; +} + +int +ncx_putn_double_float(void **xpp, size_t nelems, const float *tp) +{ + double *xp = *xpp; + int i; + int status = ENOERR; + + if ((long)xp%SIZEOF_DOUBLE != 0 || (long)tp%SIZEOF_FLOAT != 0 || nelems < LOOP_MAX) { +#pragma vdir novector + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (double) tp[i]; + if ((double)tp[i] > X_DOUBLE_MAX || (double)tp[i] < X_DOUBLE_MIN) status = NC_ERANGE; + } + } else { +#pragma vdir nodep + for(i = 0 ; i < (int) nelems ; i++ ) { + xp[i] = (double) tp[i]; + if ((double)tp[i] > X_DOUBLE_MAX || (double)tp[i] < X_DOUBLE_MIN) status = NC_ERANGE; + } + } + + *xpp = (void *)xp; + return status; +} +#else NCX_PUTN(double, int) NCX_PUTN(double, long) NCX_PUTN(double, float) +#endif dnl NCX_PUTN(double, double) #if X_SIZEOF_DOUBLE == SIZEOF_DOUBLE && !defined(NO_IEEE_FLOAT) /* optimized version */ --- ./f90/Makefile.orig 2004-12-19 03:08:01.000000000 +0900 +++ ./f90/Makefile 2005-06-20 11:32:43.000000000 +0900 @@ -15,27 +15,27 @@ example_good.cdl \ gen.m4 \ netcdf.3f90 \ - netcdf.f90 \ + netcdf.F90 \ netcdf_attributes.f90 \ netcdf_constants.f90 \ netcdf_dims.f90 \ netcdf_expanded.f90 \ netcdf_externals.f90 \ netcdf_file.f90 \ - netcdf_overloads.f90 \ + netcdf_overloads.F90 \ netcdf_test.f90 \ netcdf_text_variables.f90 \ netcdf_variables.f90 \ netcdf_visibility.f90 \ nvea.m4 nveaput48.m4 nveaget48.m4\ nves.m4 nvesput48.m4 nvesget48.m4 \ - typeSizes.f90 install-sh + typeSizes.F90 install-sh all: $(LIBRARY) test: netcdf_test ./netcdf_test - @$(NCDUMP) example.nc >example.cdl; \ + -@$(NCDUMP) example.nc >example.cdl; \ if cmp example_good.cdl example.cdl; then \ echo '*** Success ***'; \ else \ @@ -44,7 +44,8 @@ fi netcdf_test: netcdf_test.f90 netcdf.o typeSizes.o - $(LINK.F90) netcdf_test.f90 netcdf.o typeSizes.o $(LIBRARY) $(F90LIBS) + $(COMPILE.F90) netcdf_test.f90 + $(LINK.F90) $@.o netcdf.o typeSizes.o $(LIBRARY) $(F90LIBS) testEightByteGet: testEightByteGet.o typeSizes.o $(LIBRARY) $(LINK.F90) $@.o $(F90LIBS) typeSizes.o $(LIBRARY) @@ -55,19 +56,22 @@ EightByteIntTest-2: EightByteIntTest-2.o typeSizes.o $(LINK.F90) $@.o typeSizes.o $(F90LIBS) -typeSizes.o: typeSizes.f90 - $(COMPILE.F90) typeSizes.f90 +netcdf_overloads.o: netcdf_overloads.F90 + $(COMPILE.F90) netcdf_overloads.F90 + +typeSizes.o: typeSizes.F90 + $(COMPILE.F90) typeSizes.F90 netcdf_expanded.f90: gen.m4 f90aux.m4 nves.m4 nvea.m4 \ nvesput48.m4 nvesget48.m4 nveaput48.m4 nveaget48.m4 $(M4) gen.m4 >$@ netcdf.o: \ - netcdf.f90 typeSizes.o netcdf_constants.f90 netcdf_externals.f90 \ - netcdf_overloads.f90 netcdf_visibility.f90 netcdf_file.f90 \ + netcdf.F90 typeSizes.o netcdf_constants.f90 netcdf_externals.f90 \ + netcdf_overloads.F90 netcdf_visibility.f90 netcdf_file.f90 \ netcdf_dims.f90 netcdf_attributes.f90 netcdf_variables.f90 \ netcdf_text_variables.f90 netcdf_expanded.f90 - $(COMPILE.F90) netcdf.f90 + $(COMPILE.F90) netcdf.F90 install: installed_netcdf_module installed_typesizes_module \ $(MANDIR)/man3f90/$(MANUAL) --- ./f90/netcdf.f90.orig 2001-05-25 06:45:20.000000000 +0900 +++ /dev/null 2002-08-31 08:31:37.000000000 +0900 @@ -1,53 +0,0 @@ -! Description: -! -! Input Parameters: -! None. -! -! Output Parameters: -! Many public constants are defined in "netcdf_constants.f90". The names follow -! the Fortran 77 names, with nf90_ used as a prefix instead of nf_77. -! Functions are made accessable through PUBLIC:: statements in "netcdf_visibility.f90". -! Only the functions listed in this file are available in the interface. -! -! References and Credits: -! Written by -! Robert Pincus -! Cooperative Institue for Meteorological Satellite Studies -! University of Wisconsin - Madison -! 1225 W. Dayton St. -! Madison, Wisconsin 53706 -! Robert.Pincus@ssec.wisc.edu -! -! Design Notes: -! Module elements are private by default. -! Many functions have optional arguments. In order to keep the interface easy to use, -! we've reordered the arguments (relative to the F77 interface) in some functions. -! The external datatype of attributes is the same as the internal type. -! By default, data is read from or put into the lowest part of the netCDF array with stride 1. -! We've made heavy use of overloading, especially in the variable put and get routines. -! A single function exists for putting all variables; a single function exists for getting -! variables. -! Text variables must be treated somewhat differently. When a character variable is defined, the -! fastest-varying index (first index in Fortran) must be the maxiumu length of the character -! string. N dimensional arrays of strings passed to the put or get functions are written/read -! from dimensions 2:N+1. The number of values along the first dimension is determined by the -! length of the argument character string. -! - module netcdf - use typeSizes, only: OneByteInt, TwoByteInt, FourByteInt, EightByteInt, & - FourByteReal, EightByteReal - implicit none - private - - include "netcdf_constants.f90" - include "netcdf_externals.f90" - include "netcdf_overloads.f90" - include "netcdf_visibility.f90" -contains - include "netcdf_file.f90" - include "netcdf_dims.f90" - include "netcdf_attributes.f90" - include "netcdf_variables.f90" - include "netcdf_text_variables.f90" - include "netcdf_expanded.f90" -end module netcdf --- ./f90/netcdf_overloads.f90.orig 2001-05-25 06:45:22.000000000 +0900 +++ /dev/null 2002-08-31 08:31:37.000000000 +0900 @@ -1,95 +0,0 @@ - ! Overloaded variable functions - interface nf90_def_var - module procedure nf90_def_var_Scalar, nf90_def_var_oneDim, nf90_def_var_ManyDims - end interface ! nf90_def_var - - ! Overloaded attribute functions - interface nf90_put_att - module procedure nf90_put_att_text, & - nf90_put_att_OneByteInt, nf90_put_att_TwoByteInt, & - nf90_put_att_FourByteInt, nf90_put_att_EightByteInt, & - nf90_put_att_FourByteReal, nf90_put_att_EightByteReal - module procedure nf90_put_att_one_OneByteInt, nf90_put_att_one_TwoByteInt, & - nf90_put_att_one_FourByteInt, nf90_put_att_one_EightByteInt, & - nf90_put_att_one_FourByteReal, nf90_put_att_one_EightByteReal - end interface !nf90_put_att - interface nf90_get_att - module procedure nf90_get_att_text, & - nf90_get_att_OneByteInt, nf90_get_att_TwoByteInt, & - nf90_get_att_FourByteInt, nf90_get_att_EightByteInt, & - nf90_get_att_FourByteReal, nf90_get_att_EightByteReal - module procedure nf90_get_att_one_OneByteInt, nf90_get_att_one_TwoByteInt, & - nf90_get_att_one_FourByteInt, nf90_get_att_one_EightByteInt, & - nf90_get_att_one_FourByteReal, nf90_get_att_one_EightByteReal - end interface ! nf90_get_att - - ! Overloaded variable functions - interface nf90_put_var - module procedure nf90_put_var_text, & - nf90_put_var_OneByteInt, nf90_put_var_TwoByteInt, & - nf90_put_var_FourByteInt, nf90_put_var_EightByteInt, & - nf90_put_var_FourByteReal, nf90_put_var_EightByteReal - module procedure nf90_put_var_1D_text, & - nf90_put_var_1D_OneByteInt, nf90_put_var_1D_TwoByteInt, & - nf90_put_var_1D_FourByteInt, nf90_put_var_1D_EightByteInt, & - nf90_put_var_1D_FourByteReal, nf90_put_var_1D_EightByteReal - module procedure nf90_put_var_2D_text, & - nf90_put_var_2D_OneByteInt, nf90_put_var_2D_TwoByteInt, & - nf90_put_var_2D_FourByteInt, nf90_put_var_2D_EightByteInt, & - nf90_put_var_2D_FourByteReal, nf90_put_var_2D_EightByteReal - module procedure nf90_put_var_3D_text, & - nf90_put_var_3D_OneByteInt, nf90_put_var_3D_TwoByteInt, & - nf90_put_var_3D_FourByteInt, nf90_put_var_3D_EightByteInt, & - nf90_put_var_3D_FourByteReal, nf90_put_var_3D_EightByteReal - module procedure nf90_put_var_4D_text, & - nf90_put_var_4D_OneByteInt, nf90_put_var_4D_TwoByteInt, & - nf90_put_var_4D_FourByteInt, nf90_put_var_4D_EightByteInt, & - nf90_put_var_4D_FourByteReal, nf90_put_var_4D_EightByteReal - module procedure nf90_put_var_5D_text, & - nf90_put_var_5D_OneByteInt, nf90_put_var_5D_TwoByteInt, & - nf90_put_var_5D_FourByteInt, nf90_put_var_5D_EightByteInt, & - nf90_put_var_5D_FourByteReal, nf90_put_var_5D_EightByteReal - module procedure nf90_put_var_6D_text, & - nf90_put_var_6D_OneByteInt, nf90_put_var_6D_TwoByteInt, & - nf90_put_var_6D_FourByteInt, nf90_put_var_6D_EightByteInt, & - nf90_put_var_6D_FourByteReal, nf90_put_var_6D_EightByteReal - module procedure nf90_put_var_7D_text, & - nf90_put_var_7D_OneByteInt, nf90_put_var_7D_TwoByteInt, & - nf90_put_var_7D_FourByteInt, nf90_put_var_7D_EightByteInt, & - nf90_put_var_7D_FourByteReal, nf90_put_var_7D_EightByteReal - end interface ! nf90_put_var - - interface nf90_get_var - module procedure nf90_get_var_text, & - nf90_get_var_OneByteInt, nf90_get_var_TwoByteInt, & - nf90_get_var_FourByteInt, nf90_get_var_EightByteInt, & - nf90_get_var_FourByteReal, nf90_get_var_EightByteReal - module procedure nf90_get_var_1D_text, & - nf90_get_var_1D_OneByteInt, nf90_get_var_1D_TwoByteInt, & - nf90_get_var_1D_FourByteInt, nf90_get_var_1D_EightByteInt, & - nf90_get_var_1D_FourByteReal, nf90_get_var_1D_EightByteReal - module procedure nf90_get_var_2D_text, & - nf90_get_var_2D_OneByteInt, nf90_get_var_2D_TwoByteInt, & - nf90_get_var_2D_FourByteInt, nf90_get_var_2D_EightByteInt, & - nf90_get_var_2D_FourByteReal, nf90_get_var_2D_EightByteReal - module procedure nf90_get_var_3D_text, & - nf90_get_var_3D_OneByteInt, nf90_get_var_3D_TwoByteInt, & - nf90_get_var_3D_FourByteInt, nf90_get_var_3D_EightByteInt, & - nf90_get_var_3D_FourByteReal, nf90_get_var_3D_EightByteReal - module procedure nf90_get_var_4D_text, & - nf90_get_var_4D_OneByteInt, nf90_get_var_4D_TwoByteInt, & - nf90_get_var_4D_FourByteInt, nf90_get_var_4D_EightByteInt, & - nf90_get_var_4D_FourByteReal, nf90_get_var_4D_EightByteReal - module procedure nf90_get_var_5D_text, & - nf90_get_var_5D_OneByteInt, nf90_get_var_5D_TwoByteInt, & - nf90_get_var_5D_FourByteInt, nf90_get_var_5D_EightByteInt, & - nf90_get_var_5D_FourByteReal, nf90_get_var_5D_EightByteReal - module procedure nf90_get_var_6D_text, & - nf90_get_var_6D_OneByteInt, nf90_get_var_6D_TwoByteInt, & - nf90_get_var_6D_FourByteInt, nf90_get_var_6D_EightByteInt, & - nf90_get_var_6D_FourByteReal, nf90_get_var_6D_EightByteReal - module procedure nf90_get_var_7D_text, & - nf90_get_var_7D_OneByteInt, nf90_get_var_7D_TwoByteInt, & - nf90_get_var_7D_FourByteInt, nf90_get_var_7D_EightByteInt, & - nf90_get_var_7D_FourByteReal, nf90_get_var_7D_EightByteReal - end interface ! nf90_get_var --- ./f90/typeSizes.f90.orig 2000-10-24 07:07:06.000000000 +0900 +++ /dev/null 2002-08-31 08:31:37.000000000 +0900 @@ -1,64 +0,0 @@ -! Description: -! Provide named kind parameters for use in declarations of real and integer -! variables with specific byte sizes (i.e. one, two, four, and eight byte -! integers; four and eight byte reals). The parameters can then be used -! in (KIND = XX) modifiers in declarations. -! A single function (byteSizesOK()) is provided to ensure that the selected -! kind parameters are correct. -! -! Input Parameters: -! None. -! -! Output Parameters: -! Public parameters, fixed at compile time: -! OneByteInt, TwoByteInt, FourByteInt, EightByteInt -! FourByteReal, EightByteRadl -! -! References and Credits: -! Written by -! Robert Pincus -! Cooperative Institue for Meteorological Satellite Studies -! University of Wisconsin - Madison -! 1225 W. Dayton St. -! Madison, Wisconsin 53706 -! Robert.Pincus@ssec.wisc.edu -! -! Design Notes: -! Fortran 90 doesn't allow one to check the number of bytes in a real variable; -! we check only that four byte and eight byte reals have different kind parameters. -! -module typeSizes - implicit none - public - integer, parameter :: OneByteInt = selected_int_kind(2), & - TwoByteInt = selected_int_kind(4), & - FourByteInt = selected_int_kind(9), & - EightByteInt = selected_int_kind(18) - - integer, parameter :: & - FourByteReal = selected_real_kind(P = 6, R = 37), & - EightByteReal = selected_real_kind(P = 13, R = 307) -contains - logical function byteSizesOK() - ! Users may call this function once to ensure that the kind parameters - ! the module defines are available with the current compiler. - ! We can't ensure that the two REAL kinds are actually four and - ! eight bytes long, but we can ensure that they are distinct. - ! Early Fortran 90 compilers would sometimes report incorrect results for - ! the bit_size intrinsic, but I haven't seen this in a long time. - - ! Local variables - integer (kind = OneByteInt) :: One - integer (kind = TwoByteInt) :: Two - integer (kind = FourByteInt) :: Four - - if (bit_size( One) == 8 .and. bit_size( Two) == 16 .and. & - bit_size(Four) == 32 .and. & - FourByteReal > 0 .and. EightByteReal > 0 .and. & - FourByteReal /= EightByteReal) then - byteSizesOK = .true. - else - byteSizesOK = .false. - end if - end function byteSizesOK -end module typeSizes --- /dev/null 2002-08-31 08:31:37.000000000 +0900 +++ ./f90/netcdf.F90 2005-06-20 11:32:43.000000000 +0900 @@ -0,0 +1,53 @@ +! Description: +! +! Input Parameters: +! None. +! +! Output Parameters: +! Many public constants are defined in "netcdf_constants.f90". The names follow +! the Fortran 77 names, with nf90_ used as a prefix instead of nf_77. +! Functions are made accessable through PUBLIC:: statements in "netcdf_visibility.f90". +! Only the functions listed in this file are available in the interface. +! +! References and Credits: +! Written by +! Robert Pincus +! Cooperative Institue for Meteorological Satellite Studies +! University of Wisconsin - Madison +! 1225 W. Dayton St. +! Madison, Wisconsin 53706 +! Robert.Pincus@ssec.wisc.edu +! +! Design Notes: +! Module elements are private by default. +! Many functions have optional arguments. In order to keep the interface easy to use, +! we've reordered the arguments (relative to the F77 interface) in some functions. +! The external datatype of attributes is the same as the internal type. +! By default, data is read from or put into the lowest part of the netCDF array with stride 1. +! We've made heavy use of overloading, especially in the variable put and get routines. +! A single function exists for putting all variables; a single function exists for getting +! variables. +! Text variables must be treated somewhat differently. When a character variable is defined, the +! fastest-varying index (first index in Fortran) must be the maxiumu length of the character +! string. N dimensional arrays of strings passed to the put or get functions are written/read +! from dimensions 2:N+1. The number of values along the first dimension is determined by the +! length of the argument character string. +! + module netcdf + use typeSizes, only: OneByteInt, TwoByteInt, FourByteInt, EightByteInt, & + FourByteReal, EightByteReal + implicit none + private + + include "netcdf_constants.f90" + include "netcdf_externals.f90" +# include "netcdf_overloads.F90" + include "netcdf_visibility.f90" +contains + include "netcdf_file.f90" + include "netcdf_dims.f90" + include "netcdf_attributes.f90" + include "netcdf_variables.f90" + include "netcdf_text_variables.f90" + include "netcdf_expanded.f90" +end module netcdf --- /dev/null 2002-08-31 08:31:37.000000000 +0900 +++ ./f90/netcdf_overloads.F90 2005-06-20 11:32:43.000000000 +0900 @@ -0,0 +1,175 @@ +#ifdef __SX__ + ! Overloaded variable functions + interface nf90_def_var + module procedure nf90_def_var_Scalar, nf90_def_var_oneDim, nf90_def_var_ManyDims + end interface ! nf90_def_var + + ! Overloaded attribute functions + interface nf90_put_att + module procedure nf90_put_att_text, nf90_put_att_TwoByteInt, & + nf90_put_att_FourByteInt, nf90_put_att_EightByteInt, & + nf90_put_att_FourByteReal, nf90_put_att_EightByteReal + module procedure nf90_put_att_one_TwoByteInt, & + nf90_put_att_one_FourByteInt, nf90_put_att_one_EightByteInt, & + nf90_put_att_one_FourByteReal, nf90_put_att_one_EightByteReal + end interface !nf90_put_att + interface nf90_get_att + module procedure nf90_get_att_text, nf90_get_att_TwoByteInt, & + nf90_get_att_FourByteInt, nf90_get_att_EightByteInt, & + nf90_get_att_FourByteReal, nf90_get_att_EightByteReal + module procedure nf90_get_att_one_TwoByteInt, & + nf90_get_att_one_FourByteInt, nf90_get_att_one_EightByteInt, & + nf90_get_att_one_FourByteReal, nf90_get_att_one_EightByteReal + end interface ! nf90_get_att + + ! Overloaded variable functions + interface nf90_put_var + module procedure nf90_put_var_text, nf90_put_var_TwoByteInt, & + nf90_put_var_FourByteInt, nf90_put_var_EightByteInt, & + nf90_put_var_FourByteReal, nf90_put_var_EightByteReal + module procedure nf90_put_var_1D_text, nf90_put_var_1D_TwoByteInt, & + nf90_put_var_1D_FourByteInt, nf90_put_var_1D_EightByteInt, & + nf90_put_var_1D_FourByteReal, nf90_put_var_1D_EightByteReal + module procedure nf90_put_var_2D_text, nf90_put_var_2D_TwoByteInt, & + nf90_put_var_2D_FourByteInt, nf90_put_var_2D_EightByteInt, & + nf90_put_var_2D_FourByteReal, nf90_put_var_2D_EightByteReal + module procedure nf90_put_var_3D_text, nf90_put_var_3D_TwoByteInt, & + nf90_put_var_3D_FourByteInt, nf90_put_var_3D_EightByteInt, & + nf90_put_var_3D_FourByteReal, nf90_put_var_3D_EightByteReal + module procedure nf90_put_var_4D_text, nf90_put_var_4D_TwoByteInt, & + nf90_put_var_4D_FourByteInt, nf90_put_var_4D_EightByteInt, & + nf90_put_var_4D_FourByteReal, nf90_put_var_4D_EightByteReal + module procedure nf90_put_var_5D_text, nf90_put_var_5D_TwoByteInt, & + nf90_put_var_5D_FourByteInt, nf90_put_var_5D_EightByteInt, & + nf90_put_var_5D_FourByteReal, nf90_put_var_5D_EightByteReal + module procedure nf90_put_var_6D_text, nf90_put_var_6D_TwoByteInt, & + nf90_put_var_6D_FourByteInt, nf90_put_var_6D_EightByteInt, & + nf90_put_var_6D_FourByteReal, nf90_put_var_6D_EightByteReal + module procedure nf90_put_var_7D_text, nf90_put_var_7D_TwoByteInt, & + nf90_put_var_7D_FourByteInt, nf90_put_var_7D_EightByteInt, & + nf90_put_var_7D_FourByteReal, nf90_put_var_7D_EightByteReal + end interface ! nf90_put_var + + interface nf90_get_var + module procedure nf90_get_var_text, nf90_get_var_TwoByteInt, & + nf90_get_var_FourByteInt, nf90_get_var_EightByteInt, & + nf90_get_var_FourByteReal, nf90_get_var_EightByteReal + module procedure nf90_get_var_1D_text, nf90_get_var_1D_TwoByteInt, & + nf90_get_var_1D_FourByteInt, nf90_get_var_1D_EightByteInt, & + nf90_get_var_1D_FourByteReal, nf90_get_var_1D_EightByteReal + module procedure nf90_get_var_2D_text, nf90_get_var_2D_TwoByteInt, & + nf90_get_var_2D_FourByteInt, nf90_get_var_2D_EightByteInt, & + nf90_get_var_2D_FourByteReal, nf90_get_var_2D_EightByteReal + module procedure nf90_get_var_3D_text, nf90_get_var_3D_TwoByteInt, & + nf90_get_var_3D_FourByteInt, nf90_get_var_3D_EightByteInt, & + nf90_get_var_3D_FourByteReal, nf90_get_var_3D_EightByteReal + module procedure nf90_get_var_4D_text, nf90_get_var_4D_TwoByteInt, & + nf90_get_var_4D_FourByteInt, nf90_get_var_4D_EightByteInt, & + nf90_get_var_4D_FourByteReal, nf90_get_var_4D_EightByteReal + module procedure nf90_get_var_5D_text, nf90_get_var_5D_TwoByteInt, & + nf90_get_var_5D_FourByteInt, nf90_get_var_5D_EightByteInt, & + nf90_get_var_5D_FourByteReal, nf90_get_var_5D_EightByteReal + module procedure nf90_get_var_6D_text, nf90_get_var_6D_TwoByteInt, & + nf90_get_var_6D_FourByteInt, nf90_get_var_6D_EightByteInt, & + nf90_get_var_6D_FourByteReal, nf90_get_var_6D_EightByteReal + module procedure nf90_get_var_7D_text, nf90_get_var_7D_TwoByteInt, & + nf90_get_var_7D_FourByteInt, nf90_get_var_7D_EightByteInt, & + nf90_get_var_7D_FourByteReal, nf90_get_var_7D_EightByteReal + end interface ! nf90_get_var +#else + ! Overloaded variable functions + interface nf90_def_var + module procedure nf90_def_var_Scalar, nf90_def_var_oneDim, nf90_def_var_ManyDims + end interface ! nf90_def_var + + ! Overloaded attribute functions + interface nf90_put_att + module procedure nf90_put_att_text, & + nf90_put_att_OneByteInt, nf90_put_att_TwoByteInt, & + nf90_put_att_FourByteInt, nf90_put_att_EightByteInt, & + nf90_put_att_FourByteReal, nf90_put_att_EightByteReal + module procedure nf90_put_att_one_OneByteInt, nf90_put_att_one_TwoByteInt, & + nf90_put_att_one_FourByteInt, nf90_put_att_one_EightByteInt, & + nf90_put_att_one_FourByteReal, nf90_put_att_one_EightByteReal + end interface !nf90_put_att + interface nf90_get_att + module procedure nf90_get_att_text, & + nf90_get_att_OneByteInt, nf90_get_att_TwoByteInt, & + nf90_get_att_FourByteInt, nf90_get_att_EightByteInt, & + nf90_get_att_FourByteReal, nf90_get_att_EightByteReal + module procedure nf90_get_att_one_OneByteInt, nf90_get_att_one_TwoByteInt, & + nf90_get_att_one_FourByteInt, nf90_get_att_one_EightByteInt, & + nf90_get_att_one_FourByteReal, nf90_get_att_one_EightByteReal + end interface ! nf90_get_att + + ! Overloaded variable functions + interface nf90_put_var + module procedure nf90_put_var_text, & + nf90_put_var_OneByteInt, nf90_put_var_TwoByteInt, & + nf90_put_var_FourByteInt, nf90_put_var_EightByteInt, & + nf90_put_var_FourByteReal, nf90_put_var_EightByteReal + module procedure nf90_put_var_1D_text, & + nf90_put_var_1D_OneByteInt, nf90_put_var_1D_TwoByteInt, & + nf90_put_var_1D_FourByteInt, nf90_put_var_1D_EightByteInt, & + nf90_put_var_1D_FourByteReal, nf90_put_var_1D_EightByteReal + module procedure nf90_put_var_2D_text, & + nf90_put_var_2D_OneByteInt, nf90_put_var_2D_TwoByteInt, & + nf90_put_var_2D_FourByteInt, nf90_put_var_2D_EightByteInt, & + nf90_put_var_2D_FourByteReal, nf90_put_var_2D_EightByteReal + module procedure nf90_put_var_3D_text, & + nf90_put_var_3D_OneByteInt, nf90_put_var_3D_TwoByteInt, & + nf90_put_var_3D_FourByteInt, nf90_put_var_3D_EightByteInt, & + nf90_put_var_3D_FourByteReal, nf90_put_var_3D_EightByteReal + module procedure nf90_put_var_4D_text, & + nf90_put_var_4D_OneByteInt, nf90_put_var_4D_TwoByteInt, & + nf90_put_var_4D_FourByteInt, nf90_put_var_4D_EightByteInt, & + nf90_put_var_4D_FourByteReal, nf90_put_var_4D_EightByteReal + module procedure nf90_put_var_5D_text, & + nf90_put_var_5D_OneByteInt, nf90_put_var_5D_TwoByteInt, & + nf90_put_var_5D_FourByteInt, nf90_put_var_5D_EightByteInt, & + nf90_put_var_5D_FourByteReal, nf90_put_var_5D_EightByteReal + module procedure nf90_put_var_6D_text, & + nf90_put_var_6D_OneByteInt, nf90_put_var_6D_TwoByteInt, & + nf90_put_var_6D_FourByteInt, nf90_put_var_6D_EightByteInt, & + nf90_put_var_6D_FourByteReal, nf90_put_var_6D_EightByteReal + module procedure nf90_put_var_7D_text, & + nf90_put_var_7D_OneByteInt, nf90_put_var_7D_TwoByteInt, & + nf90_put_var_7D_FourByteInt, nf90_put_var_7D_EightByteInt, & + nf90_put_var_7D_FourByteReal, nf90_put_var_7D_EightByteReal + end interface ! nf90_put_var + + interface nf90_get_var + module procedure nf90_get_var_text, & + nf90_get_var_OneByteInt, nf90_get_var_TwoByteInt, & + nf90_get_var_FourByteInt, nf90_get_var_EightByteInt, & + nf90_get_var_FourByteReal, nf90_get_var_EightByteReal + module procedure nf90_get_var_1D_text, & + nf90_get_var_1D_OneByteInt, nf90_get_var_1D_TwoByteInt, & + nf90_get_var_1D_FourByteInt, nf90_get_var_1D_EightByteInt, & + nf90_get_var_1D_FourByteReal, nf90_get_var_1D_EightByteReal + module procedure nf90_get_var_2D_text, & + nf90_get_var_2D_OneByteInt, nf90_get_var_2D_TwoByteInt, & + nf90_get_var_2D_FourByteInt, nf90_get_var_2D_EightByteInt, & + nf90_get_var_2D_FourByteReal, nf90_get_var_2D_EightByteReal + module procedure nf90_get_var_3D_text, & + nf90_get_var_3D_OneByteInt, nf90_get_var_3D_TwoByteInt, & + nf90_get_var_3D_FourByteInt, nf90_get_var_3D_EightByteInt, & + nf90_get_var_3D_FourByteReal, nf90_get_var_3D_EightByteReal + module procedure nf90_get_var_4D_text, & + nf90_get_var_4D_OneByteInt, nf90_get_var_4D_TwoByteInt, & + nf90_get_var_4D_FourByteInt, nf90_get_var_4D_EightByteInt, & + nf90_get_var_4D_FourByteReal, nf90_get_var_4D_EightByteReal + module procedure nf90_get_var_5D_text, & + nf90_get_var_5D_OneByteInt, nf90_get_var_5D_TwoByteInt, & + nf90_get_var_5D_FourByteInt, nf90_get_var_5D_EightByteInt, & + nf90_get_var_5D_FourByteReal, nf90_get_var_5D_EightByteReal + module procedure nf90_get_var_6D_text, & + nf90_get_var_6D_OneByteInt, nf90_get_var_6D_TwoByteInt, & + nf90_get_var_6D_FourByteInt, nf90_get_var_6D_EightByteInt, & + nf90_get_var_6D_FourByteReal, nf90_get_var_6D_EightByteReal + module procedure nf90_get_var_7D_text, & + nf90_get_var_7D_OneByteInt, nf90_get_var_7D_TwoByteInt, & + nf90_get_var_7D_FourByteInt, nf90_get_var_7D_EightByteInt, & + nf90_get_var_7D_FourByteReal, nf90_get_var_7D_EightByteReal + end interface ! nf90_get_var +#endif --- /dev/null 2002-08-31 08:31:37.000000000 +0900 +++ ./f90/typeSizes.F90 2005-06-20 11:32:43.000000000 +0900 @@ -0,0 +1,72 @@ +! Description: +! Provide named kind parameters for use in declarations of real and integer +! variables with specific byte sizes (i.e. one, two, four, and eight byte +! integers; four and eight byte reals). The parameters can then be used +! in (KIND = XX) modifiers in declarations. +! A single function (byteSizesOK()) is provided to ensure that the selected +! kind parameters are correct. +! +! Input Parameters: +! None. +! +! Output Parameters: +! Public parameters, fixed at compile time: +! OneByteInt, TwoByteInt, FourByteInt, EightByteInt +! FourByteReal, EightByteRadl +! +! References and Credits: +! Written by +! Robert Pincus +! Cooperative Institue for Meteorological Satellite Studies +! University of Wisconsin - Madison +! 1225 W. Dayton St. +! Madison, Wisconsin 53706 +! Robert.Pincus@ssec.wisc.edu +! +! Design Notes: +! Fortran 90 doesn't allow one to check the number of bytes in a real variable; +! we check only that four byte and eight byte reals have different kind parameters. +! +module typeSizes + implicit none + public + integer, parameter :: OneByteInt = selected_int_kind(2), & + TwoByteInt = selected_int_kind(4), & + FourByteInt = selected_int_kind(9), & +#ifdef __SX__ + EightByteInt = selected_int_kind(10) +#else + EightByteInt = selected_int_kind(18) +#endif + + integer, parameter :: & + FourByteReal = selected_real_kind(P = 6, R = 37), & + EightByteReal = selected_real_kind(P = 13, R = 307) +contains + logical function byteSizesOK() + ! Users may call this function once to ensure that the kind parameters + ! the module defines are available with the current compiler. + ! We can't ensure that the two REAL kinds are actually four and + ! eight bytes long, but we can ensure that they are distinct. + ! Early Fortran 90 compilers would sometimes report incorrect results for + ! the bit_size intrinsic, but I haven't seen this in a long time. + + ! Local variables + integer (kind = OneByteInt) :: One + integer (kind = TwoByteInt) :: Two + integer (kind = FourByteInt) :: Four + +#ifdef __SX__ + if (bit_size( One) == 16 .and. bit_size( Two) == 16 .and. & +#else + if (bit_size( One) == 8 .and. bit_size( Two) == 16 .and. & +#endif + bit_size(Four) == 32 .and. & + FourByteReal > 0 .and. EightByteReal > 0 .and. & + FourByteReal /= EightByteReal) then + byteSizesOK = .true. + else + byteSizesOK = .false. + end if + end function byteSizesOK +end module typeSizes --- ./ncgen/Makefile.orig 2004-12-19 03:08:01.000000000 +0900 +++ ./ncgen/Makefile 2005-06-20 11:32:43.000000000 +0900 @@ -115,7 +115,7 @@ $(CC) -o ctest $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) ctest.c $(ld_netcdf) $(LIBS) && \ ./ctest && \ $(NCDUMP) -n c1 ctest0.nc > ctest1.cdl - @if diff c1.cdl ctest1.cdl; then \ + -if diff c1.cdl ctest1.cdl; then \ echo "*** $(PROGRAM) -c test successful ***"; \ else \ echo "*** $(PROGRAM) -c test failed ***"; \ @@ -130,7 +130,7 @@ # test "-f" option of ncgen # f-test: $(PROGRAM) c0.cdl c1.cdl - @if [ -n "$(FC)" ]; then \ + -if [ -n "$(FC)" ]; then \ $(MAKE) $(MFLAGS) ftest1.cdl && \ if diff c1.cdl ftest1.cdl; then \ echo "*** $(PROGRAM) -f test successful ***"; \ @@ -144,12 +144,14 @@ ftest1.cdl: $(PROGRAM) c0.cdl netcdf.inc ./$(PROGRAM) -f -o ftest0.nc c0.cdl > ftest.f - $(COMPILE.f) ftest.f - $(FC) $(FFLAGS) $(LDFLAGS) -o ftest ftest.o $(ld_netcdf) \ - $(FLIBS) $(LIBS) + $(MAKE) ftest ./ftest $(NCDUMP) -n c1 ftest0.nc > ftest1.cdl +ftest: ftest.f + $(COMPILE.f) ftest.f + $(LINK.f) $@.o $(ld_netcdf) $(FLIBS) $(LIBS) + # Run large file tests. User should set TEMP_LARGE to some place with # lots of disk space, otherwise current directory will be used. extra_test: --- ./config.guess.orig 2004-09-07 02:07:54.000000000 +0900 +++ ./config.guess 2005-06-20 11:32:43.000000000 +0900 @@ -1143,6 +1143,15 @@ SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit 0 ;; + ES:ESOS:*:*) + echo es-nec-esos${UNAME_RELEASE} + exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; --- ./config.sub.orig 2004-09-07 02:07:25.000000000 +0900 +++ ./config.sub 2005-06-20 11:32:43.000000000 +0900 @@ -335,7 +335,7 @@ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* | es-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ @@ -1142,7 +1142,7 @@ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -morphos* | -superux* | -esos* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) # Remember, each alternative MUST END IN *, to match a version number. ;; --- ./configure.orig 2004-12-19 01:32:58.000000000 +0900 +++ ./configure 2005-06-20 11:38:51.000000000 +0900 @@ -313,7 +313,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SRCDIR CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX FC FCFLAGS ac_ct_FC F90 F90FLAGS F90LIBS M4 M4FLAGS CC_MAKEDEPEND AR ARFLAGS NM NMFLAGS RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA IGNORE_FPE FFLAGS FLIBS CPP FPP COMPILE_F FPPFLAGS MATHLIB EGREP ALLOCA prog WHATIS MAKEWHATIS_CMD FTPBINDIR LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SRCDIR CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX FC FCFLAGS ac_ct_FC F90 F90FLAGS F90LIBS LINKF LINKF90 M4 M4FLAGS CC_MAKEDEPEND AR ARFLAGS NM NMFLAGS RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA IGNORE_FPE FFLAGS FLIBS CPP FPP COMPILE_F FPPFLAGS MATHLIB EGREP ALLOCA prog WHATIS MAKEWHATIS_CMD FTPBINDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -4573,6 +4573,26 @@ ;; esac +# +# variables LINKF and LINKF90, which means link processes, is determined. +# by T.Kagimoto (mailto:kagimoto@jamstec.go.jp) +LINKF='$(FC) -o $@ $(FFLAGS) $(FLDFLAGS)' +LINKF90='$(F90) -o $@ $(F90FLAGS) $(F90LDFLAGS)' +case "$host_cpu" in + sx5*|sx6*|sx7*|sx8*|es*) + if test "x$CC" != "xc++"; then + LINKF='$(CC) -o $@ $(FFLAGS) $(FLDFLAGS) -f90lib' + LINKF90='$(CC) -o $@ $(F90FLAGS) $(F90LDFLAGS) -f90lib' + fi + ;; + *) + ;; +esac + + + +# END-OF-DEFINITION of LINKF and LINKF90 + ac_config_headers="$ac_config_headers libsrc/ncconfig.h:libsrc/ncconfig.in fortran/nfconfig.inc:fortran/nfconfig.in" @@ -12018,6 +12038,8 @@ s,@F90@,$F90,;t t s,@F90FLAGS@,$F90FLAGS,;t t s,@F90LIBS@,$F90LIBS,;t t +s,@LINKF@,$LINKF,;t t +s,@LINKF90@,$LINKF90,;t t s,@M4@,$M4,;t t s,@M4FLAGS@,$M4FLAGS,;t t s,@CC_MAKEDEPEND@,$CC_MAKEDEPEND,;t t --- ./configure.in.orig 2004-12-19 01:32:32.000000000 +0900 +++ ./configure.in 2005-06-20 11:38:40.000000000 +0900 @@ -182,6 +182,26 @@ ;; esac +# +# variables LINKF and LINKF90, which means link processes, is determined. +# by T.Kagimoto (mailto:kagimoto@jamstec.go.jp) +LINKF='$(FC) -o $@ $(FFLAGS) $(FLDFLAGS)' +LINKF90='$(F90) -o $@ $(F90FLAGS) $(F90LDFLAGS)' +case "$host_cpu" in + sx5*|sx6*|sx7*|sx8*|es*) + if test "x$CC" != "xc++"; then + LINKF='$(CC) -o $@ $(FFLAGS) $(FLDFLAGS) -f90lib' + LINKF90='$(CC) -o $@ $(F90FLAGS) $(F90LDFLAGS) -f90lib' + fi + ;; + *) + ;; +esac +AC_SUBST(LINKF) +AC_SUBST(LINKF90) + +# END-OF-DEFINITION of LINKF and LINKF90 + AC_PREFIX_DEFAULT(`(cd ..; pwd)`) AC_CONFIG_HEADER( libsrc/ncconfig.h:libsrc/ncconfig.in --- ./macros.make.in.orig 2004-12-19 01:32:32.000000000 +0900 +++ ./macros.make.in 2005-06-20 11:32:43.000000000 +0900 @@ -55,9 +55,9 @@ F90LDFLAGS = $(LDFLAGS) LINK.c = $(CC) -o $@ $(CFLAGS) $(LDFLAGS) LINK.cxx = $(CXX) -o $@ $(CXXFLAGS) $(LDFLAGS) -LINK.F = $(FC) -o $@ $(FFLAGS) $(FLDFLAGS) -LINK.f = $(FC) -o $@ $(FFLAGS) $(FLDFLAGS) -LINK.F90 = $(F90) -o $@ $(F90FLAGS) $(F90LDFLAGS) +LINK.F = @LINKF@ +LINK.f = @LINKF@ +LINK.F90 = @LINKF90@ # Manual pages: