pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: array.c,v 1.158 2004/04/06 15:37:54 nilsson Exp $ + || $Id: array.c,v 1.159 2004/05/13 23:28:49 nilsson Exp $   */      #include "global.h"   #include "svalue.h"   #include "array.h"   #include "object.h"   #include "las.h"   #include "stralloc.h"   #include "interpret.h"   #include "opcodes.h"
pike.git/src/array.c:19:   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "pike_security.h"   #include "stuff.h"   #include "bignum.h"   #include "cyclic.h"   #include "multiset.h"    - RCSID("$Id: array.c,v 1.158 2004/04/06 15:37:54 nilsson Exp $"); + RCSID("$Id: array.c,v 1.159 2004/05/13 23:28:49 nilsson Exp $");      PMOD_EXPORT struct array empty_array=   {    PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */    &weak_empty_array, /* Next */    0, /* previous */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:1177:    ret=allocate_array_no_init(v->size, 0);    ret->type_field = v->type_field;       for(e=0;e<v->size;e++)    assign_svalue_no_free(ITEM(ret)+e, ITEM(v)+order[e]);       return ret;   }      /* Maybe I should have a 'clean' flag for this computation */ - PMOD_EXPORT void array_fix_type_field(struct array *v) + PMOD_EXPORT TYPE_FIELD array_fix_type_field(struct array *v)   {    int e;    TYPE_FIELD t;       t=0;       if(v->flags & ARRAY_LVALUE)    {    v->type_field=BIT_MIXED|BIT_UNFINISHED; -  return; +  return BIT_MIXED|BIT_UNFINISHED;    }       for(e=0; e<v->size; e++) {    check_svalue (ITEM(v) + e);    t |= 1 << ITEM(v)[e].type;    }      #ifdef PIKE_DEBUG    if(t & ~(v->type_field))    {    describe(v);    Pike_fatal("Type field out of order (old:0x%04x new:0x%04x)!\n",    v->type_field, t);    }   #endif    v->type_field = t; -  +  return t;   }      #ifdef PIKE_DEBUG   /* Maybe I should have a 'clean' flag for this computation */   void array_check_type_field(struct array *v)   {    int e;    TYPE_FIELD t;       t=0;
pike.git/src/array.c:1765:    {    return merge_array_with_order(a, b, PIKE_ARRAY_OP_AND_LEFT);    }else{    return allocate_array_no_init(0,0);    }   }      int array_is_constant(struct array *a,    struct processing *p)   { -  array_fix_type_field(a); +     return svalues_are_constant(ITEM(a),    a->size, -  a->type_field, +  array_fix_type_field(a),    p);   }      node *make_node_from_array(struct array *a)   {    struct svalue s;    INT32 e;    -  array_fix_type_field(a); +     if(!a->size)    return mkefuncallnode("aggregate",0);    -  if(a->type_field == BIT_INT) +  if(array_fix_type_field(a) == BIT_INT)    {    debug_malloc_touch(a);    for(e=0; e<a->size; e++)    if(ITEM(a)[e].u.integer != 0)    break;    if(e == a->size)    {    return mkefuncallnode("allocate",mkintnode(a->size));    }    }