diff --git a/src/operators.c b/src/operators.c index 4641bb88b477bbaa645616c58c754424d275e783..c4479bdeaef981e1b8d245953b56d4283919b0a5 100644 --- a/src/operators.c +++ b/src/operators.c @@ -5,7 +5,7 @@ \*/ #include "global.h" #include <math.h> -RCSID("$Id: operators.c,v 1.50 1999/03/05 02:15:01 hubbe Exp $"); +RCSID("$Id: operators.c,v 1.51 1999/03/12 22:22:55 per Exp $"); #include "interpret.h" #include "svalue.h" #include "multiset.h" @@ -72,7 +72,6 @@ COMPARISON(f_ge,"`>=",!is_lt) sp[-2]=sp[-1]; \ sp--; - void f_add(INT32 args) { INT_TYPE e,size; @@ -271,7 +270,7 @@ void f_add(INT32 args) break; } - case BIT_FLOAT | BIT_INT: + case BIT_FLOAT|BIT_INT: { FLOAT_TYPE sum; sum=0.0; @@ -300,7 +299,7 @@ void f_add(INT32 args) for(e=1;e<args;e++) if(sp[e-args].type != T_ARRAY) error("`+: trying to add integers and arrays.\n"); - + a=add_arrays(sp-args+1,args-1); pop_n_elems(args); push_array(a); @@ -318,6 +317,25 @@ void f_add(INT32 args) break; } + case BIT_MAPPING|BIT_INT: + { + if(IS_UNDEFINED(sp-args)) + { + int e; + struct mapping *a; + + for(e=1;e<args;e++) + if(sp[e-args].type != T_MAPPING) + error("`+: trying to add integers and mappings.\n"); + + a=add_mappings(sp-args+1,args-1); + pop_n_elems(args); + push_mapping(a); + return; + } + error("`+: trying to add integers and mappings.\n"); + } + case BIT_MAPPING: { struct mapping *m;