/// @addtogroup sefun
/// @{
/// @file general
/// @brief simul_efuns not belonging to any other category
/// @author Gwenhwyvar
/// @version 0.1.0
/// @date 2016-01-24

private int debug_flag = FALSE;

// --------------------------------------------------------------------------
/// @brief set_debug
/// set simul_efun internal debug_flag
///
/// @Param val - new setting
/// @Returns old setting
// --------------------------------------------------------------------------
public int set_debug(int val)
{
    int o_val = debug_flag;

    debug_flag = val;
    return o_val;
}
// --------------------------------------------------------------------------
/// @brief get_debug_flag
/// @Returns current setting of debug_flag
// --------------------------------------------------------------------------
public int get_debug(void)
{
    return debug_flag;
}
// --------------------------------------------------------------------------
/// @brief cmp 
/// @Param a
/// @Param b
/// @Returns TRUE if a and b are semantical equal, FALSE otherwise
// --------------------------------------------------------------------------
public int cmp(mixed a, mixed b)
{
    if(arrayp(a) && arrayp(b))
    {
        int i;

        if((i = sizeof(a)) != sizeof(b))
            return FALSE;
        while(i--)
        {
            if(!cmp(a[i], b[i]))
                return FALSE;
        }
        return TRUE;
    }
    else if(mapp(a) && mapp(b))
    {
        mixed k, v1, v2;

        if(sizeof(a) != sizeof(b))
            return FALSE;
        foreach(k, v1 in a)
        {
            if(undefinedp(v2 = b[k]) || !cmd(v1, v2))
                return FALSE;
        }
        return TRUE;
    }
    else
        return a == b;
}
///  @}
