diff --git a/src/builtin.cmod b/src/builtin.cmod index 381549596a92f6e68bc354287abebc31e302a307..47a6a2896e5af16f72b9e9a3ee298fd02c92a9b5 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 ceb278f491fb14f9bf39536eedcae61f6743eb0f..06bdf1ff67c52693a396de15a9fb8e1d466f0275 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