Branch: Tag:

2004-10-30

2004-10-30 11:38:29 by Martin Stjernholm <mast@lysator.liu.se>

Implemented from-the-end indexing in ranges using the a[..<1] syntax. Added
`[..]. Still to do: Avoid fallback to `[] for ranges if it doesn't take two
args.

Rev: src/docode.c:1.181
Rev: src/interpret.c:1.358
Rev: src/interpret_functions.h:1.176
Rev: src/language.yacc:1.347
Rev: src/las.c:1.351
Rev: src/lexer.h:1.51
Rev: src/opcodes.h:1.41
Rev: src/operators.c:1.198
Rev: src/operators.h:1.16
Rev: src/pike_types.c:1.238
Rev: src/program.c:1.573
Rev: src/program.h:1.213
Rev: src/testsuite.in:1.741
Rev: src/treeopt.in:1.74

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret_functions.h,v 1.175 2004/10/06 18:35:02 mast Exp $ + || $Id: interpret_functions.h,v 1.176 2004/10/30 11:38:25 mast Exp $   */      /*
656:    dmalloc_touch_svalue(Pike_sp-3);    dmalloc_touch_svalue(Pike_sp-2);    dmalloc_touch_svalue(Pike_sp-1); +     move_svalue (Pike_sp, Pike_sp - 1);    Pike_sp[-1].type = PIKE_T_INT;    Pike_sp++;
679:   });      OPCODE0(F_LTOSVAL3, "ltosval3", I_UPDATE_SP, { +  dmalloc_touch_svalue(Pike_sp-4); +  dmalloc_touch_svalue(Pike_sp-3); +  dmalloc_touch_svalue(Pike_sp-2); +  dmalloc_touch_svalue(Pike_sp-1); +     move_svalue (Pike_sp, Pike_sp - 1);    move_svalue (Pike_sp - 1, Pike_sp - 2);    Pike_sp[-2].type = PIKE_T_INT;
702:    }   });    + OPCODE0(F_LTOSVAL1, "ltosval1", I_UPDATE_SP, { +  dmalloc_touch_svalue(Pike_sp-2); +  dmalloc_touch_svalue(Pike_sp-1); +  +  lvalue_to_svalue_no_free(Pike_sp, Pike_sp-2); +  Pike_sp++; +  +  /* See ltosval3. This opcode is used e.g. in foo = foo[..] where no +  * bound arguments are pushed on the stack. */ +  if( (1 << Pike_sp[-1].type) & +  (BIT_ARRAY | BIT_MULTISET | BIT_MAPPING | BIT_STRING) ) +  { +  LOCAL_VAR(struct svalue tmp); +  tmp.type = PIKE_T_INT; +  tmp.subtype = NUMBER_NUMBER; +  tmp.u.integer = 0; +  assign_lvalue(Pike_sp-3, &tmp); +  } + }); +    OPCODE0(F_ADD_TO, "+=", I_UPDATE_SP, {    move_svalue (Pike_sp, Pike_sp - 1);    Pike_sp[-1].type=PIKE_T_INT;
1813:    pop_stack();   });    - OPCODE0_ALIAS(F_RANGE, "range", I_UPDATE_SP, o_range); + OPCODE1_ALIAS(F_RANGE, "range", I_UPDATE_SP, o_range2);      OPCODE0(F_COPY_VALUE, "copy_value", 0, {    LOCAL_VAR(struct svalue tmp);