9944b0 | 2015-03-08 | Martin Nilsson | |
#include "global.h"
#include "module.h"
#include "pike_error.h"
#include "interpret.h"
#include "pike_embed.h"
#include "module_support.h"
|
34a679 | 2015-03-08 | Martin Nilsson | | #include "pike_security.h"
static void f_map_all_objects( INT32 args )
{
struct object *o = first_object;
INT32 total = 0;
ASSERT_SECURITY_ROOT("map_all_objects");
if( args!=1 )
SIMPLE_WRONG_NUM_ARGS_ERROR("map_all_objects", 1);
while( o )
{
struct object *next = o->next;
if( o->prog )
{
ref_push_object( o );
safe_apply_svalue( Pike_sp-2, 1, 1 );
pop_stack();
}
total++;
o = next;
}
pop_stack();
push_int(total);
}
|
9944b0 | 2015-03-08 | Martin Nilsson | |
#ifdef PIKE_DEBUG
PMOD_EXPORT void f__leak(INT32 args)
{
INT32 i;
if(!args)
SIMPLE_TOO_FEW_ARGS_ERROR("_leak", 1);
if(!REFCOUNTED_TYPE(TYPEOF(Pike_sp[-args])))
SIMPLE_BAD_ARG_ERROR("_leak", 1,
"array|mapping|multiset|object|"
"function|program|string");
add_ref(Pike_sp[-args].u.dummy);
i=Pike_sp[-args].u.refs[0];
pop_n_elems(args);
push_int(i);
}
PMOD_EXPORT void f_debug(INT32 args)
{
INT_TYPE d;
get_all_args("debug", args, "%+", &d);
pop_n_elems(args);
push_int(d_flag);
d_flag = d;
}
PMOD_EXPORT void f_optimizer_debug(INT32 args)
{
INT_TYPE l;
get_all_args("optimizer_debug", args, "%+", &l);
pop_n_elems(args);
push_int(l_flag);
l_flag = l;
}
PMOD_EXPORT void f_assembler_debug(INT32 args)
{
INT_TYPE l;
get_all_args("assembler_debug", args, "%+", &l);
pop_n_elems(args);
push_int(a_flag);
a_flag = l;
}
void f_dump_program_tables(INT32 args)
{
struct program *p;
INT_TYPE indent = 0;
get_all_args("dump_program_tables", args, "%p.%+", &p, &indent);
dump_program_tables(p, indent);
pop_n_elems(args);
}
#ifdef YYDEBUG
PMOD_EXPORT void f_compiler_trace(INT32 args)
{
extern int yydebug;
INT_TYPE yyd;
|
60d03c | 2015-03-08 | Martin Nilsson | | get_all_args("compiler_trace", args, "%i", &yyd);
|
9944b0 | 2015-03-08 | Martin Nilsson | | pop_n_elems(args);
push_int(yydebug);
yydebug = yyd;
}
#endif /* YYDEBUG */
#endif /* PIKE_DEBUG */
PIKE_MODULE_INIT
{
|
34a679 | 2015-03-08 | Martin Nilsson | | ADD_FUNCTION("map_all_objects", f_map_all_objects,
tFunc(tFunction,tIntPos), OPT_EXTERNAL_DEPEND);
|
9944b0 | 2015-03-08 | Martin Nilsson | | #ifdef PIKE_DEBUG
ADD_INT_CONSTANT("HAVE_DEBUG", 1, 0);
ADD_FUNCTION("_leak", f__leak, tFunc(tRef,tInt), OPT_EXTERNAL_DEPEND);
ADD_FUNCTION("debug", f_debug,
tFunc(tIntPos,tIntPos), OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);
ADD_FUNCTION("optimizer_debug", f_optimizer_debug,
tFunc(tIntPos,tIntPos), OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);
ADD_FUNCTION("assembler_debug", f_assembler_debug,
tFunc(tInt,tIntPos), OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);
ADD_FUNCTION("dump_program_tables", f_dump_program_tables,
tFunc(tPrg(tObj) tIntPos,tVoid),
OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);
#ifdef YYDEBUG
ADD_FUNCTION("compiler_trace", f_compiler_trace,
tFunc(tIntPos,tIntPos), OPT_SIDE_EFFECT|OPT_EXTERNAL_DEPEND);
#endif /* YYDEBUG */
#endif /* PIKE_DEBUG */
}
PIKE_MODULE_EXIT
{
}
|