mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
1. synch changes with oc2.0
2. Fix a bug in ncgen to catch a special case of a malformed datalist.
This commit is contained in:
parent
f44f553274
commit
628aed80d9
9
cf
9
cf
@ -6,7 +6,7 @@ if test $# != 0 ; then
|
||||
cmds=$@
|
||||
fi
|
||||
|
||||
#HDF5=1
|
||||
HDF5=1
|
||||
DAP=1
|
||||
#PNETCDF=1
|
||||
#HDF4=1
|
||||
@ -17,6 +17,7 @@ DAP=1
|
||||
#M64=1
|
||||
|
||||
#INSTALL=1
|
||||
#PREFIX=/usr/local
|
||||
|
||||
if test "x$cmds" = x ; then
|
||||
cmds=""
|
||||
@ -41,14 +42,16 @@ CC=gcc
|
||||
fi
|
||||
|
||||
# Default cases
|
||||
if test -e "/share/ed/local/${HOST}" ; then
|
||||
if test -f "/share/ed/local/${HOST}" ; then
|
||||
stddir="/share/ed/local/${HOST}"
|
||||
else
|
||||
stddir="/usr/local"
|
||||
fi
|
||||
|
||||
if test "x$INSTALL" = "x1" ; then
|
||||
PREFIX="$stddir/${HOST}"
|
||||
if test "x$PREFIX" = x ; then
|
||||
PREFIX="$stddir/${HOST}"
|
||||
fi
|
||||
else
|
||||
PREFIX="/tmp/local/${HOST}"
|
||||
fi
|
||||
|
@ -2,12 +2,12 @@ NCLIB=../liblib/.libs/libnetcdf.a
|
||||
NCINCL=-I ../liblib
|
||||
|
||||
#CYGWIN
|
||||
#LFLAG=-L/usr/local/lib
|
||||
#HDF5LIB=/usr/local/lib/libhdf5_hl.a /usr/local/lib/libhdf5.a
|
||||
LFLAG=-L/usr/lib -L/usr/local/lib
|
||||
HDF5LIB=/usr/lib/libhdf5_hl.a /usr/lib/libhdf5.a
|
||||
|
||||
#!CYGWIN
|
||||
LFLAG=-L/upc/share/ed/local/${HOST}/lib
|
||||
HDF5LIB=/share/ed/local/${HOST}/lib/libhdf5_hl.a /share/ed/local/${HOST}/lib/libhdf5.a
|
||||
#LFLAG=-L/upc/share/ed/local/${HOST}/lib
|
||||
#HDF5LIB=/share/ed/local/${HOST}/lib/libhdf5_hl.a /share/ed/local/${HOST}/lib/libhdf5.a
|
||||
|
||||
CURLLIB=-lcurl
|
||||
ZLIB=-lz
|
||||
|
@ -1,8 +1,8 @@
|
||||
PARMS=""; ARGS=""; CON="" ; CE=""; OCON="" ; VAR=""; SHARP='#'
|
||||
alias q0=;alias qq=;alias qv=;alias q=;alias qh=;alias qqh=;alias qall=;alias qv=;alias qo=;
|
||||
|
||||
TOP="/home/dmh/mach/trunk"
|
||||
#TOP="/cygdrive/f/svn/trunk"
|
||||
#TOP="/home/dmh/mach/trunk"
|
||||
TOP="/cygdrive/f/svn/trunk"
|
||||
#TOP="/cygdrive/c/Users/dmh/svn/trunk"
|
||||
|
||||
#PROG=./ncd
|
||||
@ -10,9 +10,8 @@ PROG="$TOP/ncdump/ncdump"
|
||||
|
||||
P=`pwd`
|
||||
|
||||
F="http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdCinpKfmT"
|
||||
CON='station&station="Anacapa_Landing_Cove"'
|
||||
#CON="station,longitude,latitude,altitude,time,temperature&station=%22Anacapa_Landing_Cove%22&time>=2007-01-01&time<=2007-06-01"
|
||||
F="http://portal.nersc.gov/pydap/20C_Reanalysis_ensemble/analysis.derived/pwat/pwat_1928.daily.nc"
|
||||
#CON='station&station="Anacapa_Landing_Cove"'
|
||||
|
||||
PARMS="log"
|
||||
#PARMS="${PARMS}&netcdf3"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
#set -x
|
||||
quiet=0
|
||||
leakcheck=0
|
||||
|
||||
|
@ -56,7 +56,7 @@ cd ..
|
||||
|
||||
totalcount=`expr $passcount + $failcount + $xfailcount`
|
||||
okcount=`expr $passcount + $xfailcount`
|
||||
set -x
|
||||
#set -x
|
||||
echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
|
||||
|
||||
if test $failcount -gt 0 ; then
|
||||
|
@ -109,6 +109,8 @@ void srcsetfill(Datasrc* ds, Datalist* list);
|
||||
|
||||
int datalistline(Datalist*);
|
||||
#define datalistith(dl,i) ((dl)==NULL?NULL:((i) >= (dl)->length?NULL:&(dl)->data[i]))
|
||||
#define datalistlen(dl) ((dl)==NULL?0:(dl)->length)
|
||||
|
||||
|
||||
Constant* srcnext(Datasrc*);
|
||||
int srcmore(Datasrc*);
|
||||
|
@ -1,9 +1,7 @@
|
||||
# test: ../ncdump/cdl4/ref_const_test.cdl
|
||||
# test: ../ncdump/cdl4/ref_tst_chardata.cdl
|
||||
K="-k3"
|
||||
F="ref_tst_opaque_data.cdl"
|
||||
F="MAPSS_combined-MAPSS_SC-20120828154820.cdl"
|
||||
F="test.cdl"
|
||||
F="fail.cdl"
|
||||
#B="-B12"
|
||||
DBG="-d"
|
||||
#DBG="-D2"
|
||||
|
@ -314,7 +314,7 @@ generate_basetype(Symbol* tsym, Constant* con, Bytebuffer* codebuf, Datalist* fi
|
||||
break;
|
||||
|
||||
case NC_COMPOUND: {
|
||||
int i,uid;
|
||||
int i,uid, nfields, dllen;
|
||||
if(con == NULL || isfillconst(con)) {
|
||||
Datalist* fill = (filler==NULL?getfiller(tsym):filler);
|
||||
ASSERT(fill->length == 1);
|
||||
@ -326,8 +326,14 @@ generate_basetype(Symbol* tsym, Constant* con, Bytebuffer* codebuf, Datalist* fi
|
||||
semerror(constline(con),"Compound data must be enclosed in {..}");
|
||||
}
|
||||
data = con->value.compoundv;
|
||||
nfields = listlength(tsym->subnodes);
|
||||
dllen = datalistlen(data);
|
||||
if(dllen > nfields) {
|
||||
semerror(con->lineno,"Datalist longer than the number of compound fields");
|
||||
break;
|
||||
}
|
||||
generator->listbegin(generator,LISTCOMPOUND,listlength(tsym->subnodes),codebuf,&uid);
|
||||
for(i=0;i<listlength(tsym->subnodes);i++) {
|
||||
for(i=0;i<nfields;i++) {
|
||||
Symbol* field = (Symbol*)listget(tsym->subnodes,i);
|
||||
con = datalistith(data,i);
|
||||
generator->list(generator,LISTCOMPOUND,uid,i,codebuf);
|
||||
@ -363,7 +369,8 @@ generate_basetype(Symbol* tsym, Constant* con, Bytebuffer* codebuf, Datalist* fi
|
||||
generator->listbegin(generator,LISTVLEN,data->length,codebuf,&uid);
|
||||
for(count=0;count<data->length;count++) {
|
||||
generator->list(generator,LISTVLEN,uid,count,vlenbuf);
|
||||
generate_basetype(tsym->typ.basetype,datalistith(data,count),vlenbuf,NULL,generator);
|
||||
Constant* con = datalistith(data,count);
|
||||
generate_basetype(tsym->typ.basetype,con,vlenbuf,NULL,generator);
|
||||
}
|
||||
generator->listend(generator,LISTVLEN,uid,count,codebuf,(void*)vlenbuf);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
|
||||
/* Need some (unused) definitions to get it to compile */
|
||||
#define ncatt_t void*
|
||||
#define ncvar_t void
|
||||
#include "nctime.h"
|
||||
#include "nctime.h"
|
||||
|
||||
/* parser controls */
|
||||
#define YY_NO_INPUT 1
|
||||
|
@ -82,7 +82,7 @@ static char SccsId[] = "$Id: ncgen.y,v 1.42 2010/05/18 21:32:46 dmh Exp $";
|
||||
/* Need some (unused) definitions to get it to compile */
|
||||
#define ncatt_t void*
|
||||
#define ncvar_t void
|
||||
#include "nctime.h"
|
||||
#include "nctime.h"
|
||||
|
||||
/* parser controls */
|
||||
#define YY_NO_INPUT 1
|
||||
|
@ -1300,7 +1300,7 @@ static int input (void );
|
||||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0)
|
||||
#define ECHO fwrite( ncgtext, ncgleng, 1, ncgout )
|
||||
#endif
|
||||
|
||||
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
||||
@ -1311,7 +1311,7 @@ static int input (void );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
unsigned n; \
|
||||
int n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( ncgin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
|
@ -1,6 +1,6 @@
|
||||
THISDIR=../oc2
|
||||
OCDIR=/home/dmh/svn/oc2.0
|
||||
#OCDIR=f:/svn/oc2.0
|
||||
#OCDIR=/home/dmh/svn/oc2.0
|
||||
OCDIR=f:/svn/oc2.0
|
||||
|
||||
# Make consistent with Makefile.am
|
||||
SRC=oc.c \
|
||||
|
@ -37,7 +37,7 @@ static char* curllookup(char* suffix,char* url);
|
||||
/* The Username and password are in the URL if the URL is of the form:
|
||||
* http://<name>:<passwd>@<host>/....
|
||||
*/
|
||||
int
|
||||
static int
|
||||
occredentials_in_url(const char *url)
|
||||
{
|
||||
char *pos = strstr(url, "http://");
|
||||
@ -50,7 +50,7 @@ occredentials_in_url(const char *url)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
ocextract_credentials(const char *url, char **name, char **pw, char **result_url)
|
||||
{
|
||||
char *pos;
|
||||
|
@ -799,7 +799,8 @@ ocuridecodeonly(char* s, char* only)
|
||||
char* inptr;
|
||||
unsigned int c;
|
||||
|
||||
if (s == NULL) return NULL;
|
||||
if(s == NULL) return NULL;
|
||||
if(only == NULL) only = "";
|
||||
|
||||
slen = strlen(s);
|
||||
decoded = (char*)malloc(slen+1); /* Should be max we need */
|
||||
@ -807,7 +808,7 @@ ocuridecodeonly(char* s, char* only)
|
||||
outptr = decoded;
|
||||
inptr = s;
|
||||
while((c = *inptr++)) {
|
||||
if(c == '+' && only != NULL && strchr(only,'+') != NULL)
|
||||
if(c == '+' && strchr(only,'+') != NULL)
|
||||
*outptr++ = ' ';
|
||||
else if(c == '%') {
|
||||
/* try to pull two hex more characters */
|
||||
@ -816,7 +817,7 @@ ocuridecodeonly(char* s, char* only)
|
||||
&& strchr(hexchars,inptr[1]) != NULL) {
|
||||
/* test conversion */
|
||||
int xc = (fromHex(inptr[0]) << 4) | (fromHex(inptr[1]));
|
||||
if(only == NULL || strchr(only,xc) != NULL) {
|
||||
if(strchr(only,xc) != NULL) {
|
||||
inptr += 2; /* decode it */
|
||||
c = xc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user