Commit e0caf12e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

expr: added function add_new_constant().

parent 2e3eadb6
......@@ -1692,6 +1692,24 @@ param_search_name_rev2(const int nparam, const paramType *params, const char *na
return varID;
}
static void
add_new_constant(const char *varname, parseParamType *parse_arg, paramType *params, const paramType &param)
{
int varID = parse_arg->nparams;
if (varID >= parse_arg->maxparams) cdoAbort("Too many parameter (limit=%d)", parse_arg->maxparams);
param_meta_copy(params[varID], param);
params[varID].type = PARAM_CONST;
params[varID].ngp = 1;
params[varID].nlat = 1;
params[varID].nlev = 1;
params[varID].missval = -9.e33;
params[varID].nmiss = 0;
params[varID].name = strdup(varname);
parse_arg->nparams++;
parse_arg->cnparams++;
}
static void
add_new_param(const char *varname, parseParamType *parse_arg, paramType *params, const paramType &param)
{
......@@ -2019,19 +2037,7 @@ expr_run(nodeType *p, parseParamType *parse_arg)
}
else if (rnode && rnode->type == typeCon)
{
varID = parse_arg->nparams;
if (varID >= parse_arg->maxparams) cdoAbort("Too many parameter (limit=%d)", parse_arg->maxparams);
param_meta_copy(params[varID], rnode->param);
params[varID].type = PARAM_CONST;
params[varID].ngp = 1;
params[varID].nlat = 1;
params[varID].nlev = 1;
params[varID].missval = -9.e33;
params[varID].nmiss = 0;
params[varID].name = strdup(varname2);
parse_arg->nparams++;
parse_arg->cnparams++;
add_new_constant(varname2, parse_arg, params, rnode->param);
}
else if (p->u.opr.op[1]->type != typeCon)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment