Branch: Tag:

2001-06-08

2001-06-08 14:26:42 by Martin Stjernholm <mast@lysator.liu.se>

Backported the separate weak indices and values feature from 7.3.

Rev: lib/modules/Pike.pmod:1.1
Rev: src/builtin.cmod:1.18
Rev: src/builtin_functions.c:1.341
Rev: src/builtin_functions.h:1.16
Rev: src/mapping.c:1.117
Rev: src/mapping.h:1.35
Rev: src/svalue.c:1.96
Rev: src/svalue.h:1.76
Rev: src/testsuite.in:1.387

1: - /* -*- c -*- */ + /* -*- c -*- +  * $Id: builtin.cmod,v 1.18 2001/06/08 14:26:40 mast Exp $ +  */      #include "global.h"   #include "interpret.h"
23:   #include "bignum.h"   #include "main.h"   #include "operators.h" + #include "builtin_functions.h"      //! Extract a column from a two-dimensional array.   //!
297:    }   }    - //! Returns 1 if the weak flag has been set for @[m]. + //! Returns the weak flag settings for @[m]. It's a combination of + //! @[Pike.WEAK_INDICES] and @[Pike.WEAK_VALUES].   //! - PIKEFUN int(0 .. 1) get_weak_flag(array|mapping|multiset m) + PIKEFUN int get_weak_flag(array|mapping|multiset m)    efun;    optflags OPT_EXTERNAL_DEPEND;   {    int flag = 0;    switch (m->type) {    case T_ARRAY: -  flag = !!(m->u.array->flags & ARRAY_WEAK_FLAG); +  flag = (m->u.array->flags & ARRAY_WEAK_FLAG) ? PIKE_WEAK_VALUES : 0;    break;    case T_MAPPING: -  flag = !!(mapping_get_flags(m->u.mapping) & MAPPING_FLAG_WEAK); +  flag = mapping_get_flags(m->u.mapping) & MAPPING_WEAK;    break;    case T_MULTISET: -  flag = !!(m->u.multiset->ind->flags & (ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK)); +  flag = (m->u.multiset->ind->flags & (ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK)) ? +  PIKE_WEAK_INDICES : 0;    break;    default:    SIMPLE_BAD_ARG_ERROR("get_weak_flag",1,"array|mapping|multiset");