pike.git
/
src
/
error.c
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/error.c:15:
#include "array.h" #include "object.h" #include "main.h" #include "builtin_functions.h" #include "backend.h" #include "operators.h" #include "module_support.h" #include "threads.h" #include "gc.h"
-
RCSID("$Id: error.c,v 1.
74
2001/08/15 22:
18
:
00
mast Exp $");
+
RCSID("$Id: error.c,v 1.
75
2001/08/15 22:
58
:
36
mast Exp $");
#undef ATTRIBUTE #define ATTRIBUTE(X) /* * Attempt to inhibit throwing of errors if possible. * Used by exit_on_error() to avoid infinite sprintf() loops. */ int Pike_inhibit_errors = 0;
pike.git/src/error.c:362:
#include "errors.h" /*! @decl array cast(string type) *! *! Cast operator. *! *! @note *! The only supported type to cast to is @tt{"array"@}, which *! generates and old-style error. */
-
void f_error_cast(INT32 args)
+
static
void f_error_cast(INT32 args)
{ char *s; get_all_args("error->cast",args,"%s",&s); if(!strncmp(s,"array",5)) { pop_n_elems(args); ref_push_string(GENERIC_ERROR_THIS->desc); ref_push_array(GENERIC_ERROR_THIS->backtrace); f_aggregate(2); }else{
pike.git/src/error.c:396:
*! Backtrace as returned by @[backtrace()] from where *! the error occurred. *! @endarray *! *! @note *! The error message is always terminated with a newline. *! *! @seealso *! @[backtrace()] */
-
void f_error_index(INT32 args)
+
static
void f_error_index(INT32 args)
{ INT_TYPE ind; get_all_args("error->`[]",args,"%i",&ind); switch(ind) { case 0: pop_n_elems(args); ref_push_string(GENERIC_ERROR_THIS->desc); break;
pike.git/src/error.c:425:
} } /*! @decl string describe() *! *! Make a readable error-message. *! *! @note *! Uses @[describe_backtrace()] to generate the message. */
-
void f_error_describe(INT32 args)
+
static
void f_error_describe(INT32 args)
{ pop_n_elems(args); ref_push_object(Pike_fp->current_object); APPLY_MASTER("describe_backtrace",1); } /*! @decl array backtrace() *! *! Get the backtrace from where the error occurred. *! *! @seealso *! @[predef::backtrace()] */
-
void f_error_backtrace(INT32 args)
+
static
void f_error_backtrace(INT32 args)
{ pop_n_elems(args); ref_push_array(GENERIC_ERROR_THIS->backtrace); }
-
+
/*! @decl string _sprintf()
+
*/
+
static void f_error__sprintf(INT32 args)
+
{
+
struct program *p = Pike_fp->current_object->prog;
+
int i = find_identifier("error_type", p);
+
struct identifier *id = ID_FROM_INT(p, i);
+
pop_n_elems(args);
+
push_svalue(&PROG_FROM_INT(p, i)->constants[id->func.offset].sval);
+
push_constant_text("(%O)");
+
ref_push_string(GENERIC_ERROR_THIS->desc);
+
f_sprintf(2);
+
f_add(2);
+
}
+
/*! @endclass */ #ifdef ERROR_DEBUG #define DWERROR(X) fprintf X #else /* !ERROR_DEBUG */ #define DWERROR(X) #endif /* ERROR_DEBUG */ #define INIT_ERROR(FEL)\