From ee9fa954589e7510c422a0a449bcf1499eb2dbda Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Thu, 6 Jul 2000 01:18:48 +0200 Subject: [PATCH] Added get_weak_flag(). Rev: src/builtin.cmod:1.8 Rev: tutorial/tutorial.wmml:1.201 --- src/builtin.cmod | 22 ++++++++++++++++++++++ tutorial/tutorial.wmml | 1 + 2 files changed, 23 insertions(+) diff --git a/src/builtin.cmod b/src/builtin.cmod index 381549596a..47a6a2896e 100644 --- a/src/builtin.cmod +++ b/src/builtin.cmod @@ -195,6 +195,28 @@ PIKEFUN 1 m_delete(mapping(mixed:1=mixed) m, mixed val) sp++; } +PIKEFUN int get_weak_flag(mixed m) + efun; + optflags OPT_TRY_OPTIMIZE; +{ + int flag; + switch (m->type) { + case T_ARRAY: + flag = !!(m->u.array->flags & ARRAY_WEAK_FLAG); + break; + case T_MAPPING: + flag = !!(m->u.mapping->flags & MAPPING_FLAG_WEAK); + break; + case T_MULTISET: + flag = !!(m->u.multiset->ind->flags & (ARRAY_WEAK_FLAG|ARRAY_WEAK_SHRINK)); + break; + default: + SIMPLE_BAD_ARG_ERROR("get_weak_flag",1,"array|mapping|multiset"); + } + pop_n_elems(args); + push_int(flag); +} + void init_builtin(void) { INIT diff --git a/tutorial/tutorial.wmml b/tutorial/tutorial.wmml index ceb278f491..06bdf1ff67 100644 --- a/tutorial/tutorial.wmml +++ b/tutorial/tutorial.wmml @@ -78,6 +78,7 @@ filesystem_stat get_all_groups get_all_users get_groups_for_user +get_weak_flag getgrent getgroups getegid need ref -- GitLab