pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:1178:
*! (zero) will be returned. *! *! @seealso *! @[function_object()] */ PMOD_EXPORT PIKEFUN string function_name(program|function func) efun; optflags OPT_TRY_OPTIMIZE; {
+
int f = -1;
+
struct program *p = NULL;
+
switch(TYPEOF(*func)) { default: SIMPLE_BAD_ARG_ERROR("function_name", 1, "function|program"); return; /* NOTREACHED */ case PIKE_T_PROGRAM: {
-
struct program *
p=func->u.program;
+
p
=
func->u.program;
if(p->parent) { int e; p=p->parent; /* search constants in parent for this * program... */ for(e = p->num_identifier_references; e--; )
pike.git/src/builtin.cmod:1223:
"Parent program info:\n", func->u.program); dump_program_tables(func->u.program->parent, 0); } #endif } break; } case PIKE_T_FUNCTION:
-
if(SUBTYPEOF(*func) == FUNCTION_BUILTIN) break;
-
if(!func->u.object->prog)
+
if(
(f =
SUBTYPEOF(*func)
)
== FUNCTION_BUILTIN) break;
+
if(!
(p =
func->u.object->prog)
)
bad_arg_error("function_name", Pike_sp-args, args, 1, "function", Pike_sp-args, "Destructed object.\n");
-
if(
func->u.object->prog
== pike_trampoline_program)
+
if(
p
== pike_trampoline_program)
{ struct pike_trampoline *t; t=((struct pike_trampoline *)func->u.object->storage);
-
if(t->frame->current_object->prog)
-
RETURN
delambda(ID_FROM_INT(
t->frame->current_object->prog
,
-
t->func
)->name)
;
+
if(t->frame->current_object->prog)
{
+
p
=
t->frame->current_object->prog
;
+
f
=
t->func;
}
-
+
}
-
RETURN
delambda
(
ID_FROM_INT(func-
>
u.object
->
prog,
-
SUBTYPEOF
(
*func
)
)
->name);
+
#ifdef
PIKE_DEBUG
+
if
(
f
>
= p
->
num_identifier_references)
+
Pike_fatal("Function
without
reference.\n");
+
#endif
+
RETURN
delambda(ID_FROM_INT(p,
f
)->name);
} pop_n_elems(args); push_int(0); } /*! @decl object function_object(function f) *! *! Return the object the function @[f] is in. *! *! If @[f] is a global function defined in the runtime @expr{0@}
pike.git/src/builtin.cmod:1827:
#endif push_svalue(&THIS->_fun); f_function_name(1); push_text("(), "); f_add(2); } else { free_svalue(&THIS->_fun); SET_SVAL(THIS->_fun, PIKE_T_INT, NUMBER_DESTRUCTED, integer, 0); push_text("destructed_function(), "); }
+
} else if (TYPEOF(THIS->_fun) == PIKE_T_STRING) {
+
push_svalue(&THIS->_fun);
+
push_text("(), ");
+
f_add(2);
} else { push_text("destructed_function(), "); } if (THIS->args) { push_text("Args: "); push_int(THIS->args->size); f_add(2); } else { push_text("No args");
pike.git/src/builtin.cmod:2091:
SET_SVAL(res->item[size], PIKE_T_OBJECT, 0, object, o); bf = OBJ2_BACKTRACE_FRAME(o); if ((bf->prog = f->context->prog)) { add_ref(bf->prog); bf->pc = f->pc; }
+
SET_SVAL(bf->_fun, PIKE_T_INT, NUMBER_DESTRUCTED, integer, 0);
+
if (f->current_object && f->current_object->prog) {
-
+
if (f->fun == FUNCTION_BUILTIN) {
+
/* Unusual case. The frame is from call_c_initializers(), gc()
+
* or similar. cf [bug 6156]. /grubba
+
*/
+
struct pike_string *event_handler_string =
+
MK_STRING("__EVENT_HANDLER__");
+
SET_SVAL(bf->_fun, PIKE_T_STRING, 0, string, event_handler_string);
+
add_ref(event_handler_string);
+
} else {
SET_SVAL(bf->_fun, PIKE_T_FUNCTION, CHECK_IDREF_RANGE(f->fun, f->current_object->prog), object, f->current_object); add_ref(f->current_object);
-
+
function = ID_FROM_INT(f->current_object->prog, f->fun);
#ifdef PIKE_DEBUG add_ref(bf->oprog = bf->_fun.u.object->prog); #endif
-
function = ID_FROM_INT(f->current_object->prog, f->fun);
-
} else {
-
SET_SVAL(bf->_fun, PIKE_T_INT, NUMBER_DESTRUCTED, integer, 0);
+
}
-
+
}
if (f->locals) { INT32 numargs = DO_NOT_WARN((INT32) MINIMUM(f->num_args, stack_top - f->locals)); INT32 varargs = 0; if(of && of->locals) { /* f->num_args can be too large, so this is necessary for some * reason. I don't know why. /mast */ numargs = DO_NOT_WARN((INT32)MINIMUM(f->num_args,of->locals - f->locals));
pike.git/src/builtin.cmod:4929:
GET_VAL (false) GET_VAL (null) /* Kludge needed for the static null objects in the oracle module. It * ought to be fixed to use dynamic lookup of them instead. */ PMOD_EXPORT struct program *get_sql_null_prog(void) { return Null_program; }
+
PIKECLASS __Backtrace_Tester__
+
{
+
INIT {
+
Pike_error("__Backtrace_Tester__\n");
+
}
+
}
+
void init_builtin(void) { init_pike_list_node_blocks(); INIT } void exit_builtin(void) { if (val_module) free_object (val_module); EXIT