pike.git / src / opcodes.c

version» Context lines:

pike.git/src/opcodes.c:15:   #include "opcodes.h"   #include "object.h"   #include "error.h"   #include "pike_types.h"   #include "pike_memory.h"   #include "fd_control.h"   #include "cyclic.h"   #include "builtin_functions.h"   #include "module_support.h"    - RCSID("$Id: opcodes.c,v 1.27 1998/05/25 20:47:47 marcus Exp $"); + RCSID("$Id: opcodes.c,v 1.28 1998/06/07 19:47:53 grubba Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {    INT32 i;    switch(what->type)    {    case T_ARRAY:    simple_array_index_no_free(to,what->u.array,ind);    break;   
pike.git/src/opcodes.c:41:    object_index_no_free(to, what->u.object, ind);    break;       case T_MULTISET:    i=multiset_member(what->u.multiset, ind);    to->type=T_INT;    to->subtype=i ? NUMBER_UNDEFINED : 0;    to->u.integer=i;    break;    -  case T_PROGRAM: -  program_index_no_free(to, what->u.program, ind); -  break; -  +     case T_STRING:    if(ind->type==T_INT)    {    i=ind->u.integer;    if(i<0)    i+=what->u.string->len;    if(i<0 || i>=what->u.string->len)    error("Index %d is out of range 0 - %d.\n", i, what->u.string->len-1);    else    i=EXTRACT_UCHAR(what->u.string->str + i);    to->type=T_INT;    to->subtype=NUMBER_NUMBER;    to->u.integer=i;    break;    }else{    error("Index is not an integer.\n");    }    -  +  case T_PROGRAM: +  program_index_no_free(to, what->u.program, ind); +  break; +  +  case T_FUNCTION: +  { +  struct program *p = program_from_svalue(what); +  if (p) { +  program_index_no_free(to, p, ind); +  break; +  } +  } +  /* FALL THROUGH */ +     default:    error("Indexing a basic type.\n");    }   }      void o_index(void)   {    struct svalue s;    index_no_free(&s,sp-2,sp-1);    pop_n_elems(2);