pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:197: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if(Pike_sp - Pike_interpreter.evaluator_stack < Pike_interpreter.recoveries->stack_pointer)    Pike_fatal("Stack error in error.\n");   #endif       pop_n_elems(Pike_sp - Pike_interpreter.evaluator_stack - Pike_interpreter.recoveries->stack_pointer);    Pike_mark_sp = Pike_interpreter.mark_stack + Pike_interpreter.recoveries->mark_sp;      #if defined(DEBUG_MALLOC) && defined(PIKE_DEBUG)    /* This will tell us where the value was caught (I hope) */ -  if(throw_value.type <= MAX_REF_TYPE) +  if(TYPEOF(throw_value) <= MAX_REF_TYPE)    {    debug_malloc_update_location(throw_value.u.refs,    Pike_interpreter.recoveries->file);    debug_malloc_touch(throw_value.u.refs);    }   #endif      #ifdef TRACE_UNFINISHED_TYPE_FIELDS    accept_unfinished_type_fields--;   #endif
pike.git/src/error.c:363:    push_int(0);    push_int(0);    }       if (name)    push_text(name);    else    push_int(0);       for (i=-args; i; i++) { -  if (oldsp[i].type <= PIKE_T_FLOAT) { +  if (TYPEOF(oldsp[i]) <= PIKE_T_FLOAT) {    push_svalue(oldsp + i);    } else {    char buffer[50];    sprintf(buffer, "<Svalue:0x%04x:0x%04x:%p>", -  oldsp[i].type, oldsp[i].subtype, oldsp[i].u.ptr); +  TYPEOF(oldsp[i]), SUBTYPEOF(oldsp[i]), oldsp[i].u.ptr);    push_text(buffer);    }    }       f_aggregate(args + 3);    f_aggregate(1);       f_add(2);       f_aggregate(2);
pike.git/src/error.c:516:    * below. Doing it the naughty way without going through    * init_threads_disable etc to avoid hanging on runaway locks. */    threads_disabled++;    MEMSET (&evaluator_callbacks, 0, sizeof (evaluator_callbacks));    if (SETJMP (jmp))    fprintf(stderr,"Got exception when trying to describe backtrace.\n");    else {    jmp.severity = THROW_EXIT; /* Don't want normal exit code to run here. */    push_error("Backtrace at time of fatal:\n");    APPLY_MASTER("describe_backtrace",1); -  if(Pike_sp[-1].type==PIKE_T_STRING) +  if(TYPEOF(Pike_sp[-1]) == PIKE_T_STRING)    write_to_stderr(Pike_sp[-1].u.string->str, Pike_sp[-1].u.string->len);    }    UNSETJMP (jmp);    threads_disabled--;    evaluator_callbacks = saved_eval_cbs;    }else{    fprintf(stderr,"No stack - no backtrace.\n");    }    fflush(stderr);    do_abort();
pike.git/src/error.c:718:    else    push_int(0);   }      /*! @decl string _sprintf()    */   static void f_error__sprintf(INT32 args)   {    int mode = 0;    -  if(args>0 && Pike_sp[-args].type == PIKE_T_INT) +  if(args>0 && TYPEOF(Pike_sp[-args]) == PIKE_T_INT)    mode = Pike_sp[-args].u.integer;    pop_n_elems(args);       if(mode != 'O') {    push_undefined();    return;    }       {    struct program *p = Pike_fp->current_object->prog;
pike.git/src/error.c:769:    *! Claims that the error object is an array, for compatibility with    *! old style error handling code.    */   static void f_error__is_type(INT32 args)   {    struct pike_string *array_string;    int ret;    MAKE_CONST_STRING(array_string, "array");    if (args < 0) SIMPLE_TOO_FEW_ARGS_ERROR("_is_type", 1);    if (args > 1) SIMPLE_WRONG_NUM_ARGS_ERROR("_is_type", 1); -  if (Pike_sp[-args].type != PIKE_T_STRING) +  if (TYPEOF(Pike_sp[-args]) != PIKE_T_STRING)    SIMPLE_ARG_TYPE_ERROR("_is_type", 1, "string");    ret = Pike_sp[-args].u.string == array_string;    pop_n_elems(args);    push_int(ret);   }      /*! @decl void create(string message, @    *! void|array(backtrace_frame|array(mixed)) backtrace)    */   static void f_error_create(INT32 args)
pike.git/src/error.c:842:   #define ERROR_STRUCT(STRUCT,O) \    ((struct PIKE_CONCAT(STRUCT,_error_struct) *)((O)->storage + PIKE_CONCAT(STRUCT,_error_offset)))      #define ERROR_COPY(STRUCT,X) \    ERROR_STRUCT(STRUCT,o)->X=X      #define ERROR_COPY_SVALUE(STRUCT,X) do { \    if (X) { \    assign_svalue_no_free( & ERROR_STRUCT(STRUCT,o)->X, X); \    } else { \ -  ERROR_STRUCT(STRUCT, o)->X.type = PIKE_T_INT; \ -  ERROR_STRUCT(STRUCT, o)->X.subtype = NUMBER_UNDEFINED; \ -  ERROR_STRUCT(STRUCT, o)->X.u.integer = 0; \ +  SET_SVAL(ERROR_STRUCT(STRUCT, o)->X, PIKE_T_INT, NUMBER_UNDEFINED, \ +  integer, 0); \    } \    } while (0)         #define ERROR_COPY_REF(STRUCT,X) \    add_ref( ERROR_STRUCT(STRUCT,o)->X=X )         /* This prepares the passed object o, which is assumed to inherit    * generic_error_program, and throws it:
pike.git/src/error.c:917:    push_int(0);    push_text(func);       for (i=0;i<args;i++)    push_svalue(base_sp + i);    f_aggregate(args + 3);    f_aggregate(1);    f_add(2);    }    -  if(Pike_sp[-1].type!=PIKE_T_ARRAY) +  if(TYPEOF(Pike_sp[-1]) != PIKE_T_ARRAY)    Pike_fatal("f_backtrace failed to generate a backtrace!\n");       if (err->error_backtrace) free_array(err->error_backtrace);    err->error_backtrace=Pike_sp[-1].u.array;    Pike_sp--;    dmalloc_touch_svalue(Pike_sp);       free_svalue(& throw_value); -  throw_value.type=PIKE_T_OBJECT; -  throw_value.subtype = 0; -  throw_value.u.object=o; +  SET_SVAL(throw_value, PIKE_T_OBJECT, 0, object, o);    throw_severity = THROW_ERROR;    in_error=0;       dmalloc_touch_svalue(& throw_value);       pike_throw(); /* Hope someone is catching, or we will be out of balls. */   }         /* Throw a preallocated error object.
pike.git/src/error.c:990:    const char *func,    struct svalue *base_sp, int args,    int which_argument,    const char *expected_type,    struct svalue *got_value,    const char *desc, ...) ATTRIBUTE((noreturn))   {    INIT_ERROR(bad_argument);    ERROR_COPY(bad_argument, which_argument);    if (expected_type) -  ERROR_STRUCT(bad_argument,o)->expected_type=make_shared_string(expected_type); +  ERROR_STRUCT(bad_argument,o)->expected_type = +  make_shared_string(expected_type);    else    ERROR_STRUCT(bad_argument,o)->expected_type = NULL;    ERROR_COPY_SVALUE(bad_argument, got_value);    DWERROR((stderr, "%s():Bad arg %d (expected %s)\n",    func, which_argument, expected_type));    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void math_error(    const char *func,    struct svalue *base_sp, int args,    struct svalue *number,    const char *desc, ...) ATTRIBUTE((noreturn))   {    INIT_ERROR(math);    if(number)    {    ERROR_COPY_SVALUE(math, number);    }else{ -  ERROR_STRUCT(math,o)->number.type=PIKE_T_INT; -  ERROR_STRUCT(math,o)->number.subtype=NUMBER_UNDEFINED; -  ERROR_STRUCT(math,o)->number.u.integer=0; +  SET_SVAL(ERROR_STRUCT(math,o)->number, PIKE_T_INT, NUMBER_UNDEFINED, +  integer, 0);    }    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void resource_error(    const char *func,    struct svalue *base_sp, int args,    const char *resource_type,    size_t howmuch_,    const char *desc, ...) ATTRIBUTE((noreturn))