pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*-   || 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.cmod,v 1.151 2004/03/17 12:58:41 mast Exp $ + || $Id: builtin.cmod,v 1.152 2004/04/06 15:37:54 nilsson Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"   #include "pike_error.h"
pike.git/src/builtin.cmod:839:    RETURN (m->flags & ARRAY_WEAK_FLAG) ? PIKE_WEAK_VALUES : 0;   }      PIKEFUN int get_weak_flag(mapping m)   {    RETURN mapping_get_flags(m) & MAPPING_WEAK;   }      PIKEFUN int get_weak_flag(multiset m)   { - #ifdef PIKE_NEW_MULTISETS +     RETURN multiset_get_flags(m) & MULTISET_WEAK; - #else -  RETURN (m->ind->flags & (ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK)) ? -  PIKE_WEAK_INDICES : 0; - #endif +    }      /*! @decl program __empty_program(int|void line, string|void file)    */   PIKEFUN program __empty_program(int|void line, string|void file)    efun;    optflags OPT_EXTERNAL_DEPEND;   {    if (line && line->type != T_INT)    SIMPLE_BAD_ARG_ERROR("__empty_program", 1, "int|void");
pike.git/src/builtin.cmod:1110:    push_svalue(a->item + (my_rand() % a->size));    stack_swap();    pop_stack();   }      PIKEFUN mixed random(multiset m)    rawtype tFunc(tSet(tSetvar(1,tMix)),tVar(1));   {    if(multiset_is_empty (m))    SIMPLE_BAD_ARG_ERROR("random", 1, "multiset with elements in it"); - #ifdef PIKE_NEW_MULTISETS +     if (multiset_indval (m)) {    ptrdiff_t nodepos = multiset_get_nth (m, my_rand() % multiset_sizeof (m));    push_multiset_index (m, nodepos);    push_multiset_value (m, nodepos);    sub_msnode_ref (m);    f_aggregate (2);    }    else { -  push_multiset_index (m, multiset_get_nth (m, my_rand() % multiset_sizeof (m))); +  push_multiset_index (m, multiset_get_nth (m, my_rand() % +  multiset_sizeof (m)));    sub_msnode_ref (m);    } - #else -  push_svalue(m->ind->item + (my_rand() % m->ind->size)); - #endif +     stack_swap();    pop_stack();   }      /*! @decl array random(mapping m)    *! Returns a random index-value pair from the mapping.    */      PIKEFUN array random(mapping m)   {