pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:16:   #include "pike_types.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.75 2000/07/06 23:25:25 mast Exp $"); + RCSID("$Id: array.c,v 1.76 2000/07/07 01:26:39 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:180:    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:    {    check_stack(4);    ref_push_array(a); -  assign_svalue_no_free(sp++,ind); +  assign_svalue_no_free(Pike_sp++,ind);    f_column(2); -  s[0]=sp[-1]; -  sp--; -  dmalloc_touch_svalue(sp); +  s[0]=Pike_sp[-1]; +  Pike_sp--; +  dmalloc_touch_svalue(Pike_sp);    break;    }       default:    {    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");    }
pike.git/src/array.c:251:    error("Attempt to index the empty array with %d.\n", i);    }    }    array_set_index(a,i,s);    break;       case T_STRING:    {    INT32 i, n;    check_stack(2); -  sp++->type = T_VOID; +  Pike_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); +  assign_svalue(Pike_sp-2, &a->item[i]); +  assign_lvalue(Pike_sp-2, s);    }    pop_n_elems(2);    break;    }       default:    {    struct svalue tmp;    tmp.type=T_ARRAY;    tmp.u.array=a;
pike.git/src/array.c:1448:    return mkefuncallnode("aggregate",ret);    }   }      void push_array_items(struct array *a)   {    check_stack(a->size);    check_array_for_destruct(a);    if(a->refs == 1)    { -  MEMCPY(sp,ITEM(a),sizeof(struct svalue)*a->size); -  sp += a->size; +  MEMCPY(Pike_sp,ITEM(a),sizeof(struct svalue)*a->size); +  Pike_sp += a->size;    a->size=0;    free_array(a);    }else{ -  assign_svalues_no_free(sp, ITEM(a), a->size, a->type_field); -  sp += a->size; +  assign_svalues_no_free(Pike_sp, ITEM(a), a->size, a->type_field); +  Pike_sp += a->size;    free_array(a);    }   }      void describe_array_low(struct array *a, struct processing *p, int indent)   {    INT32 e,d;    indent += 2;       for(e=0; e<a->size; e++)
pike.git/src/array.c:1529:    my_putchar('\n');    for(e=2; e<indent; e++) my_putchar(' ');    my_strcat("})");   }      struct array *aggregate_array(INT32 args)   {    struct array *a;       a=allocate_array_no_init(args,0); -  MEMCPY((char *)ITEM(a),(char *)(sp-args),args*sizeof(struct svalue)); +  MEMCPY((char *)ITEM(a),(char *)(Pike_sp-args),args*sizeof(struct svalue));    a->type_field=BIT_MIXED; -  sp-=args; -  DO_IF_DMALLOC(while(args--) dmalloc_touch_svalue(sp + args)); +  Pike_sp-=args; +  DO_IF_DMALLOC(while(args--) dmalloc_touch_svalue(Pike_sp + args));    return a;   }      struct array *append_array(struct array *a, struct svalue *s)   {    a=resize_array(a,a->size+1);    array_set_index(a, a->size-1, s);    return a;   }   
pike.git/src/array.c:1698:    ret->type_field=a->type_field;    return ret;   }      void apply_array(struct array *a, INT32 args)   {    INT32 e;    struct array *ret;    INT32 argp;    -  argp=sp-args - evaluator_stack; +  argp=Pike_sp-args - Pike_interpreter.evaluator_stack;       check_stack(a->size + args + 1);    check_array_for_destruct(a);    for(e=0;e<a->size;e++)    { -  assign_svalues_no_free(sp,evaluator_stack+argp,args,BIT_MIXED); -  sp+=args; +  assign_svalues_no_free(Pike_sp,Pike_interpreter.evaluator_stack+argp,args,BIT_MIXED); +  Pike_sp+=args;    apply_svalue(ITEM(a)+e,args);    }    ret=aggregate_array(a->size);    pop_n_elems(args);    push_array(ret);   }      struct array *reverse_array(struct array *a)   {    INT32 e;