fixed broken classic-only build

This commit is contained in:
Ed Hartnett 2010-06-28 17:17:43 +00:00
commit f0a72cbefb
26 changed files with 976 additions and 548 deletions

View File

@ -261,7 +261,7 @@ AC_MSG_CHECKING([whether a default chunk size in bytes was specified])
AC_ARG_WITH([default-chunk-size],
[AS_HELP_STRING([--with-default-chunk-size=<integer>],
[Specify default size of chunks in bytes.])],
[DEFAULTT_CHUNK_SIZE=$with_default_chunk_size], [DEFAULT_CHUNK_SIZE=4194304])
[DEFAULT_CHUNK_SIZE=$with_default_chunk_size], [DEFAULT_CHUNK_SIZE=4194304])
AC_MSG_RESULT([$DEFAULT_CHUNK_SIZE])
AC_DEFINE_UNQUOTED([DEFAULT_CHUNK_SIZE], [$DEFAULT_CHUNK_SIZE], [default chunk size in bytes])

View File

@ -904,14 +904,6 @@ nc_put_att_double(int ncid, int varid, const char *name, nc_type xtype,
EXTERNL int
nc_get_att_double(int ncid, int varid, const char *name, double *ip);
EXTERNL int
nc_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned char *op);
EXTERNL int
nc_get_att_ubyte(int ncid, int varid, const char *name,
unsigned char *ip);
EXTERNL int
nc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned short *op);
@ -1045,14 +1037,6 @@ nc_put_var1_double(int ncid, int varid, const size_t *indexp, const double *op);
EXTERNL int
nc_get_var1_double(int ncid, int varid, const size_t *indexp, double *ip);
EXTERNL int
nc_put_var1_ubyte(int ncid, int varid, const size_t *indexp,
const unsigned char *op);
EXTERNL int
nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp,
unsigned char *ip);
EXTERNL int
nc_put_var1_ushort(int ncid, int varid, const size_t *indexp,
const unsigned short *op);
@ -1160,14 +1144,6 @@ EXTERNL int
nc_get_vara_double(int ncid, int varid, const size_t *startp,
const size_t *countp, double *ip);
EXTERNL int
nc_put_vara_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned char *op);
EXTERNL int
nc_get_vara_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned char *ip);
EXTERNL int
nc_put_vara_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned short *op);
@ -1291,16 +1267,6 @@ nc_get_vars_double(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
double *ip);
EXTERNL int
nc_put_vars_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned char *op);
EXTERNL int
nc_get_vars_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned char *ip);
EXTERNL int
nc_put_vars_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
@ -1434,16 +1400,6 @@ nc_get_varm_double(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, double *ip);
EXTERNL int
nc_put_varm_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned char *op);
EXTERNL int
nc_get_varm_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned char *ip);
EXTERNL int
nc_put_varm_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
@ -1545,12 +1501,6 @@ nc_put_var_double(int ncid, int varid, const double *op);
EXTERNL int
nc_get_var_double(int ncid, int varid, double *ip);
EXTERNL int
nc_put_var_ubyte(int ncid, int varid, const unsigned char *op);
EXTERNL int
nc_get_var_ubyte(int ncid, int varid, unsigned char *ip);
EXTERNL int
nc_put_var_ushort(int ncid, int varid, const unsigned short *op);
@ -1581,6 +1531,47 @@ nc_put_var_string(int ncid, int varid, const char **op);
EXTERNL int
nc_get_var_string(int ncid, int varid, char **ip);
/* Begin Deprecated, same as functions with "_ubyte" replaced by "_uchar" */
EXTERNL int
nc_put_att_ubyte(int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned char *op);
EXTERNL int
nc_get_att_ubyte(int ncid, int varid, const char *name,
unsigned char *ip);
EXTERNL int
nc_put_var1_ubyte(int ncid, int varid, const size_t *indexp,
const unsigned char *op);
EXTERNL int
nc_get_var1_ubyte(int ncid, int varid, const size_t *indexp,
unsigned char *ip);
EXTERNL int
nc_put_vara_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned char *op);
EXTERNL int
nc_get_vara_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned char *ip);
EXTERNL int
nc_put_vars_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned char *op);
EXTERNL int
nc_get_vars_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned char *ip);
EXTERNL int
nc_put_varm_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned char *op);
EXTERNL int
nc_get_varm_ubyte(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned char *ip);
EXTERNL int
nc_put_var_ubyte(int ncid, int varid, const unsigned char *op);
EXTERNL int
nc_get_var_ubyte(int ncid, int varid, unsigned char *ip);
/* End Deprecated */
#ifdef LOGGING
/* Set the log level. 0 shows only errors, 1 only major messages,

View File

@ -238,7 +238,7 @@ nc_get_att_string(int ncid, int varid, const char *name, char* *value)
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
return ncp->dispatch->get_att(ncid,varid,name,(void*)value,T_string);
return ncp->dispatch->get_att(ncid,varid,name,(void*)value, NC_STRING);
}
int
@ -381,7 +381,7 @@ nc_put_att_string(int ncid, int varid, const char *name,
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
return ncp->dispatch->put_att(ncid,varid,name,NC_STRING,len,(void*)value,T_string);
return ncp->dispatch->put_att(ncid,varid,name,NC_STRING,len,(void*)value,NC_STRING);
}
int

View File

@ -351,10 +351,10 @@ nc_copy_var(int ncid_in, int varid_in, int ncid_out)
(double *)data);
break;
case NC_UBYTE:
retval = nc_get_vara_ubyte(ncid_in, varid_in, start, count,
retval = nc_get_vara_uchar(ncid_in, varid_in, start, count,
(unsigned char *)data);
if (!retval)
retval = nc_put_vara_ubyte(ncid_out, varid_out, start, count,
retval = nc_put_vara_uchar(ncid_out, varid_out, start, count,
(unsigned char *)data);
break;
case NC_USHORT:

View File

@ -91,17 +91,19 @@ ${top_builddir}/libdispatch/libdispatch.la
CLEANFILES += t_dap
EXTRA_DIST = ce.y
endif # BUILD_DAP
# These rule are used if someone wants to rebuild the grammar files.
# Otherwise never invoked, but records how to do it.
# BTW: note that renaming is essential because otherwise
# autoconf will forcibly delete files of the name *.tab.*
cetab.c cetab.h: ${top_srcdir}/oc/ce.y
bison -d -t -p ce ${top_srcdir}/oc/ce.y
rm -f cetab.c cetab.h
mv ce.tab.c cetab.c
mv ce.tab.h cetab.h
#cetab.c cetab.h: ${top_srcdir}/oc/ce.y
# bison -d -t -p ce ${top_srcdir}/oc/ce.y
# rm -f cetab.c cetab.h
# mv ce.tab.c cetab.c
# mv ce.tab.h cetab.h
test: check

195
libncdap3/ce.y Normal file
View File

@ -0,0 +1,195 @@
/* Copyright 2009, UCAR/Unidata and OPeNDAP, Inc.
See the COPYRIGHT file for more information. */
/*The lines down to DO NOT DELETE ... comment are specific to the C Parser.
They will be commennted out when building a java parser.
*/
%pure-parser
%lex-param {CEparsestate* parsestate}
%parse-param {CEparsestate* parsestate}
%{#include "ceparselex.h"%}
/*DO NOT DELETE THIS LINE*/
%token SCAN_WORD
%token SCAN_STRINGCONST
%token SCAN_NUMBERCONST
%start constraints
%%
constraints:
projections {projections(parsestate,$1);}
| selections {selections(parsestate,$1);}
| projections selections
{projections(parsestate,$1); selections(parsestate,$2);}
;
/* %type NClist<NCprojection*> */
projections: projectionlist {$$=$1;}
/* %type NClist<NCselection*> */
selections: selectionlist {$$=$1;}
/* %type NClist<NCprojection*> */
projectionlist:
projection
{$$=projectionlist(parsestate,null,$1);}
| projectionlist ',' projection
{$$=projectionlist(parsestate,$1,$3);}
;
/* %type NCprojection* */
projection:
segmentlist
{$$=projection(parsestate,$1);}
;
/* %type NClist<NCsegment> */
segmentlist:
segment
{$$=segmentlist(parsestate,null,$1);}
| segmentlist '.' segment
{$$=segmentlist(parsestate,$1,$3);}
;
/* %type NCsegment */
segment:
word
{$$=segment(parsestate,$1,null);}
| word array_indices
{$$=segment(parsestate,$1,$2);}
;
/* %type NClist<NCslice*> */
array_indices: /* appends indices to state->segment */
array_index
{$$=array_indices(parsestate,null,$1);}
| array_indices array_index
{$$=array_indices(parsestate,$1,$2);}
;
/* %type NCslice* */
array_index:
range {$$=$1;}
;
/* %type NCslice* */
range:
range1
{$$=range(parsestate,$1,null,null);}
| '[' index ':' index ']'
{$$=range(parsestate,$2,null,$4);}
| '[' index ':' index ':' index ']'
{$$=range(parsestate,$2,$4,$6);}
;
range1: '[' index ']' {$$=$2;}
/* %type NClist<NCselection*> */
selectionlist:
'&' sel_clause
{$$=selectionlist(parsestate,null,$2);}
| selectionlist sel_clause
{$$=selectionlist(parsestate,$1,$2);}
;
/* %type NCselection* */
sel_clause:
selectionvar rel_op '{' value_list '}'
{$$=sel_clause(parsestate,1,$1,$2,$4);} /*1,2 distinguish cases*/
| selectionvar rel_op value
{$$=sel_clause(parsestate,2,$1,$2,$3);}
| function
;
/* %type NClist<NCselection*> */
selectionvar:
selectionpath
{$$=$1;}
;
/* %type NClist<NCselection*> */
selectionpath:
arrayelement
{$1=selectionpath(parsestate,null,$1);}
| segment '.' arrayelement
{$$=selectionpath(parsestate,$1,$3);}
;
function:
ident '(' ')'
{$$=function(parsestate,$1,null);}
| ident '(' arg_list ')'
{$$=function(parsestate,$1,$3);}
;
arg_list:
value
{$$=arg_list(parsestate,null,$1);}
| value_list ',' value
{$$=arg_list(parsestate,$1,$3);}
;
value_list:
value
{$$=value_list(parsestate,null,$1);}
| value_list '|' value
{$$=value_list(parsestate,$1,$3);}
;
value:
selectionpath /* can be variable or an integer */
{$$=value(parsestate,$1,SCAN_WORD);}
| number
{$$=value(parsestate,$1,SCAN_NUMBERCONST);}
| string
{$$=value(parsestate,$1,SCAN_STRINGCONST);}
;
/* %type SelectionTag */
rel_op:
'=' {$$=(Object)ST_EQ;}
| '>' {$$=(Object)ST_GT;}
| '<' {$$=(Object)ST_LT;}
| '!' '=' {$$=(Object)ST_NEQ;}
| '=' '~' {$$=(Object)ST_RE;}
| '>' '=' {$$=(Object)ST_GE;}
| '<' '=' {$$=(Object)ST_LE;}
;
/* type NCsegment* */
arrayelement:
word
{$$=arrayelement(parsestate,$1,null);}
| word range1
{$$=arrayelement(parsestate,$1,$2);}
;
ident: word
{$$ = $1;}
;
index: number
{ unsigned long tmp = 0;
if(sscanf((char*)$1,"%lu",&tmp) != 1) {
yyerror(parsestate,"Index is not an integer");
}
$$ = $1;
}
;
word: SCAN_WORD
{$$ = $1;}
;
number: SCAN_NUMBERCONST
{$$ = $1;}
;
string: SCAN_STRINGCONST
{$$ = $1;}
;
%%

View File

@ -1,24 +1,22 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@ -29,7 +27,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@ -47,7 +45,7 @@
#define YYBISON 1
/* Bison version. */
#define YYBISON_VERSION "2.3"
#define YYBISON_VERSION "2.4.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@ -55,42 +53,34 @@
/* Pure parsers. */
#define YYPURE 1
/* Push parsers. */
#define YYPUSH 0
/* Pull parsers. */
#define YYPULL 1
/* Using locations. */
#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
#define yyparse ceparse
#define yylex celex
#define yyerror ceerror
#define yylval celval
#define yychar cechar
#define yydebug cedebug
#define yynerrs cenerrs
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
SCAN_WORD = 258,
SCAN_STRINGCONST = 259,
SCAN_NUMBERCONST = 260
};
#endif
/* Tokens. */
#define SCAN_WORD 258
#define SCAN_STRINGCONST 259
#define SCAN_NUMBERCONST 260
#define yyparse ceparse
#define yylex celex
#define yyerror ceerror
#define yylval celval
#define yychar cechar
#define yydebug cedebug
#define yynerrs cenerrs
/* Copy the first part of user declarations. */
/* Line 189 of yacc.c */
#line 11 "../oc/ce.y"
#include "ceparselex.h"
/* Line 189 of yacc.c */
#line 83 "ce.tab.c"
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
@ -109,20 +99,34 @@
# define YYTOKEN_TABLE 0
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
SCAN_WORD = 258,
SCAN_STRINGCONST = 259,
SCAN_NUMBERCONST = 260
};
#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
/* Copy the second part of user declarations. */
/* Line 216 of yacc.c. */
#line 126 "ce.tab.c"
/* Line 264 of yacc.c */
#line 130 "ce.tab.c"
#ifdef short
# undef short
@ -172,7 +176,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
# if YYENABLE_NLS
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@ -197,14 +201,14 @@ typedef short int yytype_int16;
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
YYID (int i)
YYID (int yyi)
#else
static int
YYID (i)
int i;
YYID (yyi)
int yyi;
#endif
{
return i;
return yyi;
}
#endif
@ -285,9 +289,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss;
YYSTYPE yyvs;
};
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@ -321,12 +325,12 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
@ -586,9 +590,18 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
Once GCC version 2 has supplanted version 1, this can go. However,
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
discussed. */
#define YYFAIL goto yyerrlab
#if defined YYFAIL
/* This is here to suppress warnings from the GCC cpp's
-Wunused-macros. Normally we don't worry about that warning, but
some users do, and we want to make it easy for users to remove
YYFAIL uses, which will produce warnings from Bison 2.5. */
#endif
#define YYRECOVERING() (!!yyerrstatus)
@ -645,7 +658,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
@ -759,17 +772,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, parsestate)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
yy_stack_print (bottom, top)
yytype_int16 *bottom;
yytype_int16 *top;
yy_stack_print (yybottom, yytop)
yytype_int16 *yybottom;
yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
for (; bottom <= top; ++bottom)
YYFPRINTF (stderr, " %d", *bottom);
for (; yybottom <= yytop; yybottom++)
{
int yybot = *yybottom;
YYFPRINTF (stderr, " %d", yybot);
}
YYFPRINTF (stderr, "\n");
}
@ -804,11 +820,11 @@ yy_reduce_print (yyvsp, yyrule, parsestate)
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
fprintf (stderr, " $%d = ", yyi + 1);
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
, parsestate);
fprintf (stderr, "\n");
YYFPRINTF (stderr, "\n");
}
}
@ -1090,10 +1106,8 @@ yydestruct (yymsg, yytype, yyvaluep, parsestate)
break;
}
}
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@ -1112,10 +1126,9 @@ int yyparse ();
/*----------.
| yyparse. |
`----------*/
/*-------------------------.
| yyparse or yypush_parse. |
`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@ -1139,22 +1152,46 @@ yyparse (parsestate)
#endif
#endif
{
/* The look-ahead symbol. */
/* The lookahead symbol. */
int yychar;
/* The semantic value of the look-ahead symbol. */
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
/* Number of syntax errors so far. */
int yynerrs;
/* Number of syntax errors so far. */
int yynerrs;
int yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* The stacks and their tools:
`yyss': related to states.
`yyvs': related to semantic values.
Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
YYSIZE_T yystacksize;
int yystate;
int yyn;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
/* Look-ahead token as an internal (translated) token number. */
int yytoken = 0;
/* Lookahead token as an internal (translated) token number. */
int yytoken;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
@ -1162,51 +1199,28 @@ int yynerrs;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
/* Three stacks and their tools:
`yyss': related to states,
`yyvs': related to semantic values,
`yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss = yyssa;
yytype_int16 *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
YYSTYPE *yyvsp;
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
YYSIZE_T yystacksize = YYINITDEPTH;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
yytoken = 0;
yyss = yyssa;
yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss;
yyvsp = yyvs;
@ -1236,7 +1250,6 @@ int yynerrs;
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
@ -1244,7 +1257,6 @@ int yynerrs;
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
yyss = yyss1;
@ -1267,9 +1279,8 @@ int yynerrs;
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@ -1280,7 +1291,6 @@ int yynerrs;
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@ -1290,6 +1300,9 @@ int yynerrs;
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
if (yystate == YYFINAL)
YYACCEPT;
goto yybackup;
/*-----------.
@ -1298,16 +1311,16 @@ int yynerrs;
yybackup:
/* Do appropriate processing given the current state. Read a
look-ahead token if we need one and don't already have one. */
lookahead token if we need one and don't already have one. */
/* First try to decide what to do without reference to look-ahead token. */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
/* Not known => get a look-ahead token if don't already have one. */
/* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
@ -1339,20 +1352,16 @@ yybackup:
goto yyreduce;
}
if (yyn == YYFINAL)
YYACCEPT;
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
/* Shift the look-ahead token. */
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the shifted token unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
/* Discard the shifted token. */
yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
@ -1392,231 +1401,323 @@ yyreduce:
switch (yyn)
{
case 2:
/* Line 1464 of yacc.c */
#line 24 "../oc/ce.y"
{projections(parsestate,(yyvsp[(1) - (1)]));;}
break;
case 3:
/* Line 1464 of yacc.c */
#line 25 "../oc/ce.y"
{selections(parsestate,(yyvsp[(1) - (1)]));;}
break;
case 4:
/* Line 1464 of yacc.c */
#line 27 "../oc/ce.y"
{projections(parsestate,(yyvsp[(1) - (2)])); selections(parsestate,(yyvsp[(2) - (2)]));;}
break;
case 5:
/* Line 1464 of yacc.c */
#line 31 "../oc/ce.y"
{(yyval)=(yyvsp[(1) - (1)]);;}
break;
case 6:
/* Line 1464 of yacc.c */
#line 34 "../oc/ce.y"
{(yyval)=(yyvsp[(1) - (1)]);;}
break;
case 7:
/* Line 1464 of yacc.c */
#line 39 "../oc/ce.y"
{(yyval)=projectionlist(parsestate,null,(yyvsp[(1) - (1)]));;}
break;
case 8:
/* Line 1464 of yacc.c */
#line 41 "../oc/ce.y"
{(yyval)=projectionlist(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]));;}
break;
case 9:
/* Line 1464 of yacc.c */
#line 47 "../oc/ce.y"
{(yyval)=projection(parsestate,(yyvsp[(1) - (1)]));;}
break;
case 10:
/* Line 1464 of yacc.c */
#line 53 "../oc/ce.y"
{(yyval)=segmentlist(parsestate,null,(yyvsp[(1) - (1)]));;}
break;
case 11:
/* Line 1464 of yacc.c */
#line 55 "../oc/ce.y"
{(yyval)=segmentlist(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]));;}
break;
case 12:
/* Line 1464 of yacc.c */
#line 61 "../oc/ce.y"
{(yyval)=segment(parsestate,(yyvsp[(1) - (1)]),null);;}
break;
case 13:
/* Line 1464 of yacc.c */
#line 63 "../oc/ce.y"
{(yyval)=segment(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));;}
break;
case 14:
/* Line 1464 of yacc.c */
#line 69 "../oc/ce.y"
{(yyval)=array_indices(parsestate,null,(yyvsp[(1) - (1)]));;}
break;
case 15:
/* Line 1464 of yacc.c */
#line 71 "../oc/ce.y"
{(yyval)=array_indices(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));;}
break;
case 16:
/* Line 1464 of yacc.c */
#line 76 "../oc/ce.y"
{(yyval)=(yyvsp[(1) - (1)]);;}
break;
case 17:
/* Line 1464 of yacc.c */
#line 82 "../oc/ce.y"
{(yyval)=range(parsestate,(yyvsp[(1) - (1)]),null,null);;}
break;
case 18:
/* Line 1464 of yacc.c */
#line 84 "../oc/ce.y"
{(yyval)=range(parsestate,(yyvsp[(2) - (5)]),null,(yyvsp[(4) - (5)]));;}
break;
case 19:
/* Line 1464 of yacc.c */
#line 86 "../oc/ce.y"
{(yyval)=range(parsestate,(yyvsp[(2) - (7)]),(yyvsp[(4) - (7)]),(yyvsp[(6) - (7)]));;}
break;
case 20:
/* Line 1464 of yacc.c */
#line 89 "../oc/ce.y"
{(yyval)=(yyvsp[(2) - (3)]);;}
break;
case 21:
/* Line 1464 of yacc.c */
#line 94 "../oc/ce.y"
{(yyval)=selectionlist(parsestate,null,(yyvsp[(2) - (2)]));;}
break;
case 22:
/* Line 1464 of yacc.c */
#line 96 "../oc/ce.y"
{(yyval)=selectionlist(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));;}
break;
case 23:
/* Line 1464 of yacc.c */
#line 102 "../oc/ce.y"
{(yyval)=sel_clause(parsestate,1,(yyvsp[(1) - (5)]),(yyvsp[(2) - (5)]),(yyvsp[(4) - (5)]));;}
break;
case 24:
/* Line 1464 of yacc.c */
#line 104 "../oc/ce.y"
{(yyval)=sel_clause(parsestate,2,(yyvsp[(1) - (3)]),(yyvsp[(2) - (3)]),(yyvsp[(3) - (3)]));;}
break;
case 26:
/* Line 1464 of yacc.c */
#line 111 "../oc/ce.y"
{(yyval)=(yyvsp[(1) - (1)]);;}
break;
case 27:
/* Line 1464 of yacc.c */
#line 116 "../oc/ce.y"
{(yyvsp[(1) - (1)])=selectionpath(parsestate,null,(yyvsp[(1) - (1)]));;}
break;
case 28:
/* Line 1464 of yacc.c */
#line 118 "../oc/ce.y"
{(yyval)=selectionpath(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]));;}
break;
case 29:
/* Line 1464 of yacc.c */
#line 123 "../oc/ce.y"
{(yyval)=function(parsestate,(yyvsp[(1) - (3)]),null);;}
break;
case 30:
/* Line 1464 of yacc.c */
#line 125 "../oc/ce.y"
{(yyval)=function(parsestate,(yyvsp[(1) - (4)]),(yyvsp[(3) - (4)]));;}
break;
case 31:
/* Line 1464 of yacc.c */
#line 130 "../oc/ce.y"
{(yyval)=arg_list(parsestate,null,(yyvsp[(1) - (1)]));;}
break;
case 32:
/* Line 1464 of yacc.c */
#line 132 "../oc/ce.y"
{(yyval)=arg_list(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]));;}
break;
case 33:
/* Line 1464 of yacc.c */
#line 137 "../oc/ce.y"
{(yyval)=value_list(parsestate,null,(yyvsp[(1) - (1)]));;}
break;
case 34:
/* Line 1464 of yacc.c */
#line 139 "../oc/ce.y"
{(yyval)=value_list(parsestate,(yyvsp[(1) - (3)]),(yyvsp[(3) - (3)]));;}
break;
case 35:
/* Line 1464 of yacc.c */
#line 144 "../oc/ce.y"
{(yyval)=value(parsestate,(yyvsp[(1) - (1)]),SCAN_WORD);;}
break;
case 36:
/* Line 1464 of yacc.c */
#line 146 "../oc/ce.y"
{(yyval)=value(parsestate,(yyvsp[(1) - (1)]),SCAN_NUMBERCONST);;}
break;
case 37:
/* Line 1464 of yacc.c */
#line 148 "../oc/ce.y"
{(yyval)=value(parsestate,(yyvsp[(1) - (1)]),SCAN_STRINGCONST);;}
break;
case 38:
/* Line 1464 of yacc.c */
#line 153 "../oc/ce.y"
{(yyval)=(Object)ST_EQ;;}
break;
case 39:
/* Line 1464 of yacc.c */
#line 154 "../oc/ce.y"
{(yyval)=(Object)ST_GT;;}
break;
case 40:
/* Line 1464 of yacc.c */
#line 155 "../oc/ce.y"
{(yyval)=(Object)ST_LT;;}
break;
case 41:
/* Line 1464 of yacc.c */
#line 156 "../oc/ce.y"
{(yyval)=(Object)ST_NEQ;;}
break;
case 42:
/* Line 1464 of yacc.c */
#line 157 "../oc/ce.y"
{(yyval)=(Object)ST_RE;;}
break;
case 43:
/* Line 1464 of yacc.c */
#line 158 "../oc/ce.y"
{(yyval)=(Object)ST_GE;;}
break;
case 44:
/* Line 1464 of yacc.c */
#line 159 "../oc/ce.y"
{(yyval)=(Object)ST_LE;;}
break;
case 45:
/* Line 1464 of yacc.c */
#line 165 "../oc/ce.y"
{(yyval)=arrayelement(parsestate,(yyvsp[(1) - (1)]),null);;}
break;
case 46:
/* Line 1464 of yacc.c */
#line 167 "../oc/ce.y"
{(yyval)=arrayelement(parsestate,(yyvsp[(1) - (2)]),(yyvsp[(2) - (2)]));;}
break;
case 47:
/* Line 1464 of yacc.c */
#line 171 "../oc/ce.y"
{(yyval) = (yyvsp[(1) - (1)]);;}
break;
case 48:
/* Line 1464 of yacc.c */
#line 175 "../oc/ce.y"
{ unsigned long tmp = 0;
if(sscanf((char*)(yyvsp[(1) - (1)]),"%lu",&tmp) != 1) {
@ -1627,23 +1728,30 @@ yyreduce:
break;
case 49:
/* Line 1464 of yacc.c */
#line 184 "../oc/ce.y"
{(yyval) = (yyvsp[(1) - (1)]);;}
break;
case 50:
/* Line 1464 of yacc.c */
#line 188 "../oc/ce.y"
{(yyval) = (yyvsp[(1) - (1)]);;}
break;
case 51:
/* Line 1464 of yacc.c */
#line 192 "../oc/ce.y"
{(yyval) = (yyvsp[(1) - (1)]);;}
break;
/* Line 1267 of yacc.c. */
#line 1647 "ce.tab.c"
/* Line 1464 of yacc.c */
#line 1755 "ce.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1654,7 +1762,6 @@ yyreduce:
*++yyvsp = yyval;
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@ -1719,7 +1826,7 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse look-ahead token after an
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
@ -1736,7 +1843,7 @@ yyerrlab:
}
}
/* Else will try to reuse look-ahead token after shifting the error
/* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@ -1793,9 +1900,6 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp);
}
if (yyn == YYFINAL)
YYACCEPT;
*++yyvsp = yylval;
@ -1820,7 +1924,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
#ifndef yyoverflow
#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@ -1831,7 +1935,7 @@ yyexhaustedlab:
#endif
yyreturn:
if (yychar != YYEOF && yychar != YYEMPTY)
if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, parsestate);
/* Do not reclaim the symbols of the rule which action triggered
@ -1857,6 +1961,8 @@ yyreturn:
}
/* Line 1684 of yacc.c */
#line 195 "../oc/ce.y"

