python.cpp: Added RunPythonStatement() function to IDC

This commit is contained in:
gergely.erdelyi 2008-04-12 07:32:34 +00:00
parent bab52674ca
commit d99b2eb64b

View File

@ -23,6 +23,7 @@
#include <idp.hpp>
#include <bytes.hpp>
#include <diskio.hpp>
#include <expr.hpp>
#include <loader.hpp>
#include <kernwin.hpp>
#include <netnode.hpp>
@ -76,6 +77,15 @@ int tracefunc(PyObject *obj, _frame *frame, int what, PyObject *arg)
}
#endif
/* Simple Python statement runner function for IDC */
static const char idc_runpythonstatement_args[] = { VT_STR, 0 };
static error_t idaapi idc_runpythonstatement(value_t *argv, value_t *res)
{
res->num = PyRun_SimpleString(argv[0].str);
return eOk;
}
/* QuickFix for the FILE* incompatibility problem */
int ExecFile(char *FileName)
{
@ -355,6 +365,9 @@ bool IDAPython_Init(void)
(void *)IDAPYTHON_SCRIPTBOX);
}
/* Register a RunPythonStatement() function for IDC */
set_idc_func("RunPythonStatement", idc_runpythonstatement, idc_runpythonstatement_args);
initialized = 1;
return true;