pike.git / src / modules / _Stdio / stat.c

version» Context lines:

pike.git/src/modules/_Stdio/stat.c:549:    stat_push_compat(from++);    n++;    }    f_aggregate(n);    }   }         static void _stat_index_set (INT_TYPE code, struct svalue *val, int got_int_val, INT64 int_val )   { - #define BAD_ARG_2(X) bad_arg_error("`[]=", Pike_sp-2,2,2,X,val,msg_bad_arg,2,"`[]=",X) + #define BAD_ARG_2(X) bad_arg_error("`[]=", 2,2,X,val,msg_bad_arg,2,"`[]=",X)       if( got_int_val == -1 )    {    if (TYPEOF(*val) == T_INT)    int_val = val->u.integer, got_int_val = 1;    else if (TYPEOF(*val) == T_OBJECT && is_bignum_object (val->u.object))    {    if (!int64_from_bignum (&int_val, val->u.object))    Pike_error ("`[]=: Too big integer as value.\n");    else
pike.git/src/modules/_Stdio/stat.c:812:    {    stat_indices(0);    stat_values(0);    push_mapping(mkmapping(Pike_sp[-2].u.array, Pike_sp[-1].u.array));    stack_pop_n_elems_keep_top(2);    }    else    push_undefined();   }    + /*! @decl int(0..1) _equal(mixed other) +  *! +  *! Compare this object with another @[Stat] object. +  *! +  *! @returns +  *! Returns @expr{1@} if @[other] is a @[Stat] object with the +  *! same content, and @expr{0@} (zero) otherwise. +  */ + static void stat__equal(INT32 args) + { +  struct stat_storage *this_st = THIS_STAT; +  struct stat_storage *other_st; +  +  if (args != 1) +  SIMPLE_WRONG_NUM_ARGS_ERROR("_equal", 1); +  +  if ((TYPEOF(Pike_sp[-args]) != T_OBJECT) || +  !(other_st = get_storage(Pike_sp[-1].u.object, stat_program))) { +  push_int(0); +  return; +  } +  +  if (this_st == other_st) { +  push_int(1); +  return; +  } +  +  push_int(!memcmp(this_st, other_st, sizeof(struct stat_storage))); + } +    static void stat__sprintf(INT32 args)   {    int x;       if (args<1)    SIMPLE_WRONG_NUM_ARGS_ERROR("_sprintf",2);       if (TYPEOF(sp[-args]) != T_INT)    SIMPLE_ARG_TYPE_ERROR("_sprintf",0,"integer");   
pike.git/src/modules/_Stdio/stat.c:1031:    tFunc(tInt tInt,tArr(tInt))),0);       ADD_FUNCTION ("`[]=", stat_index_set,    tOr(tFunc(tInt06 tSetvar(0,tInt),tVar(0)),    tFunc(tString tSetvar(1,tOr(tInt,tString)),tVar(1))), 0);    ADD_FUNCTION ("`->=", stat_index_set,    tOr(tFunc(tInt06 tSetvar(0,tInt),tVar(0)),    tFunc(tString tSetvar(1,tOr(tInt,tString)),tVar(1))), 0);       ADD_FUNCTION("cast",stat_cast,tFunc(tStr,tOr(tMapping,tArray)),ID_PROTECTED); +  ADD_FUNCTION("_equal", stat__equal, tFunc(tMix,tInt01), ID_PROTECTED);    ADD_FUNCTION("_sprintf",stat__sprintf,    tFunc(tInt tOr(tVoid,tMapping),tString),0);    ADD_FUNCTION("_indices",stat_indices,    tFunc(tNone,tArr(tOr(tString,tInt))),0);    ADD_FUNCTION("_values",stat_values,    tFunc(tNone,tArr(tOr(tString,tInt))),0);       set_init_callback (stat_init);       stat_program=end_program();