Branch: Tag:

1996-02-17

1996-02-17 15:55:54 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

Completed removing compact arrays

Rev: src/array.c:1.5
Rev: src/array.h:1.3
Rev: src/builtin_efuns.c:1.8
Rev: src/call_out.c:1.2
Rev: src/interpret.c:1.6
Rev: src/list.c:1.2
Rev: src/lpc_types.c:1.2
Rev: src/main.c:1.2
Rev: src/mapping.c:1.2
Rev: src/modules/files/efuns.c:1.3
Rev: src/modules/regexp/glue.c:1.2
Rev: src/object.c:1.4
Rev: src/svalue.c:1.5
Rev: src/svalue.h:1.3

40:   {    struct array *v;    -  if(size == 0 && type == T_MIXED) +  if(size == 0)    {    empty_array.refs++;    return &empty_array;
309:    free_array(v);    return a;    }else{ -  free_svalues(ITEM(v) + size, v->size - size); +  free_svalues(ITEM(v) + size, v->size - size, v->type_field);    v->size=size;    return v;    }
486:    return -1;   }    -  - static short_cmpfun current_short_cmpfun; - static union anything *current_short_array_p; -  - static int internal_short_cmpfun(INT32 *a,INT32 *b) - { -  return current_short_cmpfun(current_short_array_p + *a, -  current_short_array_p + *b); - } -  +    static struct svalue *current_array_p;   static cmpfun current_cmpfun;   
617:   INT32 set_lookup(struct array *a, struct svalue *s)   {    /* face it, it's not there */ -  if( (((2 << s->type) -1) & s->type_field) == 0) +  if( (((2 << s->type) -1) & a->type_field) == 0)    return -1;       /* face it, it's not there */ -  if( ((BIT_MIXED << s->type) & BIT_MIXED & s->type_field) == 0) -  return ~v->size; +  if( ((BIT_MIXED << s->type) & BIT_MIXED & a->type_field) == 0) +  return ~a->size;       return low_lookup(a,s,set_svalue_cmpfun);   }
630:   INT32 switch_lookup(struct array *a, struct svalue *s)   {    /* face it, it's not there */ -  if( (((2 << s->type) -1) & s->type_field) == 0) +  if( (((2 << s->type) -1) & a->type_field) == 0)    return -1;       /* face it, it's not there */ -  if( ((BIT_MIXED << s->type) & BIT_MIXED & s->type_field) == 0) -  return ~v->size; +  if( ((BIT_MIXED << s->type) & BIT_MIXED & a->type_field) == 0) +  return ~a->size;       return low_lookup(a,s,switch_svalue_cmpfun);   }
785:    size=zipper[0];    zipper++;    -  ret=allocate_array_no_init(size,0, T_MIXED); +  ret=allocate_array_no_init(size,0);    for(e=0; e<size; e++)    {    if(*zipper >= 0)
803:    INT32 e, size;    struct array *v;    +  for(size=e=0;e<args;e++) +  size+=argp[e].u.array->size; +     if(args && argp[0].u.array->refs==1)    {    e=argp[0].u.array->size;
971:    {    return merge_array_without_order(a, b, OP_AND);    }else{ -  return allocate_array_no_init(0,0,T_MIXED); +  return allocate_array_no_init(0,0);    }   }   
986:   node *make_node_from_array(struct array *a)   {    struct svalue s; -  char *str; +     INT32 e;       array_fix_type_field(a);
1031:    free_array(a);    return;    }else{ -  assign_svalues_no_free(sp, ITEM(a), a->size); +  assign_svalues_no_free(sp, ITEM(a), a->size, a->type_field);    }    sp += a->size;    free_array(a);
1120:       if(!del->len)    { -  ret=allocate_array_no_init(str->len,0,T_STRING); +  ret=allocate_array_no_init(str->len,0);    ret->type_field |= 1<<T_STRING;    for(e=0;e<str->len;e++) -  SHORT_ITEM(ret)[e].string=make_shared_binary_string(str->str+e,1); +  { +  ITEM(ret)[e].type=T_STRING; +  ITEM(ret)[e].u.string=make_shared_binary_string(str->str+e,1); +  }    }else{       s=str->str;
1136:    e++;    }    -  ret=allocate_array_no_init(e+1,0,T_STRING); +  ret=allocate_array_no_init(e+1,0);    ret->type_field |= 1<<T_STRING;       s=str->str;    for(d=0;d<e;d++)    {    tmp=MEMMEM((char *)(del->str), del->len, (char *)s, end-s); -  SHORT_ITEM(ret)[d].string=make_shared_binary_string(s,tmp-s); +  ITEM(ret)[d].type=T_STRING; +  ITEM(ret)[d].u.string=make_shared_binary_string(s,tmp-s);    s=tmp+del->len;    } -  SHORT_ITEM(ret)[d].string=make_shared_binary_string(s,end-s); +  ITEM(ret)[d].type=T_STRING; +  ITEM(ret)[d].u.string=make_shared_binary_string(s,end-s);    }    return ret;   }
1218:    argp=sp-args;    for(e=0;e<a->size;e++)    { -  assign_svalues_no_free(sp,argp,args); +  assign_svalues_no_free(sp,argp,args,BIT_MIXED);    sp+=args;    apply_svalue(ITEM(a)+e,args);    } -  ret=aggregate_array(a->size,T_MIXED); +  ret=aggregate_array(a->size);    pop_n_elems(args);    push_array(ret);   }
1267: Inside #if defined(GC)
   } while (a != & empty_array);   }    - void array_gc_mark(array *a) + void array_gc_mark(struct array *a)   {    INT e;    if(a->flags & ARRAY_FLAG_MARK) return;