fix bug in ncgen -lc handling of single character vars

This commit is contained in:
Dennis Heimbigner 2012-02-29 18:54:11 +00:00
parent 75e00f3341
commit 629f712c77
3 changed files with 8 additions and 14 deletions

6
cf
View File

@ -102,10 +102,10 @@ FLAGS="$FLAGS --disable-pnetcdf"
#FLAGS="$FLAGS --with-udunits"
#FLAGS="$FLAGS --with-libcf"
#FLAGS="$FLAGS --enable-benchmarks"
#FLAGS="$FLAGS --enable-extra-tests"
FLAGS="$FLAGS --enable-logging"
FLAGS="$FLAGS --enable-extra-tests"
#FLAGS="$FLAGS --enable-logging"
FLAGS="$FLAGS --disable-shared"
#FLAGS="$FLAGS --disable-shared"
#FLAGS="$FLAGS --enable-shared"
if test "x$HDF5" = "x" ; then

View File

@ -1,8 +1,10 @@
L="-lc"
K="-k1"
alias q0="./ncgen -d $K $L test.cdl"
alias qq="gdb --args ./ncgen -d $K $L test.cdl"
alias qv="valgrind --leak-check=full ./ncgen -d $K $L test.cdl"
F="test"
NCGEN="./.libs/ncgen"
alias q0="$NCGEN -d $K $L $F.cdl"
alias qq="gdb --args $NCGEN -d $K $L $F.cdl"
alias qv="valgrind --leak-check=full $NCGEN -d $K $L $F.cdl"

View File

@ -958,13 +958,6 @@ genc_writevar(Generator* generator, Symbol* vsym, Bytebuffer* code,
if(rank == 0) {
codelined(1,"size_t zero = 0;");
if(typecode == NC_CHAR) {
cquotestring(code,'"');
bbprintf0(stmt,"%sstatic char* %s_data = %s;\n",
indented(1),
cname(vsym),
bbContents(code));
} else {
/* We make the data be an array so we do not need to
ampersand it later => we need an outer pair of braces
*/
@ -974,7 +967,6 @@ genc_writevar(Generator* generator, Symbol* vsym, Bytebuffer* code,
ctypename(basetype),
cname(vsym),
bbContents(code));
}
codedump(stmt);
bbprintf0(stmt,"%sstat = nc_put_var1(%s, %s, &zero, %s_data);\n",
indented(1),