pike.git / src / interpret.c

version» Context lines:

pike.git/src/interpret.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: interpret.c,v 1.65 1998/02/01 02:07:24 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.66 1998/02/01 04:01:32 hubbe Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"   #include "svalue.h"   #include "array.h"   #include "mapping.h"   #include "error.h"   #include "language.h"   #include "stralloc.h"   #include "constants.h"
pike.git/src/interpret.c:190:    * multiset[index] : { multiset, index }    * object[index] : { object, index }    * local variable : { svalue_pointer, nothing }    * global variable : { svalue_pointer/short_svalue_pointer, nothing }    */      void lvalue_to_svalue_no_free(struct svalue *to,struct svalue *lval)   {    switch(lval->type)    { +  case T_ARRAY_LVALUE: +  { +  INT32 e; +  struct array *a; +  ONERROR err; +  a=allocate_array(lval[1].u.array->size>>1); +  SET_ONERROR(err, do_free_array, a); +  for(e=0;e<a->size;e++) +  lvalue_to_svalue_no_free(a->item+e, lval[1].u.array->item+(e<<1)); +  to->type = T_ARRAY; +  to->u.array=a; +  UNSET_ONERROR(err); +  break; +  } +     case T_LVALUE:    assign_svalue_no_free(to, lval->u.lval);    break;       case T_SHORT_LVALUE:    assign_from_short_svalue_no_free(to, lval->u.short_lval, lval->subtype);    break;       case T_OBJECT:    object_index_no_free(to, lval->u.object, lval+1);
pike.git/src/interpret.c:234:    error("Indexing the NULL value.\n"); /* Per */    else    error("Indexing a basic type.\n");    }   }      void assign_lvalue(struct svalue *lval,struct svalue *from)   {    switch(lval->type)    { +  case T_ARRAY_LVALUE: +  { +  INT32 e; +  if(from->type != T_ARRAY) +  error("Trying to assign combined lvalue from non-array.\n"); +  +  if(from->u.array->size < (lval[1].u.array->size>>1)) +  error("Not enough values for multiple assign.\n"); +  +  for(e=0;e<from->u.array->size;e++) +  assign_lvalue(lval[1].u.array->item+(e<<1),from->u.array->item+e); +  } +  break; +     case T_LVALUE:    assign_svalue(lval->u.lval,from);    break;       case T_SHORT_LVALUE:    assign_to_short_svalue(lval->u.short_lval, lval->subtype, from);    break;       case T_OBJECT:    object_set_index(lval->u.object, lval+1, from);
pike.git/src/interpret.c:273:    error("Indexing the NULL value.\n"); /* Per */    else    error("Indexing a basic type.\n");    }   }      union anything *get_pointer_if_this_type(struct svalue *lval, TYPE_T t)   {    switch(lval->type)    { +  case T_ARRAY_LVALUE: +  return 0; +     case T_LVALUE:    if(lval->u.lval->type == t) return & ( lval->u.lval->u );    return 0;       case T_SHORT_LVALUE:    if(lval->subtype == t) return lval->u.short_lval;    return 0;       case T_OBJECT:    return object_get_item_ptr(lval->u.object,lval+1,t);
pike.git/src/interpret.c:725:    break;          CASE(F_LOCAL_LVALUE);    sp[0].type=T_LVALUE;    sp[0].u.lval=fp->locals+GET_ARG();    sp[1].type=T_VOID;    sp+=2;    break;    +  CASE(F_ARRAY_LVALUE); +  f_aggregate(GET_ARG()*2); +  sp[-1].u.array->flags |= ARRAY_LVALUE; +  sp[0]=sp[-1]; +  sp[-1].type=T_ARRAY_LVALUE; +  sp++; +  break; +     CASE(F_CLEAR_2_LOCAL);    instr=GET_ARG();    free_svalues(fp->locals + instr, 2, -1);    fp->locals[instr].type=T_INT;    fp->locals[instr].subtype=0;    fp->locals[instr].u.integer=0;    fp->locals[instr+1].type=T_INT;    fp->locals[instr+1].subtype=0;    fp->locals[instr+1].u.integer=0;    break;
pike.git/src/interpret.c:1075:    *s=*sp;    }else{    assign_to_short_svalue((union anything *)GLOBAL_FROM_INT(tmp),    i->run_time_type,    sp-1);    pop_stack();    }    }    break;    - #ifdef F_ASSIGN_ARRAY -  CASE(F_ASSIGN_ARRAY); -  { -  struct svalue *base=*--mark_sp; -  INT32 e,args=(sp-base)>>1 -  if(sp[-1].type != T_ARRAY) -  error("Bad argument to multiple assign, not an array.\n"); -  if(sp[-1].u.array->size < args) -  error("Not enough elements in array for multiple assign.\n"); -  -  for(e=0;e<args;e++) -  assign_lvalue(base+e*2,sp[-1].u.array->item+e); -  -  pop_n_elems(sp-base); -  break; -  } - #endif -  +     /* Stack machine stuff */    CASE(F_POP_VALUE); pop_stack(); break;    CASE(F_POP_N_ELEMS); pop_n_elems(GET_ARG()); break;    CASE(F_MARK2); *(mark_sp++)=sp;    CASE(F_MARK); *(mark_sp++)=sp; break;       CASE(F_CLEAR_STRING_SUBTYPE);    if(sp[-1].type==T_STRING) sp[-1].subtype=0;    break;