View File

@ -1,24 +1,22 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* A Bison parser, made by GNU Bison 2.4.2. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@ -29,10 +27,11 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@ -44,20 +43,16 @@
SCAN_NUMBERCONST = 260
};
#endif
/* Tokens. */
#define SCAN_WORD 258
#define SCAN_STRINGCONST 259
#define SCAN_NUMBERCONST 260
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif

View File

@ -306,7 +306,7 @@ int main()
#ifdef USE_NETCDF4
CHECK(nc_inq_varid(ncid, "b", &varid));
CHECK(nc_get_var_ubyte(ncid,varid,uint8));
CHECK(nc_get_var_uchar(ncid,varid,uint8));
#ifdef GENERATE
printf("static %s ubyte_data[DIMSIZE]={","unsigned char");
for(i=0;i<DIMSIZE;i++) printf("%s%hhu",COMMA,uint8[i]);

View File

@ -45,10 +45,10 @@ tst_h_atts3 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps \
tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl \
tst_h_opaques tst_h_strings tst_h_strings1 tst_h_dimscales \
tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 tst_h_enums \
tst_h_vl2 tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars \
tst_varms tst_unlim_vars tst_converts tst_converts2 tst_grps \
tst_compounds tst_compounds2 tst_compounds3 tst_opaques tst_strings \
tst_interops tst_interops4 tst_interops5 tst_enums tst_coords \
tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars tst_varms \
tst_unlim_vars tst_converts tst_converts2 tst_grps tst_compounds \
tst_compounds2 tst_compounds3 tst_opaques tst_strings tst_interops \
tst_interops4 tst_interops5 tst_interops6 tst_enums tst_coords \
tst_coords2 tst_coords3 tst_vars3 tst_chunks tst_utf8 tst_fills \
tst_fillbug tst_xplatform tst_xplatform2 tst_endian_fill

