Commit 28f1272c authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Exprf: using MT safe version of bison and flex (bug fix)

parent 01b3c398
2008-04-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Exprf: using MT safe version of bison and flex (bug fix) [report: Claas Teichmann]
* Version 1.1.1 released
2008-01-24 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using CDI library version 1.1.0
......
# Makefile.in generated by automake 1.8.5 from Makefile.am.
# Makefile.in generated by automake 1.8.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
......@@ -94,6 +94,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FC = @FC@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
......@@ -117,8 +118,6 @@ SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
......@@ -131,23 +130,30 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
......@@ -272,16 +278,14 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
......@@ -291,11 +295,9 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
......@@ -404,7 +406,7 @@ distcheck: dist
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
......
# generated automatically by aclocal 1.8.5 -*- Autoconf -*-
# generated automatically by aclocal 1.8.3 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
......@@ -40,7 +40,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"])
# Call AM_AUTOMAKE_VERSION so it can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.8.5])])
[AM_AUTOMAKE_VERSION([1.8.3])])
# AM_AUX_DIR_EXPAND
......@@ -266,14 +266,9 @@ AC_CACHE_CHECK([dependency style of $depcc],
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
# (even with -Werror). So we grep stderr for any message
# that says an option was ignored.
if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
......
......@@ -60,7 +60,7 @@ case "${HOSTNAME}" in
CC=g++ CFLAGS="-g -D_REENTRANT -O2 -Wall -W -Wfloat-equal"
;;
# etch-ia32
baba)
etch-ia32 | gata | baba)
if [ "$SGE_MODE" = "off" ] ; then
${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/etch-ia32 \
--with-netcdf=/client \
......@@ -76,7 +76,7 @@ case "${HOSTNAME}" in
fi
;;
# sarge-ia32
gata)
sarge-ia32)
# opt: -fno-PIC -O4 -march=i686 -mcpu=i686 -pipe -ffast-math -fomit-frame-pointer
if [ "$SGE_MODE" = "off" ] ; then
${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/LINUX \
......@@ -98,7 +98,7 @@ case "${HOSTNAME}" in
CC=gcc CFLAGS="-g -D_REENTRANT -O2 -Wall"
;;
# i386-pc-solaris2.10
yun)
grim)
${CONFPATH}configure --prefix=$HOME/local --exec_prefix=$HOME/local/solaris10-x86 \
--with-netcdf=/client \
CPPFLAGS="-DHAVE_LIBSZ -I$HOME/local/solaris10-x86/include" LIBS=$HOME/local/solaris10-x86/lib/libsz.a \
......
......@@ -63,12 +63,15 @@ void *Expr(void *argument)
double missval;
double *array = NULL;
double *single1, *single2;
prs_sct prs_arg;
extern int yyparse(void *);
extern int yy_scan_string(const char *);
parse_parm_t parse_arg;
void *scanner;
int yy_scan_string(const char *str, void *scanner);
cdoInitialize(argument);
yylex_init(&scanner);
yyset_extra(&parse_arg, scanner);
EXPR = cdoOperatorAdd("expr", 0, 0, "expressions");
EXPRF = cdoOperatorAdd("exprf", 0, 0, "expr script filename");
AEXPR = cdoOperatorAdd("aexpr", 0, 0, "expressions");
......@@ -123,18 +126,21 @@ void *Expr(void *argument)
else
vlistID2 = vlistDuplicate(vlistID1);
prs_arg.init = 1;
prs_arg.vlistID1 = vlistID1;
prs_arg.vlistID2 = vlistID2;
prs_arg.nvars1 = 0;
prs_arg.debug = 0;
parse_arg.init = 1;
parse_arg.vlistID1 = vlistID1;
parse_arg.vlistID2 = vlistID2;
parse_arg.nvars1 = 0;
parse_arg.debug = 0;
parse_arg.gridID2 = -1;
parse_arg.zaxisID2 = -1;
parse_arg.timeID2 = -1;
for ( varID = 0; varID < nvars; varID++ )
prs_arg.var_needed[varID] = FALSE;
parse_arg.var_needed[varID] = FALSE;
yy_scan_string(exprs);
yyparse((void *) &prs_arg);
yy_scan_string(exprs, scanner);
yyparse((void *) &parse_arg, scanner);
prs_arg.init = 0;
parse_arg.init = 0;
nvars2 = vlistNvars(vlistID2);
......@@ -143,8 +149,8 @@ void *Expr(void *argument)
if ( cdoVerbose ) vlistPrint(vlistID2);
for ( varID = 0; varID < nvars; varID++ )
if ( prs_arg.var_needed[varID] && cdoVerbose )
printf("var_needed: %d %s\n", varID, prs_arg.var[varID]);
if ( parse_arg.var_needed[varID] && cdoVerbose )
printf("var_needed: %d %s\n", varID, parse_arg.var[varID]);
taxisID1 = vlistInqTaxis(vlistID1);
taxisID2 = taxisDuplicate(taxisID1);
......@@ -155,21 +161,21 @@ void *Expr(void *argument)
streamDefVlist(streamID2, vlistID2);
prs_arg.vardata1 = (double **) malloc(nvars*sizeof(double*));
prs_arg.vardata2 = (double **) malloc(nvars2*sizeof(double*));
parse_arg.vardata1 = (double **) malloc(nvars*sizeof(double*));
parse_arg.vardata2 = (double **) malloc(nvars2*sizeof(double*));
for ( varID = 0; varID < nvars; varID++ )
{
gridID = vlistInqVarGrid(vlistID1, varID);
zaxisID = vlistInqVarZaxis(vlistID1, varID);
/* prs_arg.missval = vlistInqVarMissval(vlistID1, varID); */
/* parse_arg.missval = vlistInqVarMissval(vlistID1, varID); */
gridsize = gridInqSize(gridID);
nlevel = zaxisInqSize(zaxisID);
if ( prs_arg.var_needed[varID] )
prs_arg.vardata1[varID] = (double *) malloc(gridsize*nlevel*sizeof(double));
if ( parse_arg.var_needed[varID] )
parse_arg.vardata1[varID] = (double *) malloc(gridsize*nlevel*sizeof(double));
else
prs_arg.vardata1[varID] = NULL;
parse_arg.vardata1[varID] = NULL;
}
for ( varID = 0; varID < nvars2; varID++ )
......@@ -179,7 +185,7 @@ void *Expr(void *argument)
gridsize = gridInqSize(gridID);
nlevel = zaxisInqSize(zaxisID);
prs_arg.vardata2[varID] = (double *) malloc(gridsize*nlevel*sizeof(double));
parse_arg.vardata2[varID] = (double *) malloc(gridsize*nlevel*sizeof(double));
}
gridsize = vlistGridsizeMax(vlistID1);
......@@ -195,12 +201,12 @@ void *Expr(void *argument)
for ( recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID1, &varID, &levelID);
if ( prs_arg.var_needed[varID] )
if ( parse_arg.var_needed[varID] )
{
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
offset = gridsize*levelID;
single1 = prs_arg.vardata1[varID] + offset;
single1 = parse_arg.vardata1[varID] + offset;
streamReadRecord(streamID1, single1, &nmiss);
if ( nmiss && lwarn )
{
......@@ -217,11 +223,11 @@ void *Expr(void *argument)
gridsize = gridInqSize(gridID);
nlevel = zaxisInqSize(zaxisID);
memset(prs_arg.vardata2[varID], 0, gridsize*nlevel*sizeof(double));
memset(parse_arg.vardata2[varID], 0, gridsize*nlevel*sizeof(double));
}
yy_scan_string(exprs);
yyparse((void *) &prs_arg);
yy_scan_string(exprs, scanner);
yyparse((void *) &parse_arg, scanner);
for ( varID = 0; varID < nvars2; varID++ )
{
......@@ -231,12 +237,12 @@ void *Expr(void *argument)
gridsize = gridInqSize(gridID);
nlevel = zaxisInqSize(zaxisID);
/* nmiss = prs_arg.nmiss; */
/* nmiss = parse_arg.nmiss; */
/* if ( nmiss ) fprintf(stdout, "out nmiss = %d\n", nmiss); */
for ( levelID = 0; levelID < nlevel; levelID++ )
{
offset = gridsize*levelID;
single2 = prs_arg.vardata2[varID] + offset;
single2 = parse_arg.vardata2[varID] + offset;
nmiss = 0;
if ( missval < -1.e30 || missval > 1.e30 )
{
......@@ -261,6 +267,8 @@ void *Expr(void *argument)
vlistDestroy(vlistID2);
yylex_destroy(scanner);
if ( array ) free(array);
cdoFinish();
......
# Makefile.in generated by automake 1.8.5 from Makefile.am.
# Makefile.in generated by automake 1.8.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
......@@ -238,6 +238,7 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FC = @FC@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
......@@ -261,8 +262,6 @@ SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
......@@ -275,23 +274,30 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
......@@ -779,20 +785,20 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zaxis.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
......@@ -815,11 +821,9 @@ TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
......
......@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2007 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2008 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
......@@ -190,7 +190,7 @@ static void usage(void)
fprintf(stderr, " Operands:\n");
fprintf(stderr, " The path name of the input/output files for the operator.\n");
fprintf(stderr, "\n");
fprintf(stderr, " CDO version %s, Copyright (C) 2003-2007 Uwe Schulzweida\n", VERSION);
fprintf(stderr, " CDO version %s, Copyright (C) 2003-2008 Uwe Schulzweida\n", VERSION);
fprintf(stderr, " Available from http://www.mpimet.mpg.de/cdo\n");
fprintf(stderr, " This is free software and comes with ABSOLUTELY NO WARRANTY\n");
fprintf(stderr, " Report bugs to Uwe.Schulzweida@zmaw.de\n");
......
......@@ -44,9 +44,6 @@ static FUNC fun_sym_tbl[] =
static int NumFunc = sizeof(fun_sym_tbl) / sizeof(fun_sym_tbl[0]);
int gridID2 = -1, zaxisID2 = -1, timeID2 = -1;
nodeType *expr_con_con(int oper, nodeType *p1, nodeType *p2)
{
static char func[] = "expr_con_con";
......@@ -511,7 +508,7 @@ nodeType *ex_uminus(nodeType *p1)
}
int exNode(nodeType *p, prs_sct *prs_arg)
int exNode(nodeType *p, parse_parm_t *parse_arg)
{
int k; /* child number */
......@@ -526,14 +523,14 @@ int exNode(nodeType *p, prs_sct *prs_arg)
/* node has children */
for ( k = 0; k < p->u.opr.nops; k++ )
{
exNode(p->u.opr.op[k], prs_arg);
exNode(p->u.opr.op[k], parse_arg);
}
return (0);
}
nodeType *ex(nodeType *p, prs_sct *prs_arg)
nodeType *ex(nodeType *p, parse_parm_t *parse_arg)
{
static char func[] = "ex";
int gridID1 = -1, zaxisID1 = -1, timeID1 = -1;
......@@ -544,14 +541,14 @@ nodeType *ex(nodeType *p, prs_sct *prs_arg)
if ( ! p ) return (rnode);
/* if ( ! prs_arg->init ) { exNode(p, prs_arg); return (0); } */
/* if ( ! parse_arg->init ) { exNode(p, parse_arg); return (0); } */
switch ( p->type )
{
case typeCon:
if ( prs_arg->init )
if ( parse_arg->init )
{
if ( prs_arg->debug )
if ( parse_arg->debug )
printf("\tpush\t%g\n", p->u.con.value);
}
else
......@@ -561,15 +558,15 @@ nodeType *ex(nodeType *p, prs_sct *prs_arg)
break;
case typeVar:
/* if ( prs_arg->init ) */
/* if ( parse_arg->init ) */
{
if ( prs_arg->debug )
if ( parse_arg->debug )
printf("\tpush\t%s\n", p->u.var.nm);
nvars = vlistNvars(prs_arg->vlistID1);
nvars = vlistNvars(parse_arg->vlistID1);
for ( varID = 0; varID < nvars; varID++ )
{
vlistInqVarName(prs_arg->vlistID1, varID, varname);
vlistInqVarName(parse_arg->vlistID1, varID, varname);
if ( strcmp(varname, p->u.var.nm) == 0 ) break;
}
......@@ -579,90 +576,90 @@ nodeType *ex(nodeType *p, prs_sct *prs_arg)
}
else
{
if ( prs_arg->var_needed[varID] == 0 )
if ( parse_arg->var_needed[varID] == 0 )
{
prs_arg->var[varID] = strdupx(p->u.var.nm);
prs_arg->varID[varID] = varID;
prs_arg->var_needed[varID] = 1;
parse_arg->var[varID] = strdupx(p->u.var.nm);
parse_arg->varID[varID] = varID;
parse_arg->var_needed[varID] = 1;
}
gridID1 = vlistInqVarGrid(prs_arg->vlistID1, varID);
zaxisID1 = vlistInqVarZaxis(prs_arg->vlistID1, varID);
timeID1 = vlistInqVarTime(prs_arg->vlistID1, varID);
missval = vlistInqVarMissval(prs_arg->vlistID1, varID);
gridID1 = vlistInqVarGrid(parse_arg->vlistID1, varID);
zaxisID1 = vlistInqVarZaxis(parse_arg->vlistID1, varID);
timeID1 = vlistInqVarTime(parse_arg->vlistID1, varID);
missval = vlistInqVarMissval(parse_arg->vlistID1, varID);
if ( gridID2 == -1 )
gridID2 = gridID1;
if ( parse_arg->gridID2 == -1 )
parse_arg->gridID2 = gridID1;
if ( zaxisID2 == -1 )
zaxisID2 = zaxisID1;
if ( parse_arg->zaxisID2 == -1 )
parse_arg->zaxisID2 = zaxisID1;
if ( timeID2 == -1 || timeID2 == TIME_CONSTANT )
timeID2 = timeID1;
if ( parse_arg->timeID2 == -1 || parse_arg->timeID2 == TIME_CONSTANT )
parse_arg->timeID2 = timeID1;
}
}
/* else */
{
if ( prs_arg->debug )
if ( parse_arg->debug )
printf("%s %d %d %d\n", p->u.var.nm, varID, gridID1, zaxisID1);
p->gridID = gridID1;
p->zaxisID = zaxisID1;
p->missval = missval;
p->nmiss = 0;
if ( ! prs_arg->init )
p->data = prs_arg->vardata1[varID];
if ( ! parse_arg->init )
p->data = parse_arg->vardata1[varID];
p->tmpvar = 0;
rnode = p;
}
break;
case typeFun:
if ( prs_arg->init )
if ( parse_arg->init )
{
ex(p->u.fun.op, prs_arg);
ex(p->u.fun.op, parse_arg);
if ( prs_arg->debug )
if ( parse_arg->debug )
printf("\tcall \t%s\n", p->u.fun.name);
}
else
{
rnode = ex_fun(p->u.fun.name, ex(p->u.fun.op, prs_arg));
rnode = ex_fun(p->u.fun.name, ex(p->u.fun.op, parse_arg));
}
break;
case typeOpr:
switch( p->u.opr.oper )
{
case '=':
gridID2 = -1;
zaxisID2 = -1;
timeID2 = -1;
parse_arg->gridID2 = -1;
parse_arg->zaxisID2 = -1;
parse_arg->timeID2 = -1;
rnode = ex(p->u.opr.op[1], prs_arg);
rnode = ex(p->u.opr.op[1], parse_arg);
if ( prs_arg->init )
if ( parse_arg->init )
{
if ( prs_arg->debug )
if ( parse_arg->debug )
printf("\tpop\t%s\n", p->u.opr.op[0]->u.var.nm);
/*
if ( p->u.opr.op[1]->type != typeVar )
cdoAbort("Operand not variable!");
*/
if ( gridID2 == -1 || zaxisID2 == -1 || timeID2 == -1 )
if ( parse_arg->gridID2 == -1 || parse_arg->zaxisID2 == -1 || parse_arg->timeID2 == -1 )
cdoAbort("Operand not variable!");
varID = vlistDefVar(prs_arg->vlistID2, gridID2, zaxisID2, timeID2);
vlistDefVarName(prs_arg->vlistID2, varID, p->u.opr.op[0]->u.var.nm);
varID = vlistDefVar(parse_arg->vlistID2, parse_arg->gridID2, parse_arg->zaxisID2, parse_arg->timeID2);
vlistDefVarName(parse_arg->vlistID2, varID, p->u.opr.op[0]->u.var.nm);
}
else
{
if ( prs_arg->debug )
if ( parse_arg->debug )
printf("\tpop\t%s\t%s\n", p->u.opr.op[0]->u.var.nm, rnode->u.var.nm);
nvars = vlistNvars(prs_arg->vlistID2);
nvars = vlistNvars(parse_arg->vlistID2);
for ( varID = 0; varID < nvars; varID++ )
{
vlistInqVarName(prs_arg->vlistID2, varID, varname);
vlistInqVarName(parse_arg->vlistID2, varID, varname);
if ( strcmp(varname, p->u.opr.op[0]->u.var.nm) == 0 ) break;
}
......@@ -672,15 +669,15 @@ nodeType *ex(nodeType *p, prs_sct *prs_arg)
}
else
{
gridID2 = vlistInqVarGrid(prs_arg->vlistID2, varID);
zaxisID2 = vlistInqVarZaxis(prs_arg->vlistID2, varID);
timeID2 = vlistInqVarTime(prs_arg->vlistID2, varID);
missval = vlistInqVarMissval(prs_arg->vlistID2, varID);
parse_arg->gridID2 = vlistInqVarGrid(parse_arg->vlistID2, varID);
parse_arg->zaxisID2 = vlistInqVarZaxis(parse_arg->vlistID2, varID);