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

version» Context lines:

pike.git/src/modules/_Stdio/stat.c:292:    }    break;    case 2: push_int64(THIS_STAT->s.st_atime); break;    case 3: push_int64(THIS_STAT->s.st_mtime); break;    case 4: push_int64(THIS_STAT->s.st_ctime); break;    case 5: push_int(THIS_STAT->s.st_uid); break;    case 6: push_int(THIS_STAT->s.st_gid); break;    default:    {    INT32 args=1; -  SIMPLE_BAD_ARG_ERROR("Stat `[]",1,"int(0..6)"); +  SIMPLE_BAD_ARG_ERROR("`[]",1,"int(0..6)");    }    }   }      static void stat_init (struct object *UNUSED(o))   {    MEMSET (&THIS_STAT->s, 0, sizeof (THIS_STAT->s));   }      /*! @decl void create (void|object|array stat);
pike.git/src/modules/_Stdio/stat.c:508:    pop_stack();    stat_push_compat(index);    }    else if( TYPEOF(sp[-1]) == T_STRING )    {    struct svalue *tmp;    tmp = low_mapping_string_lookup( stat_map, sp[-1].u.string );    _stat_index( tmp ? tmp->u.integer : 0 );    }    else -  SIMPLE_BAD_ARG_ERROR("Stat `[]",1,"int(0..6)|string"); +  SIMPLE_BAD_ARG_ERROR("`[]",1,"int(0..6)|string");    }    else if (args>=2) /* range */    {    INT_TYPE from, to, n=0;       if (args > 2) {    pop_n_elems(args - 2);    args = 2;    }       if (TYPEOF(sp[-2]) != T_INT &&    !(TYPEOF(sp[-2]) == T_OBJECT && is_bignum_object (sp[-2].u.object))) -  SIMPLE_BAD_ARG_ERROR("Stat `[..]",1,"int"); +  SIMPLE_BAD_ARG_ERROR("`[..]",1,"int");       if (TYPEOF(sp[-1]) != T_INT &&    !(TYPEOF(sp[-1]) == T_OBJECT && is_bignum_object (sp[-1].u.object))) -  SIMPLE_BAD_ARG_ERROR("Stat `[..]",2,"int"); +  SIMPLE_BAD_ARG_ERROR("`[..]",2,"int");       /* make in range 0..6 */    push_int(6);    f_min(2);    stack_swap();    push_int(0);    f_max(2);    stack_swap();       from = sp[-2].u.integer;
pike.git/src/modules/_Stdio/stat.c:552:    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("Stat.`[]=", Pike_sp-2,2,2,X,val,msg_bad_arg,2,"Stat.`[]=",X) + #define BAD_ARG_2(X) bad_arg_error("`[]=", Pike_sp-2,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 ("Stat `[]=: Too big integer as value.\n"); +  Pike_error ("`[]=: Too big integer as value.\n");    else    got_int_val = 1;    }    }       switch (code) {    case STAT_MODE_STRING:    if (TYPEOF(*val) != T_STRING)    BAD_ARG_2("string");   
pike.git/src/modules/_Stdio/stat.c:752:    else    got_int_val = 1;    }       /* shouldn't there be an else clause here ? */    /* No, the second argument is checked further below depending on    * what the first is. /mast */       if (TYPEOF(sp[-2]) == T_INT) {    if (!got_int_val) -  SIMPLE_BAD_ARG_ERROR ("Stat `[]=", 2, +  SIMPLE_BAD_ARG_ERROR ("`[]=", 2,    "integer when the first argument is an integer");    if (!stat_compat_set (sp[-2].u.integer, int_val)) -  SIMPLE_BAD_ARG_ERROR ("Stat `[]=", 1, "int(0..6)|string"); +  SIMPLE_BAD_ARG_ERROR ("`[]=", 1, "int(0..6)|string");    }    else if (TYPEOF(sp[-2]) == T_STRING) {    INT_TYPE code;    struct svalue *tmp;    tmp = low_mapping_string_lookup( stat_map, sp[-2].u.string );    if (!tmp)    {    /* Fall back to a normal index set on this object, in case    * someone inherited us. */    object_set_index2 (fp->current_object, 0, sp-2, sp-1);    stack_swap();    pop_stack();    return;    }    _stat_index_set( tmp->u.integer, sp-1, got_int_val, int_val);    }    -  else SIMPLE_BAD_ARG_ERROR ("Stat `[]=", 1, "int(0..6)|string"); +  else SIMPLE_BAD_ARG_ERROR ("`[]=", 1, "int(0..6)|string");       stack_swap();    pop_stack();   }      static void stat_indices(INT32 args);   static void stat_values(INT32 args);      static void stat_cast(INT32 args)   {
pike.git/src/modules/_Stdio/stat.c:905:    _stat_index_set( k->val.u.integer, sp-1, -1,0 );    }    pop_stack();    }    }    else if (TYPEOF(sp[-1]) == T_ARRAY)    {    struct array *a = sp[-1].u.array;    int i;    if (a->size != 7) -  SIMPLE_BAD_ARG_ERROR ("Stat create", 1, "stat array with 7 elements"); +  SIMPLE_BAD_ARG_ERROR ("create", 1, "stat array with 7 elements");    for (i = 0; i < 7; i++) {    INT64 val;    if (TYPEOF(ITEM(a)[i]) == T_INT)    val = ITEM(a)[i].u.integer;    else if (TYPEOF(ITEM(a)[i]) == T_OBJECT &&    is_bignum_object (ITEM(a)[i].u.object)) {    if (!int64_from_bignum (&val, ITEM(a)[i].u.object)) -  Pike_error ("Stat create: Too big integer in stat array.\n"); +  Pike_error ("create: Too big integer in stat array.\n");    }    else -  SIMPLE_BAD_ARG_ERROR ("Stat create", 1, "array(int)"); +  SIMPLE_BAD_ARG_ERROR ("create", 1, "array(int)");    stat_compat_set (i, val);    }    }       else -  SIMPLE_BAD_ARG_ERROR ("Stat create", 1, "void|Stdio.Stat|array(int)"); +  SIMPLE_BAD_ARG_ERROR ("create", 1, "void|Stdio.Stat|array(int)");    }       pop_n_elems (args);   }   #undef THIS_STAT      void push_stat(PIKE_STAT_T *s)   {    struct object *o;    struct stat_storage *stor;