f0876e747e
Wolfgang S. Rupprecht. Patches from http://www.unidata.ucar.edu/packages/netcdf/known_problems.html (Mike Romberg).
137 lines
3.8 KiB
Text
137 lines
3.8 KiB
Text
$NetBSD: patch-an,v 1.1 2004/01/11 15:58:45 cjep Exp $
|
|
|
|
--- cxx/nctst.cpp.orig 1999-09-17 18:21:23.000000000 +0100
|
|
+++ cxx/nctst.cpp
|
|
@@ -1,4 +1,4 @@
|
|
-#include <iostream.h>
|
|
+#include <iostream>
|
|
#include <string.h>
|
|
#include "netcdfcpp.h"
|
|
|
|
@@ -8,7 +8,7 @@ void gen(const char* path) // Generate
|
|
|
|
// Check if the file was opened successfully
|
|
if (! nc.is_valid()) {
|
|
- cerr << "can't create netCDF file " << path << "\n";
|
|
+ std::cerr << "can't create netCDF file " << path << "\n";
|
|
return;
|
|
}
|
|
|
|
@@ -124,12 +124,12 @@ void DumpableNcFile::dumpdims( void )
|
|
|
|
for (int n=0; n < num_dims(); n++) {
|
|
NcDim* dim = get_dim(n);
|
|
- cout << "\t" << dim->name() << " = " ;
|
|
+ std::cout << "\t" << dim->name() << " = " ;
|
|
if (dim->is_unlimited())
|
|
- cout << "UNLIMITED" << " ;\t " << "// " << dim->size() <<
|
|
+ std::cout << "UNLIMITED" << " ;\t " << "// " << dim->size() <<
|
|
" currently\n";
|
|
else
|
|
- cout << dim->size() << " ;\n";
|
|
+ std::cout << dim->size() << " ;\n";
|
|
}
|
|
}
|
|
|
|
@@ -137,10 +137,10 @@ void dumpatts(NcVar& var)
|
|
{
|
|
NcToken vname = var.name();
|
|
NcAtt* ap;
|
|
- for(int n = 0; ap = var.get_att(n); n++) {
|
|
- cout << "\t\t" << vname << ":" << ap->name() << " = " ;
|
|
+ for(int n = 0; (ap = var.get_att(n)); n++) {
|
|
+ std::cout << "\t\t" << vname << ":" << ap->name() << " = " ;
|
|
NcValues* vals = ap->values();
|
|
- cout << *vals << " ;" << endl ;
|
|
+ std::cout << *vals << " ;" << std::endl ;
|
|
delete ap;
|
|
delete vals;
|
|
}
|
|
@@ -153,20 +153,20 @@ void DumpableNcFile::dumpvars( void )
|
|
{"","byte","char","short","long","float","double"};
|
|
NcVar* vp;
|
|
|
|
- for(n = 0; vp = get_var(n); n++) {
|
|
- cout << "\t" << types[vp->type()] << " " << vp->name() ;
|
|
+ for(n = 0; (vp = get_var(n)); n++) {
|
|
+ std::cout << "\t" << types[vp->type()] << " " << vp->name() ;
|
|
|
|
if (vp->num_dims() > 0) {
|
|
- cout << "(";
|
|
+ std::cout << "(";
|
|
for (int d = 0; d < vp->num_dims(); d++) {
|
|
NcDim* dim = vp->get_dim(d);
|
|
- cout << dim->name();
|
|
+ std::cout << dim->name();
|
|
if (d < vp->num_dims()-1)
|
|
- cout << ", ";
|
|
+ std::cout << ", ";
|
|
}
|
|
- cout << ")";
|
|
+ std::cout << ")";
|
|
}
|
|
- cout << " ;\n";
|
|
+ std::cout << " ;\n";
|
|
// now dump each of this variable's attributes
|
|
dumpatts(*vp);
|
|
}
|
|
@@ -175,10 +175,10 @@ void DumpableNcFile::dumpvars( void )
|
|
void DumpableNcFile::dumpgatts( void )
|
|
{
|
|
NcAtt* ap;
|
|
- for(int n = 0; ap = get_att(n); n++) {
|
|
- cout << "\t\t" << ":" << ap->name() << " = " ;
|
|
+ for(int n = 0; (ap = get_att(n)); n++) {
|
|
+ std::cout << "\t\t" << ":" << ap->name() << " = " ;
|
|
NcValues* vals = ap->values();
|
|
- cout << *vals << " ;" << endl ;
|
|
+ std::cout << *vals << " ;" << std::endl ;
|
|
delete vals;
|
|
delete ap;
|
|
}
|
|
@@ -187,10 +187,10 @@ void DumpableNcFile::dumpgatts( void )
|
|
void DumpableNcFile::dumpdata( )
|
|
{
|
|
NcVar* vp;
|
|
- for (int n = 0; vp = get_var(n); n++) {
|
|
- cout << " " << vp->name() << " = ";
|
|
+ for (int n = 0; (vp = get_var(n)); n++) {
|
|
+ std::cout << " " << vp->name() << " = ";
|
|
NcValues* vals = vp->values();
|
|
- cout << *vals << " ;" << endl ;
|
|
+ std::cout << *vals << " ;" << std::endl ;
|
|
delete vals;
|
|
}
|
|
}
|
|
@@ -199,25 +199,25 @@ void dump(const char* path)
|
|
{
|
|
DumpableNcFile nc(path); // default is open in read-only mode
|
|
|
|
- cout << "netcdf " << cdl_name(path) << " {" << endl <<
|
|
- "dimensions:" << endl ;
|
|
+ std::cout << "netcdf " << cdl_name(path) << " {" << std::endl <<
|
|
+ "dimensions:" << std::endl ;
|
|
|
|
nc.dumpdims();
|
|
|
|
- cout << "variables:" << endl;
|
|
+ std::cout << "variables:" << std::endl;
|
|
|
|
nc.dumpvars();
|
|
|
|
if (nc.num_atts() > 0)
|
|
- cout << "// global attributes" << endl ;
|
|
+ std::cout << "// global attributes" << std::endl ;
|
|
|
|
nc.dumpgatts();
|
|
|
|
- cout << "data:" << endl;
|
|
+ std::cout << "data:" << std::endl;
|
|
|
|
nc.dumpdata();
|
|
|
|
- cout << "}" << endl;
|
|
+ std::cout << "}" << std::endl;
|
|
}
|
|
|
|
|