View File

@ -417,7 +417,7 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, char *obj_name,
int *dim_without_var)
{
/*char *start_of_len;*/
char dimscale_name_att[NC_MAX_NAME + 1];
char dimscale_name_att[NC_MAX_NAME + 1] = "";
int natts, a;
hid_t attid = 0;
char att_name[NC_MAX_HDF5_NAME + 1];
@ -485,15 +485,6 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, char *obj_name,
return retval;
grp->dim->len = *lenp;
}
/* else */
/* { */
/* start_of_len = dimscale_name_att + strlen(DIM_WITHOUT_VARIABLE); */
/* #if (SIZEOF_SIZE_T < 8) */
/* sscanf(start_of_len, "%d", (int *)&grp->dim->len); */
/* #else */
/* sscanf(start_of_len, "%ld", (size_t *)&grp->dim->len); */
/* #endif */
/* } */
(*dim_without_var)++;
}
}

View File

@ -108,7 +108,7 @@ typedef struct NC_DIM_INFO
int dirty;
unsigned char coord_var_in_grp;
struct NC_VAR_INFO *coord_var; /* The coord var, if it exists. */
int too_long; /* True is len it too big to fit in local size_t. */
int too_long; /* True if len it too big to fit in local size_t. */
} NC_DIM_INFO_T;
typedef struct

