pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:14:   #include "language.h"   #include "error.h"   #include "pike_types.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"    - RCSID("$Id: array.c,v 1.51 1999/08/17 03:17:06 mast Exp $"); + RCSID("$Id: array.c,v 1.52 1999/08/17 22:00:00 hubbe Exp $");      struct array empty_array=   {    1, /* Never free */   #ifdef PIKE_SECURITY    0,   #endif    &empty_array, /* Next */    &empty_array, /* previous (circular) */    0, /* Size = 0 */
pike.git/src/array.c:175:    if (a->size) {    index_error(0,0,0,&tmp,ind,"Index %d is out of range 0 - %d.\n", i, a->size-1);    } else {    index_error(0,0,0,&tmp,ind,"Attempt to index the empty array with %d.\n", i);    }    }    array_index_no_free(s,a,i);    break;       case T_STRING: -  if (ind->subtype == 1) { +  {    check_stack(4);    ref_push_array(a);    assign_svalue_no_free(sp++,ind);    f_column(2);    s[0]=sp[-1];    sp--;    break;    }       default:    {    struct svalue tmp;    tmp.type=T_ARRAY;    tmp.u.array=a; -  index_error(0,0,0,&tmp,ind,"Index is not an integer.\n"); +  index_error(0,0,0,&tmp,ind,"Array index is neither int nor string.\n");    }    }   }      /*    * Extract an svalue from an array    */   void array_free_index(struct array *v,INT32 index)   {   #ifdef PIKE_DEBUG
pike.git/src/array.c:247:    if (a->size) {    error("Index %d is out of range 0 - %d.\n", i, a->size-1);    } else {    error("Attempt to index the empty array with %d.\n", i);    }    }    array_set_index(a,i,s);    break;       case T_STRING: -  if (ind->subtype == 1) { +  {    INT32 i, n; -  +  check_stack(2);    sp++->type = T_VOID;    push_svalue(ind);    for (i = 0, n = a->size; i < n; i++) {    assign_svalue(sp-2, &a->item[i]);    assign_lvalue(sp-2, s);    }    pop_n_elems(2);    break;    }       default: -  error("Index is not an integer.\n"); +  { +  struct svalue tmp; +  tmp.type=T_ARRAY; +  tmp.u.array=a; +  index_error(0,0,0,&tmp,ind,"Array index is neither int nor string.\n");    }    } -  + }      /*    * Insert an svalue into an array, grow the array if nessesary    */   struct array *array_insert(struct array *v,struct svalue *s,INT32 index)   {   #ifdef PIKE_DEBUG    if(index<0 || index>v->size)    fatal("Illegal index in low level insert routine.\n");   #endif