pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.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: builtin_functions.c,v 1.536 2004/04/06 13:00:40 nilsson Exp $ + || $Id: builtin_functions.c,v 1.537 2004/04/06 15:37:54 nilsson Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.536 2004/04/06 13:00:40 nilsson Exp $"); + RCSID("$Id: builtin_functions.c,v 1.537 2004/04/06 15:37:54 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"   #include "constants.h"   #include "mapping.h"   #include "stralloc.h"
pike.git/src/builtin_functions.c:2386:    ITEM(a)[size].u.integer = DO_NOT_WARN((INT_TYPE)size);    }    a->type_field = BIT_INT;    break;       case T_MAPPING:    a=mapping_indices(Pike_sp[-args].u.mapping);    break;       case T_MULTISET: - #ifdef PIKE_NEW_MULTISETS +     a = multiset_indices (Pike_sp[-args].u.multiset); - #else -  a=copy_array(Pike_sp[-args].u.multiset->ind); - #endif +     break;       case T_OBJECT:    a=object_indices(Pike_sp[-args].u.object);    break;       case T_PROGRAM:    a = program_indices(Pike_sp[-args].u.program);    break;   
pike.git/src/builtin_functions.c:2685:       case T_ARRAY:    a=copy_array(Pike_sp[-args].u.array);    break;       case T_MAPPING:    a=mapping_values(Pike_sp[-args].u.mapping);    break;       case T_MULTISET: - #ifdef PIKE_NEW_MULTISETS +     a = multiset_values (Pike_sp[-args].u.multiset); - #else -  size=Pike_sp[-args].u.multiset->ind->size; -  a=allocate_array_no_init(size,0); -  while(--size>=0) -  { -  /* Elements are already integers. */ -  ITEM(a)[size].u.integer=1; -  } -  a->type_field = BIT_INT; - #endif +     break;       case T_OBJECT:    a=object_values(Pike_sp[-args].u.object);    break;       case T_PROGRAM:    a = program_values(Pike_sp[-args].u.program);    break;   
pike.git/src/builtin_functions.c:3432:    flags = array_get_flags(s->u.array);    SETFLAG(flags,ARRAY_WEAK_FLAG,ret & PIKE_WEAK_VALUES);    s->u.array = array_set_flags(s->u.array, flags);    break;    case T_MAPPING:    flags = mapping_get_flags(s->u.mapping);    flags = (flags & ~PIKE_WEAK_BOTH) | (ret & PIKE_WEAK_BOTH);    mapping_set_flags(s->u.mapping, flags);    break;    case T_MULTISET: - #ifdef PIKE_NEW_MULTISETS +     flags = multiset_get_flags (s->u.multiset);    flags = (flags & ~PIKE_WEAK_BOTH) | (ret & PIKE_WEAK_BOTH);    multiset_set_flags (s->u.multiset, flags); - #else -  flags = array_get_flags(s->u.multiset->ind); -  SETFLAG(flags,(ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK), ret & PIKE_WEAK_INDICES); -  s->u.multiset->ind = array_set_flags(s->u.multiset->ind, flags); - #endif +     break;    default:    SIMPLE_BAD_ARG_ERROR("set_weak_flag",1,"array|mapping|multiset");    }    pop_n_elems(args-1);   }      /*! @decl int objectp(mixed arg)    *!    *! Returns @expr{1@} if @[arg] is an object, @expr{0@} (zero) otherwise.
pike.git/src/builtin_functions.c:6996:    /* multiset ret =    (multiset)(map(indices(arr),fun,@extra)); */    push_svalue(Pike_sp-args); /* take indices from arr */    free_svalue(Pike_sp-args-1); /* move it to top of stack */    Pike_sp[-args-1].type=T_INT;    f_indices(1); /* call f_indices */    Pike_sp--;    dmalloc_touch_svalue(Pike_sp);    Pike_sp[-args]=Pike_sp[0]; /* move it back */    f_map(args); - #ifdef PIKE_NEW_MULTISETS +     /* FIXME: Handle multisets with values like mappings. */    push_multiset (mkmultiset_2 (Pike_sp[-1].u.array, NULL, NULL));    free_array (Pike_sp[-2].u.array);    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp[-2] = Pike_sp[-1];    Pike_sp--; - #else -  Pike_sp--; /* allocate_multiset is destructive */ -  dmalloc_touch_svalue(Pike_sp); -  push_multiset(allocate_multiset(Pike_sp->u.array)); -  order_multiset(Pike_sp[-1].u.multiset); - #endif +     return;       case T_STRING:    /* multiset ret =    (string)(map((array)arr,fun,@extra)); */    push_svalue(Pike_sp-args); /* take indices from arr */    free_svalue(Pike_sp-args-1); /* move it to top of stack */    Pike_sp[-args-1].type=T_INT;    o_cast(NULL,T_ARRAY); /* cast the string to an array */    Pike_sp--;
pike.git/src/builtin_functions.c:7437:       case T_MULTISET:    push_svalue(Pike_sp-args); /* take indices from arr */    free_svalue(Pike_sp-args-1); /* move it to top of stack */    Pike_sp[-args-1].type=T_INT;    f_indices(1); /* call f_indices */    Pike_sp--;    dmalloc_touch_svalue(Pike_sp);    Pike_sp[-args]=Pike_sp[0]; /* move it back */    f_filter(args); - #ifdef PIKE_NEW_MULTISETS +     /* FIXME: Handle multisets with values like mappings. */    push_multiset (mkmultiset_2 (Pike_sp[-1].u.array, NULL, NULL));    free_array (Pike_sp[-2].u.array);    Pike_sp[-2] = Pike_sp[-1];    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp--; - #else -  Pike_sp--; /* allocate_multiset is destructive */ -  dmalloc_touch_svalue(Pike_sp); -  push_multiset(allocate_multiset(Pike_sp->u.array)); -  order_multiset(Pike_sp[-1].u.multiset); - #endif +     return;       case T_STRING:    push_svalue(Pike_sp-args); /* take indices from arr */    free_svalue(Pike_sp-args-1); /* move it to top of stack */    Pike_sp[-args-1].type=T_INT;    o_cast(NULL,T_ARRAY); /* cast the string to an array */    Pike_sp--;    dmalloc_touch_svalue(Pike_sp);    Pike_sp[-args]=Pike_sp[0]; /* move it back */