View File

@ -78,7 +78,8 @@ nc4_reopen_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var)
/* Set chunk cache size for a variable. */
int
NC4_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption)
NC4_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems,
float preemption)
{
NC_FILE_INFO_T *nc;
NC_GRP_INFO_T *grp;
@ -144,7 +145,8 @@ nc_set_var_chunk_cache_ints(int ncid, int varid, int size, int nelems,
/* Get chunk cache size for a variable. */
int
NC4_get_var_chunk_cache(int ncid, int varid, size_t *sizep, size_t *nelemsp, float *preemptionp)
NC4_get_var_chunk_cache(int ncid, int varid, size_t *sizep,
size_t *nelemsp, float *preemptionp)
{
NC_FILE_INFO_T *nc;
NC_GRP_INFO_T *grp;

View File

@ -9,14 +9,14 @@ echo ""
echo "Testing programs with valgrind..."
# These are my test programs.
list='tst_h_dimscales tst_h_vl2 tst_h_files '\
list='tst_h_dimscales tst_h_files '\
'tst_h_atts2 tst_h_dimscales2 tst_h_enums '\
'tst_h_grps tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl tst_h_atts '\
'tst_h_dimscales3 tst_h_files2 tst_h_compounds '\
'tst_h_vars tst_h_opaques tst_h_compounds2 '\
'tst_atts tst_atts2 tst_vl tst_compounds '\
'tst_files tst_utf8 tst_fillbug tst_v2 '\
'tst_vars2 tst_vars3 tst_xplatform tst_dims '\
'tst_vl tst_compounds '\
'tst_files tst_utf8 tst_fillbug '\
'tst_vars3 tst_xplatform tst_dims '\
'tst_dims2 tst_dims3 tst_varms tst_unlim_vars '\
'tst_endian_fill tst_compounds2'

View File

@ -401,94 +401,6 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
printf("*** Checking a HDF5 file with scalar, fixed-length string dataset...");
{
#define VAR_NAME "Gettysburg Address"
hid_t fapl_id, fcpl_id, fileid, grpid, spaceid, typeid, datasetid, plistid;
/*void *fillp;*/
/*int ncid, nvars_in, ndims_in, natts_in, unlimdim_in, type_in;*/
/*size_t size_in;*/
char data[] = "Four score and seven years ago our fathers brought forth on "
"this continent, a new nation, conceived in Liberty, and dedicated to "
"the proposition that all men are created equal. Now we are engaged "
"in a great civil war, testing whether that nation, or any nation so "
"conceived and so dedicated, can long endure. We are met on a great "
"battle-field of that war. We have come to dedicate a portion of that "
"field, as a final resting place for those who here gave their lives "
"that that nation might live. It is altogether fitting and proper that "
"we should do this. But, in a larger sense, we can not dedicate -- we "
"can not consecrate -- we can not hallow -- this ground. The brave men, "
"living and dead, who struggled here, have consecrated it, far above our "
"poor power to add or detract. The world will little note, nor long "
"remember what we say here, but it can never forget what they did here. "
"It is for us the living, rather, to be dedicated here to the unfinished "
"work which they who fought here have thus far so nobly advanced. It is "
"rather for us to be here dedicated to the great task remaining before "
"us -- that from these honored dead we take increased devotion to that "
"cause for which they gave the last full measure of devotion -- that we "
"here highly resolve that these dead shall not have died in vain -- that "
"this nation, under God, shall have a new birth of freedom -- and that "
"government of the people, by the people, for the people, shall not "
"perish from the earth.";
char *empty = "";
/*char *data_in2;*/
/* Create file access and create property lists. */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
/* Set latest_format in access propertly list. This ensures that
* the latest, greatest, HDF5 versions are used in the file. */
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR;
/* Set H5P_CRT_ORDER_TRACKED in the creation property list. This
* turns on HDF5 creation ordering in the file. */
if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
/* Create the file, open root group. */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR;
if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR;
/* Create string type. */
if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR;
if (H5Tset_size(typeid, strlen(data) + 1) < 0) ERR;
/* Create a scalar space. */
if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
/* Write an scalar dataset of this type. */
if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
if (H5Pset_fill_value(plistid, typeid, &empty) < 0) ERR;
if ((datasetid = H5Dcreate1(grpid, VAR_NAME, typeid,
spaceid, plistid)) < 0) ERR;
if (H5Dwrite(datasetid, typeid, spaceid, spaceid,
H5P_DEFAULT, data) < 0) ERR;
/* Close up. */
if (H5Dclose(datasetid) < 0) ERR;
if (H5Pclose(fapl_id) < 0) ERR;
if (H5Pclose(fcpl_id) < 0) ERR;
if (H5Pclose(plistid) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
if (H5Gclose(grpid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
/* Read the file with netCDF-4. */
/* if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR; */
/* if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR; */
/* if (ndims_in != 0 || nvars_in != 1 || natts_in != 0 || unlimdim_in != -1) ERR; */
/* if (nc_inq_att(ncid, NC_GLOBAL, ATT_NAME2, &type_in, &size_in)) ERR; */
/* if (type_in != NC_STRING || size_in != ATT_LEN) ERR; */
/* if (nc_get_att_string(ncid, NC_GLOBAL, ATT_NAME2, data_in2)) ERR; */
/* for (i = 0; i < size_in; i++) */
/* if (strcmp(data[i], data_in2[i])) ERR; */
/* if (nc_free_string(size_in, data_in2)) ERR; */
/* if (nc_close(ncid)) ERR; */
}
SUMMARIZE_ERR;
/* printf("**** testing 2D coordinate variable..."); */
/* { */

180
libsrc4/tst_interops6.c Normal file
View File

@ -0,0 +1,180 @@
/* This is part of the netCDF package. Copyright 2010 University
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use.
Test that HDF5 and NetCDF-4 can read and write the same file.
$Id: tst_interops.c,v 1.24 2010/06/01 15:34:52 ed Exp $
*/
#include <config.h>
#include <nc_tests.h>
#include <hdf5.h>
#include <H5DSpublic.h>
#define FILE_NAME "tst_interops6.h5"
int
main(int argc, char **argv)
{
printf("\n*** Testing HDF5/NetCDF-4 interoperability yet again...\n");
printf("*** Checking a HDF5 file with scalar, fixed-length string dataset...");
{
#define VAR_NAME "Marcus_Aurelius"
hid_t fapl_id, fcpl_id, fileid, grpid, spaceid, typeid, datasetid, plistid;
int ncid, nvars_in, ndims_in, natts_in, unlimdim_in, type_in;
size_t size_in;
char data[] = "Thou art no dissatisfied, I suppose, because "
"thou weighest only so many liters and not three hundred. Be not "
"dissatisfied then that thou must live only so many years and not more; "
"for as thou art satisfied with the amount of substance which has "
"been assigned to thee, so be content with the time.";
char *empty = "";
char *data_in2, name_in[NC_MAX_NAME + 1];
/* Create file access and create property lists. */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR;
/* Set latest_format in access propertly list. This ensures that
* the latest, greatest, HDF5 versions are used in the file. */
if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR;
/* Set H5P_CRT_ORDER_TRACKED in the creation property list. This
* turns on HDF5 creation ordering in the file. */
if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED |
H5P_CRT_ORDER_INDEXED)) < 0) ERR;
/* Create the file, open root group. */
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR;
if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR;
/* Create string type. */
if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR;
if (H5Tset_size(typeid, strlen(data) + 1) < 0) ERR;
/* Create a scalar space. */
if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR;
/* Write an scalar dataset of this type. */
if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR;
if (H5Pset_fill_value(plistid, typeid, &empty) < 0) ERR;
if ((datasetid = H5Dcreate1(grpid, VAR_NAME, typeid,
spaceid, plistid)) < 0) ERR;
if (H5Dwrite(datasetid, typeid, spaceid, spaceid,
H5P_DEFAULT, data) < 0) ERR;
/* Close up. */
if (H5Dclose(datasetid) < 0) ERR;
if (H5Pclose(fapl_id) < 0) ERR;
if (H5Pclose(fcpl_id) < 0) ERR;
if (H5Pclose(plistid) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
if (H5Gclose(grpid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
/* Read the file with netCDF-4. */
/* nc_set_log_level(6); */
/* if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR; */
/* if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR; */
/* if (ndims_in != 0 || nvars_in != 1 || natts_in != 0 || unlimdim_in != -1) ERR; */
/* if (nc_inq_var(ncid, 0, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR; */
/* if (strcmp(name_in, VAR_NAME) || type_in != NC_STRING || */
/* ndims_in != 0 || natts_in != 0) ERR; */
/* if (nc_get_var_string(ncid, 0, &data_in2)) ERR; */
/* if (strcmp(data_in2, data)) ERR; */
/* if (nc_free_string(size_in, &data_in2)) ERR; */
/* if (nc_close(ncid)) ERR;*/
}
SUMMARIZE_ERR;
/* printf("*** Checking a HDF5 file with scalar, fixed-length string dataset..."); */
/* { */
/* #define VAR_NAME "Gettysburg Address" */
/* hid_t fapl_id, fcpl_id, fileid, grpid, spaceid, typeid, datasetid, plistid; */
/* int ncid, nvars_in, ndims_in, natts_in, unlimdim_in, type_in; */
/* size_t size_in; */
/* char data[] = "Four score and seven years ago our fathers brought forth on " */
/* "this continent, a new nation, conceived in Liberty, and dedicated to " */
/* "the proposition that all men are created equal. Now we are engaged " */
/* "in a great civil war, testing whether that nation, or any nation so " */
/* "conceived and so dedicated, can long endure. We are met on a great " */
/* "battle-field of that war. We have come to dedicate a portion of that " */
/* "field, as a final resting place for those who here gave their lives " */
/* "that that nation might live. It is altogether fitting and proper that " */
/* "we should do this. But, in a larger sense, we can not dedicate -- we " */
/* "can not consecrate -- we can not hallow -- this ground. The brave men, " */
/* "living and dead, who struggled here, have consecrated it, far above our " */
/* "poor power to add or detract. The world will little note, nor long " */
/* "remember what we say here, but it can never forget what they did here. " */
/* "It is for us the living, rather, to be dedicated here to the unfinished " */
/* "work which they who fought here have thus far so nobly advanced. It is " */
/* "rather for us to be here dedicated to the great task remaining before " */
/* "us -- that from these honored dead we take increased devotion to that " */
/* "cause for which they gave the last full measure of devotion -- that we " */
/* "here highly resolve that these dead shall not have died in vain -- that " */
/* "this nation, under God, shall have a new birth of freedom -- and that " */
/* "government of the people, by the people, for the people, shall not " */
/* "perish from the earth."; */
/* char *empty = ""; */
/* char *data_in2, name_in[NC_MAX_NAME + 1]; */
/* /\* Create file access and create property lists. *\/ */
/* if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; */
/* if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR; */
/* /\* Set latest_format in access propertly list. This ensures that */
/* * the latest, greatest, HDF5 versions are used in the file. *\/ */
/* if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR; */
/* /\* Set H5P_CRT_ORDER_TRACKED in the creation property list. This */
/* * turns on HDF5 creation ordering in the file. *\/ */
/* if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | */
/* H5P_CRT_ORDER_INDEXED)) < 0) ERR; */
/* if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | */
/* H5P_CRT_ORDER_INDEXED)) < 0) ERR; */
/* /\* Create the file, open root group. *\/ */
/* if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR; */
/* if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; */
/* /\* Create string type. *\/ */
/* if ((typeid = H5Tcopy(H5T_C_S1)) < 0) ERR; */
/* if (H5Tset_size(typeid, strlen(data) + 1) < 0) ERR; */
/* /\* Create a scalar space. *\/ */
/* if ((spaceid = H5Screate(H5S_SCALAR)) < 0) ERR; */
/* /\* Write an scalar dataset of this type. *\/ */
/* if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR; */
/* if (H5Pset_fill_value(plistid, typeid, &empty) < 0) ERR; */
/* if ((datasetid = H5Dcreate1(grpid, VAR_NAME, typeid, */
/* spaceid, plistid)) < 0) ERR; */
/* if (H5Dwrite(datasetid, typeid, spaceid, spaceid, */
/* H5P_DEFAULT, data) < 0) ERR; */
/* /\* Close up. *\/ */
/* if (H5Dclose(datasetid) < 0) ERR; */
/* if (H5Pclose(fapl_id) < 0) ERR; */
/* if (H5Pclose(fcpl_id) < 0) ERR; */
/* if (H5Pclose(plistid) < 0) ERR; */
/* if (H5Tclose(typeid) < 0) ERR; */
/* if (H5Gclose(grpid) < 0) ERR; */
/* if (H5Fclose(fileid) < 0) ERR; */
/* /\* Read the file with netCDF-4. *\/ */
/* if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR; */
/* if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR; */
/* if (ndims_in != 0 || nvars_in != 1 || natts_in != 0 || unlimdim_in != -1) ERR; */
/* if (nc_inq_var(ncid, 0, name_in, &type_in, &ndims_in, NULL, &natts_in)) ERR; */
/* if (strcmp(name_in, VAR_NAME) || type_in != NC_STRING || */
/* ndims_in != 0 || natts_in != 0) ERR; */
/* if (nc_get_var_string(ncid, 0, &data_in2)) ERR; */
/* if (strcmp(data_in2, data)) ERR; */
/* if (nc_free_string(size_in, &data_in2)) ERR; */
/* if (nc_close(ncid)) ERR; */
/* } */
/* SUMMARIZE_ERR; */
FINAL_RESULTS;
}

View File

@ -357,7 +357,7 @@ main(int argc, char **argv)
if (nc_put_var_int(ncid, int_varid, (int *)int_out)) ERR;
if (nc_put_var_float(ncid, float_varid, (float *)float_out)) ERR;
if (nc_put_var_double(ncid, double_varid, (double *)double_out)) ERR;
if (nc_put_var_ubyte(ncid, ubyte_varid, (unsigned char *)ubyte_out)) ERR;
if (nc_put_var_uchar(ncid, ubyte_varid, (unsigned char *)ubyte_out)) ERR;
if (nc_put_var_ushort(ncid, ushort_varid, (unsigned short *)ushort_out)) ERR;
if (nc_put_var_uint(ncid, uint_varid, (unsigned int *)uint_out)) ERR;
if (nc_put_var_longlong(ncid, int64_varid, (long long *)int64_out)) ERR;
@ -614,7 +614,7 @@ main(int argc, char **argv)
if (nc_put_var_int(ncid, int_varid, (int *)int_out)) ERR;
if (nc_put_var_float(ncid, float_varid, (float *)float_out)) ERR;
if (nc_put_var_double(ncid, double_varid, (double *)double_out)) ERR;
if (nc_put_var_ubyte(ncid, ubyte_varid, (unsigned char *)ubyte_out)) ERR;
if (nc_put_var_uchar(ncid, ubyte_varid, (unsigned char *)ubyte_out)) ERR;
if (nc_put_var_ushort(ncid, ushort_varid, (unsigned short *)ushort_out)) ERR;
if (nc_put_var_uint(ncid, uint_varid, (unsigned int *)uint_out)) ERR;
if (nc_put_var_longlong(ncid, int64_varid, (long long *)int64_out)) ERR;

View File

@ -202,6 +202,7 @@ Variables
* nc_rename_var:: Rename a Variable
* nc_copy_var::
* nc_var_par_access::
* nc_var_ubyte::
Reading and Writing Character String Values
@ -6349,6 +6350,7 @@ See the example section for @ref{nc_inq_enum} for a full example.
* nc_rename_var:: Rename a Variable
* nc_copy_var::
* nc_var_par_access::
* nc_var_ubyte:: Deprecated variable ``_ubyte'' functions
@end menu
@node Variable Introduction, Variable Types, Variables, Variables
@ -7913,7 +7915,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_put_var1_long
@findex nc_put_var1_float
@findex nc_put_var1_double
@findex nc_put_var1_ubyte
@findex nc_put_var1_ushort
@findex nc_put_var1_uint
@findex nc_put_var1_longlong
@ -7953,8 +7954,6 @@ int nc_put_var1_float (int ncid, int varid, const size_t index[],
const float *fp);
int nc_put_var1_double(int ncid, int varid, const size_t index[],
const double *dp);
int nc_put_var1_ubyte (int ncid, int varid, const size_t index[],
const unsigned char *up);
int nc_put_var1_ushort(int ncid, int varid, const size_t index[],
const unsigned short *sp);
int nc_put_var1_uint (int ncid, int varid, const size_t index[],
@ -8072,7 +8071,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_put_var_long
@findex nc_put_var_float
@findex nc_put_var_double
@findex nc_put_var_ubyte
@findex nc_put_var_ushort
@findex nc_put_var_uint
@findex nc_put_var_longlong
@ -8116,7 +8114,6 @@ int nc_put_var_int (int ncid, int varid, const int *ip);
int nc_put_var_long (int ncid, int varid, const long *lp);
int nc_put_var_float (int ncid, int varid, const float *fp);
int nc_put_var_double(int ncid, int varid, const double *dp);
int nc_put_var_ubyte (int ncid, int varid, const unsigned char *op);
int nc_put_var_ushort(int ncid, int varid, const unsigned short *op);
int nc_put_var_uint (int ncid, int varid, const unsigned int *op);
int nc_put_var_longlong (int ncid, int varid, const long long *op);
@ -8223,7 +8220,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_put_vara_long
@findex nc_put_vara_float
@findex nc_put_vara_double
@findex nc_put_vara_ubyte
@findex nc_put_vara_ushort
@findex nc_put_vara_uint
@findex nc_put_vara_longlong
@ -8267,8 +8263,6 @@ int nc_put_vara_float (int ncid, int varid, const size_t start[],
const size_t count[], const float *fp);
int nc_put_vara_double(int ncid, int varid, const size_t start[],
const size_t count[], const double *dp);
int nc_put_vara_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned char *op);
int nc_put_vara_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned short *op);
int nc_put_vara_uint (int ncid, int varid, const size_t *startp,
@ -8425,7 +8419,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_put_vars_long
@findex nc_put_vars_float
@findex nc_put_vars_double
@findex nc_put_vars_ubyte
@findex nc_put_vars_ushort
@findex nc_put_vars_uint
@findex nc_put_vars_longlong
@ -8474,9 +8467,6 @@ int nc_put_vars_float (int ncid, int varid, const size_t start[],
int nc_put_vars_double(int ncid, int varid, const size_t start[],
const size_t count[], const ptrdiff_t stride[],
const double *dp);
int nc_put_vars_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned char *op);
int nc_put_vars_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned short *op);
@ -8647,7 +8637,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_put_varm_long
@findex nc_put_varm_float
@findex nc_put_varm_double
@findex nc_put_varm_ubyte
@findex nc_put_varm_ushort
@findex nc_put_varm_uint
@findex nc_put_varm_longlong
@ -8699,9 +8688,6 @@ int nc_put_varm_float (int ncid, int varid, const size_t start[],
int nc_put_varm_double(int ncid, int varid, const size_t start[],
const size_t count[], const ptrdiff_t stride[],
const ptrdiff_t imap[], const double *dp);
int nc_put_varm_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned char *op);
int nc_put_varm_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned short *op);
@ -8934,7 +8920,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_get_var1_long
@findex nc_get_var1_float
@findex nc_get_var1_double
@findex nc_get_var1_ubyte
@findex nc_get_var1_ushort
@findex nc_get_var1_uint
@findex nc_get_var1_longlong
@ -8975,8 +8960,6 @@ int nc_get_var1_float (int ncid, int varid, const size_t index[],
float *fp);
int nc_get_var1_double(int ncid, int varid, const size_t index[],
double *dp);
int nc_get_var1_ubyte (int ncid, int varid, const size_t *indexp,
unsigned char *ip);
int nc_get_var1_ushort(int ncid, int varid, const size_t *indexp,
unsigned short *ip);
int nc_get_var1_uint (int ncid, int varid, const size_t *indexp,
@ -9106,7 +9089,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_get_var_long
@findex nc_get_var_float
@findex nc_get_var_double
@findex nc_get_var_ubyte
@findex nc_get_var_ushort
@findex nc_get_var_uint
@findex nc_get_var_longlong
@ -9145,7 +9127,6 @@ int nc_get_var_int (int ncid, int varid, int *ip);
int nc_get_var_long (int ncid, int varid, long *lp);
int nc_get_var_float (int ncid, int varid, float *fp);
int nc_get_var_double(int ncid, int varid, double *dp);
int nc_get_var_ubyte (int ncid, int varid, unsigned char *ip);
int nc_get_var_ushort(int ncid, int varid, unsigned short *ip);
int nc_get_var_uint (int ncid, int varid, unsigned int *ip);
int nc_get_var_longlong (int ncid, int varid, long long *ip);
@ -9264,7 +9245,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_get_vara_long
@findex nc_get_vara_float
@findex nc_get_vara_double
@findex nc_get_vara_ubyte
@findex nc_get_vara_ushort
@findex nc_get_vara_uint
@findex nc_get_vara_longlong
@ -9304,8 +9284,6 @@ int nc_get_vara_float (int ncid, int varid, const size_t start[],
const size_t count[], float *fp);
int nc_get_vara_double(int ncid, int varid, const size_t start[],
const size_t count[], double *dp);
int nc_get_vara_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned char *ip);
int nc_get_vara_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned short *ip);
int nc_get_vara_uint (int ncid, int varid, const size_t *startp,
@ -9444,7 +9422,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_get_vars_long
@findex nc_get_vars_float
@findex nc_get_vars_double
@findex nc_get_vars_ubyte
@findex nc_get_vars_ushort
@findex nc_get_vars_uint
@findex nc_get_vars_longlong
@ -9493,9 +9470,6 @@ int nc_get_vars_float (int ncid, int varid, const size_t start[],
int nc_get_vars_double(int ncid, int varid, const size_t start[],
const size_t count[], const ptrdiff_t stride[],
double *dp)
int nc_get_vars_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned char *ip);
int nc_get_vars_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned short *ip);
@ -9660,7 +9634,6 @@ if (status != NC_NOERR) handle_error(status);
@findex nc_get_varm_long
@findex nc_get_varm_float
@findex nc_get_varm_double
@findex nc_get_varm_ubyte
@findex nc_get_varm_ushort
@findex nc_get_varm_uint
@findex nc_get_varm_longlong
@ -9713,9 +9686,6 @@ int nc_get_varm_float (int ncid, int varid, const size_t start[],
int nc_get_varm_double(int ncid, int varid, const size_t start[],
const size_t count[], const ptrdiff_t stride[],
const ptrdiff_t imap[], double *dp);
int nc_get_varm_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned char *ip);
int nc_get_varm_ushort(int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned short *ip);
@ -10280,10 +10250,17 @@ This function will copy a variable from one file to another.
It works even if the files are different formats, (i.e. classic
vs. netCDF-4/HDF5.)
If you're copying into a netcdf-3 file, from a netcdf-4 file, you must
be copying a var of one of the six netcdf-3 types. Similarly for the
If you're copying into a netCDF-3 file, from a netCDF-4 file, you must
be copying a var of one of the six netCDF-3 types. Similarly for the
attributes.
For large netCDF-3 files, this can be a very inefficient way to copy
data from one file to another, because adding a new variable to the
target file may require more space in the header and thus result in
moving data for other variables in the target file. This is not a problem
for netCDF-4 files, which support efficient addition of variables
without moving data for other variables.
@heading Usage
@example
@ -10332,7 +10309,7 @@ One or more values out of range.
@example
@end example
@node nc_var_par_access, , nc_copy_var, Variables
@node nc_var_par_access, nc_var_ubyte, nc_copy_var, Variables
@section Change between Collective and Independent Parallel Access: nc_var_par_access
@findex nc_var_par_access
@cindex nc_var_par_access, example
@ -10424,6 +10401,48 @@ Here is an example using nc_var_par_access:
@end example
@node nc_var_ubyte, , nc_var_par_access, Variables
@section Deprecated ``_ubyte'' variable functions
@findex nc_put_var1_ubyte
@findex nc_put_var_ubyte
@findex nc_put_vara_ubyte
@findex nc_put_vars_ubyte
@findex nc_put_varm_ubyte
@findex nc_get_var1_ubyte
@findex nc_get_var_ubyte
@findex nc_get_vara_ubyte
@findex nc_get_vars_ubyte
@findex nc_get_varm_ubyte
Note: the following functions are also defined but deprecated, as they
are identical in arguments and behavior to the corresponding functions
with ``uchar'' substituted for ``ubyte'' in the function name.
@example
int nc_put_var1_ubyte (int ncid, int varid, const size_t index[],
const unsigned char *up);
int nc_put_var_ubyte (int ncid, int varid, const unsigned char *op);
int nc_put_vara_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const unsigned char *op);
int nc_put_vars_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const unsigned char *op);
int nc_put_varm_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, const unsigned char *op);
int nc_get_var1_ubyte (int ncid, int varid, const size_t *indexp,
unsigned char *ip);
int nc_get_var_ubyte (int ncid, int varid, unsigned char *ip);
int nc_get_vara_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, unsigned char *ip);
int nc_get_vars_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
unsigned char *ip);
int nc_get_varm_ubyte (int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t * imapp, unsigned char *ip);
@end example
@node Attributes, Summary of C Interface, Variables, Top
@chapter Attributes
@ -10435,6 +10454,7 @@ Here is an example using nc_var_par_access:
* nc_copy_att::
* nc_rename_att::
* nc_del_att::
* nc_att_ubyte:: Deprecated attribute ``_ubyte'' functions
@end menu
@node Attributes Introduction, nc_put_att_ type, Attributes, Attributes
@ -10534,8 +10554,6 @@ int nc_put_att_float (int ncid, int varid, const char *name, nc_type xtype,
size_t len, const float *fp);
int nc_put_att_double (int ncid, int varid, const char *name, nc_type xtype,
size_t len, const double *dp);
int nc_put_att_ubyte (int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned char *op);
int nc_put_att_ushort (int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned short *op);
int nc_put_att_uint (int ncid, int varid, const char *name, nc_type xtype,
@ -10840,7 +10858,6 @@ int nc_get_att_int (int ncid, int varid, const char *name, int *ip);
int nc_get_att_long (int ncid, int varid, const char *name, long *lp);
int nc_get_att_float (int ncid, int varid, const char *name, float *fp);
int nc_get_att_double (int ncid, int varid, const char *name, double *dp);
int nc_get_att_ubyte (int ncid, int varid, const char *name, unsigned char *ip);
int nc_get_att_ushort (int ncid, int varid, const char *name, unsigned short *ip);
int nc_get_att_uint (int ncid, int varid, const char *name, unsigned int *ip);
int nc_get_att_longlong (int ncid, int varid, const char *name, long long *ip);
@ -11139,7 +11156,7 @@ status = nc_rename_att(ncid, rh_id, "units", "Units");
if (status != NC_NOERR) handle_error(status);
@end example
@node nc_del_att, , nc_rename_att, Attributes
@node nc_del_att, nc_att_ubyte, nc_rename_att, Attributes
@section Delete an Attribute: nc_del_att
@findex nc_del_att
@cindex nc_del_att, example
@ -11211,6 +11228,21 @@ status = nc_enddef(ncid); /* leave define mode */
if (status != NC_NOERR) handle_error(status);
@end example
@node nc_att_ubyte, , nc_del_att, Attributes
@findex nc_put_att_ubyte
@findex nc_get_att_ubyte
Note: the following functions are also defined but deprecated, as they
are identical in arguments and behavior to the corresponding functions
with ``uchar'' substituted for ``ubyte'' in the function name.
@example
int nc_put_att_ubyte (int ncid, int varid, const char *name, nc_type xtype,
size_t len, const unsigned char *op);
int nc_get_att_ubyte (int ncid, int varid, const char *name, unsigned char *ip);
@end example
@node Summary of C Interface, NetCDF 3 Transition Guide, Attributes, Top
@appendix Summary of C Interface
@cindex API, C summary
@ -11882,7 +11914,10 @@ treat NC_BYTE as signed for the purposes of conversion to short, int,
long, float, or double. (Of course, no conversion takes place when the
internal type is signed char.) In the _uchar functions, we treat
NC_BYTE as if it were unsigned. Thus, no NC_ERANGE error can occur
converting between NC_BYTE and unsigned char.
converting between NC_BYTE and unsigned char. The _uchar and _schar
functions will behave differently when writing data or attribute
values to a larger type, because the type conversion is from unsigned
or signed to the larger type, respectively.
@section Error handling

View File

@ -13,7 +13,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/liblib @EXTERN_CFLAGS@
# Unfortunately, libsrc4 contains nc_test.h
AM_CPPFLAGS += -I$(top_srcdir)/libsrc4 -I$(top_srcdir)/libsrc
# Our test programs and sources...
# Our test programs and sources. (tst_h_vl2 must come after tst_vl.)
NC4_TEST_PROGS = t_type cdm_sea_soundings tst_camrun tst_vl tst_atts \
tst_atts2 tst_vars2
cdm_sea_soundings_SOURCES = cdm_sea_soundings.c tests.h
@ -67,6 +67,12 @@ tst_interops2_LDADD = ${lib_LTLIBRARIES} -lmfhdf -ldf -ljpeg -lhdf5_hl \
-lhdf5 -lz
endif # USE_HDF4
# This will run a bunch of the test programs with valgrind, the memory
# checking tool. (Valgrind must be present for this to work.)
if USE_VALGRIND_TESTS
TESTS += run_valgrind_tests.sh
endif # USE_VALGRIND_TESTS
CLEANFILES = cdm_sea_soundings.nc bm_chunking.nc bm_radar.nc \
bm_radar1.nc radar_3d_compression_test.txt radar_3d_compression.txt \
radar_2d_compression.txt radar_3d_chunking.txt tst_floats_1D.cdl \
@ -92,7 +98,7 @@ EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh run_bm_test2.sh \
run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh run_par_bm_test.sh \
run_bm_elena.sh run_par_bm_radar_2D.sh run_bm_radar_2D_endianness1.sh \
run_tst_chunks.sh ref_chunks1.cdl ref_chunks2.cdl run_pnetcdf_test.sh \
run_get_hdf4_files.sh
run_get_hdf4_files.sh run_valgrind_tests.sh
if USE_HDF4_FILE_TESTS
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \

27
nc_test4/run_valgrind_tests.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# This shell runs the tests with valgrind.
# $Id: run_valgrind_tests.sh,v 1.9 2010/01/26 20:24:18 ed Exp $
set -e
echo ""
echo "Testing programs with valgrind..."
# These are my test programs.
list='tst_v2 '\
'tst_vars2 tst_atts tst_atts2 tst_h_vl2'
# These don't work yet: tst_h_vars3
# tst_h_strings tst_h_atts3 tst_h_vars2 tst_vars tst_fills tst_chunks
# tst_coords tst_xplatform2
for tst in $list; do
echo ""
echo "Memory testing with $tst:"
valgrind -q --error-exitcode=2 --leak-check=full ./$tst
done
echo "SUCCESS!!!"
exit 0

View File

@ -15,8 +15,7 @@ int
main()
{
printf("\n*** Checking HDF5 VLEN types even more.\n");
#ifdef EXTRA_TESTS
printf("*** Reading reference file...");
printf("*** Reading file created by netcdf-4 tests tst_vl...");
{
hid_t fileid, grpid, fapl_id, hdf_typeid = 0, base_hdf_typeid = 0, attid = 0;
hid_t file_typeid, spaceid, native_typeid;
@ -43,34 +42,31 @@ main()
for (i = 0; i < num_obj; i++)
{
if (H5Oget_info_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC,
i, &obj_info, H5P_DEFAULT) < 0) ERR;
i, &obj_info, H5P_DEFAULT) < 0) ERR_RET;
obj_class = obj_info.type;
if ((size = H5Lget_name_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i,
NULL, 0, H5P_DEFAULT)) < 0) ERR;
if (size > NC_MAX_NAME) ERR;
NULL, 0, H5P_DEFAULT)) < 0) ERR_RET;
if (size > NC_MAX_NAME) ERR_RET;
if (H5Lget_name_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i,
obj_name, size+1, H5P_DEFAULT) < 0) ERR;
obj_name, size+1, H5P_DEFAULT) < 0) ERR_RET;
/*printf("nc4_rec_read_metadata: encountered HDF5 object obj_class %d obj_name %s.\n",
obj_class, obj_name);*/
/* Deal with groups and datasets. */
switch (obj_class)
{
case H5O_TYPE_GROUP:
printf("group\n");
break;
case H5O_TYPE_DATASET:
printf("dataset\n");
break;
case H5O_TYPE_NAMED_DATATYPE:
printf("type\n");
if ((hdf_typeid = H5Topen2(grpid, obj_name, H5P_DEFAULT)) < 0) ERR;
if ((class = H5Tget_class(hdf_typeid)) < 0) ERR;
if ((hdf_typeid = H5Topen2(grpid, obj_name, H5P_DEFAULT)) < 0) ERR_RET;
if ((class = H5Tget_class(hdf_typeid)) < 0) ERR_RET;
switch (class)
{
case H5T_VLEN:
/* Find the base type of this vlen (i.e. what is this a * vlen of?) and its size. */
if (!(base_hdf_typeid = H5Tget_super(hdf_typeid))) ERR;
if (!(type_size = H5Tget_size(base_hdf_typeid))) ERR;
if (!(base_hdf_typeid = H5Tget_super(hdf_typeid))) ERR_RET;
if (!(type_size = H5Tget_size(base_hdf_typeid))) ERR_RET;
break;
default:
LOG((0, "unknown datatype class"));
@ -91,10 +87,10 @@ main()
{
if (attid > 0)
H5Aclose(attid);
if ((attid = H5Aopen_idx(grpid, (unsigned int)i)) < 0) ERR;
if (H5Aget_name(attid, NC_MAX_NAME + 1, obj_name) < 0) ERR;
if ((attid = H5Aopen_idx(grpid, (unsigned int)i)) < 0) ERR_RET;
if (H5Aget_name(attid, NC_MAX_NAME + 1, obj_name) < 0) ERR_RET;
LOG((4, "reading attribute of _netCDF group, named %s", obj_name));
if ((attid && H5Aclose(attid))) ERR;
if ((attid && H5Aclose(attid))) ERR_RET;
}
/* Open the HDF5 attribute. */
@ -128,7 +124,5 @@ main()
}
SUMMARIZE_ERR;
#endif
FINAL_RESULTS;
}

