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 "mapping.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"
+
#include "pike_types.h"
/* __attribute__ only applies to function declarations, not definitions, so we disable them here. */ #undef ATTRIBUTE #define ATTRIBUTE(X) /* #define ERROR_DEBUG */ PMOD_EXPORT const char msg_fatal_error[] = "%s:%ld: Fatal error:\n";
pike.git/src/error.c:617:
*! *! Cast operator. *! *! @note *! The only supported type to cast to is @expr{"array"@}, which *! generates an old-style error @expr{({@[message](), *! @[backtrace]()})@}. */ static void f_error_cast(INT32 args) {
-
char *s;
-
get_all_args
(
"error
-
>cast",args,"%s",&s);
-
if(!strncmp(s,"
array
",5
)
)
+
if(Pike
_
sp[
-
1].u.string
==
literal_
array
_string
)
{
-
pop_
n_elems
(
args
);
+
pop_
stack
();
apply_current (generic_err_message_fun, 0); apply_current (generic_err_backtrace_fun, 0); f_aggregate(2);
-
}else{
-
SIMPLE_BAD_ARG_ERROR("error->cast", 1, "the value \"array\"");
+
}
-
+
else
+
{
+
pop_stack();
+
push_undefined();
}
-
+
}
/*! @decl array|string `[](int(0..1) index) *! *! Index operator. *! *! Simulates an array *! @array *! @elem string msg *! Error message as returned by @[message]. *! @elem array backtrace