diff --git a/cf b/cf index 0f1b574eb..02cf25566 100644 --- a/cf +++ b/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 diff --git a/libdap2/Make0 b/libdap2/Make0 index f5e668996..71513288b 100755 --- a/libdap2/Make0 +++ b/libdap2/Make0 @@ -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 diff --git a/libdap2/env b/libdap2/env index eb7fc20aa..4adca3bea 100644 --- a/libdap2/env +++ b/libdap2/env @@ -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" diff --git a/ncdap_test/tst_ncdap.sh b/ncdap_test/tst_ncdap.sh index fc6753299..7e978e6c8 100755 --- a/ncdap_test/tst_ncdap.sh +++ b/ncdap_test/tst_ncdap.sh @@ -1,6 +1,6 @@ #!/bin/sh -set -x +#set -x quiet=0 leakcheck=0 diff --git a/ncdump/tst_ncgen4_diff.sh b/ncdump/tst_ncgen4_diff.sh index 39a8e5126..6ee9c574b 100755 --- a/ncdump/tst_ncgen4_diff.sh +++ b/ncdump/tst_ncgen4_diff.sh @@ -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 diff --git a/ncgen/data.h b/ncgen/data.h index 3a1019568..4aba56cda 100644 --- a/ncgen/data.h +++ b/ncgen/data.h @@ -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*); diff --git a/ncgen/env b/ncgen/env index fee4e6de1..c657f378a 100644 --- a/ncgen/env +++ b/ncgen/env @@ -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" diff --git a/ncgen/generate.c b/ncgen/generate.c index 1506e6082..b363f3d64 100644 --- a/ncgen/generate.c +++ b/ncgen/generate.c @@ -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;isubnodes);i++) { + for(i=0;isubnodes,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;countlength;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); } diff --git a/ncgen/ncgen.y b/ncgen/ncgen.y index a21f62c94..e2bbf4f27 100644 --- a/ncgen/ncgen.y +++ b/ncgen/ncgen.y @@ -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 diff --git a/ncgen/ncgentab.c b/ncgen/ncgentab.c index 55cfcbfa0..c77df0e19 100644 --- a/ncgen/ncgentab.c +++ b/ncgen/ncgentab.c @@ -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 diff --git a/ncgen/ncgenyy.c b/ncgen/ncgenyy.c index 756b9cdf2..4c7ce0acb 100644 --- a/ncgen/ncgenyy.c +++ b/ncgen/ncgenyy.c @@ -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; \ diff --git a/oc2/Make0 b/oc2/Make0 index 802178446..0d82a1d2f 100755 --- a/oc2/Make0 +++ b/oc2/Make0 @@ -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 \ diff --git a/oc2/ocrc.c b/oc2/ocrc.c index dea291266..93127cee2 100644 --- a/oc2/ocrc.c +++ b/oc2/ocrc.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://:@/.... */ -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; diff --git a/oc2/ocrc.h b/oc2/ocrc.h index 853ab8272..3ba7f2e01 100644 --- a/oc2/ocrc.h +++ b/oc2/ocrc.h @@ -30,7 +30,7 @@ extern int ocdodsrc_read(char* basename,char *in_file_name); extern int ocdodsrc_process(OCstate* state); extern char* ocdodsrc_lookup(char* key, char* url); -extern int occredentials_in_url(const char *url); -extern int ocextract_credentials(const char *url, char **name, char **pw, char **result_url); +static int occredentials_in_url(const char *url); +static int ocextract_credentials(const char *url, char **name, char **pw, char **result_url); #endif /* RC_H_ */ diff --git a/oc2/ocuri.c b/oc2/ocuri.c index 740c16598..4437f94ce 100644 --- a/oc2/ocuri.c +++ b/oc2/ocuri.c @@ -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; }