View File

@ -165,10 +165,10 @@ int main(int argc, char *argv[])
count[0] = 2;
stride[0] = STRIDE_SIZE;
if ((res = nc_put_vars_ubyte(ncid, varid[0], start, count,
if ((res = nc_put_vars_uchar(ncid, varid[0], start, count,
stride, ubyte_data_out)))
BAIL(res);
if ((res = nc_get_vars_ubyte(ncid, varid[0], start, count,
if ((res = nc_get_vars_uchar(ncid, varid[0], start, count,
stride, ubyte_data_in)))
BAIL(res);
if (ubyte_data_in[0] != ubyte_data_out[0]) ERR;
@ -232,9 +232,9 @@ int main(int argc, char *argv[])
start[0] = 0;
count[0] = SIZE;
if ((res = nc_put_vara_ubyte(ncid, varid[0], start, count, ubyte_data_out)))
if ((res = nc_put_vara_uchar(ncid, varid[0], start, count, ubyte_data_out)))
BAIL(res);
if ((res = nc_get_vara_ubyte(ncid, varid[0], start, count, ubyte_data_in)))
if ((res = nc_get_vara_uchar(ncid, varid[0], start, count, ubyte_data_in)))
BAIL(res);
for (i=0; i<SIZE; i++)
if (ubyte_data_in[i] != ubyte_data_out[i]) ERR;
@ -286,11 +286,11 @@ int main(int argc, char *argv[])
errors = 0;
index1[0] = 0;
if ((res = nc_put_var1_ubyte(ncid, varid[0], index1, ubyte_data_out)))
if ((res = nc_put_var1_uchar(ncid, varid[0], index1, uchar_data_out)))
BAIL(res);
if ((res = nc_get_var1_ubyte(ncid, varid[0], index1, ubyte_data_in)))
if ((res = nc_get_var1_uchar(ncid, varid[0], index1, uchar_data_in)))
BAIL(res);
if (ubyte_data_in[0] != ubyte_data_out[0]) ERR;
if (uchar_data_in[0] != uchar_data_out[0]) ERR;
if ((res = nc_put_var1_ushort(ncid, varid[1], index1, ushort_data_out)))
BAIL(res);

View File

@ -306,7 +306,7 @@ int main()
#ifdef USE_NETCDF4
CHECK(nc_inq_varid(ncid, "b", &varid));
CHECK(nc_get_var_ubyte(ncid,varid,uint8));
CHECK(nc_get_var_uchar(ncid,varid,uint8));
#ifdef GENERATE
printf("static %s ubyte_data[DIMSIZE]={","unsigned char");
for(i=0;i<DIMSIZE;i++) printf("%s%hhu",COMMA,uint8[i]);

View File

@ -53,12 +53,12 @@ test: check
# Otherwise never invoked, but records how to do it.
# BTW: note that renaming is essential because otherwise
# autoconf will forcibly delete files of the name *.tab.*
ncgenyy.c: ncgen.l
flex -Pncg -8 ncgen.l
rm -f ncgenyy.c
mv lex.ncg.c ncgenyy.c
ncgentab.c: ncgen.y ncgenyy.c
bison -pncg -t ncgen.y
rm -f ncgentab.c
mv ncgen.tab.c ncgentab.c
#ncgenyy.c: ncgen.l
# flex -Pncg -8 ncgen.l
# rm -f ncgenyy.c
# mv lex.ncg.c ncgenyy.c
#
#ncgentab.c: ncgen.y ncgenyy.c
# bison -pncg -t ncgen.y
# rm -f ncgentab.c
# mv ncgen.tab.c ncgentab.c

View File

@ -401,7 +401,7 @@ genbin_defineattr(Symbol* asym,Bytebuffer* databuf)
} break;
case NC_UBYTE: {
unsigned char* data = (unsigned char*)bbContents(databuf);
stat = nc_put_att_ubyte(grpid,varid,asym->name,typid,len,data);
stat = nc_put_att_uchar(grpid,varid,asym->name,typid,len,data);
check_err(stat,__LINE__,__FILE__);
} break;
case NC_USHORT: {

File diff suppressed because it is too large Load Diff