python.cpp: Removed trailing whitespaces

This commit is contained in:
gergely.erdelyi 2009-01-25 15:57:53 +00:00
parent 507ea15b7a
commit 1a45b5952a

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------ //------------------------------------------------------------
// IDAPython - Python plugin for Interactive Disassembler Pro // IDAPython - Python plugin for Interactive Disassembler Pro
// //
// Copyright (c) 2004-2008 Gergely Erdelyi <dyce@d-dome.net> // Copyright (c) 2004-2008 Gergely Erdelyi <dyce@d-dome.net>
// //
// All rights reserved. // All rights reserved.
// //
@ -64,7 +64,7 @@ int tracefunc(PyObject *obj, _frame *frame, int what, PyObject *arg)
PyObject *str; PyObject *str;
/* Catch line change events. */ /* Catch line change events. */
/* Print the filename and line number */ /* Print the filename and line number */
if (what == PyTrace_LINE) if (what == PyTrace_LINE)
{ {
str = PyObject_Str(frame->f_code->co_filename); str = PyObject_Str(frame->f_code->co_filename);
@ -92,7 +92,7 @@ int ExecFile(char *FileName)
{ {
PyObject* PyFileObject = PyFile_FromString(FileName, "r"); PyObject* PyFileObject = PyFile_FromString(FileName, "r");
if (!PyFileObject) if (!PyFileObject)
{ {
return 0; return 0;
} }
@ -120,7 +120,7 @@ bool CheckFile(char *filename)
qmakepath(filepath, idadir(NULL), "python", filename, NULL); qmakepath(filepath, idadir(NULL), "python", filename, NULL);
#else #else
qmakepath(filepath, idadir(), "python", filename, NULL); qmakepath(filepath, idadir(), "python", filename, NULL);
#endif #endif
if (!qfileexist(filepath)) if (!qfileexist(filepath))
{ {
@ -167,10 +167,10 @@ void IDAPython_RunScript(char *script)
slashpath[i] = scriptpath[i]; slashpath[i] = scriptpath[i];
} }
} }
slashpath[i] = '\0'; slashpath[i] = '\0';
/* Add the script't path to sys.path */ /* Add the script't path to sys.path */
snprintf(statement, sizeof(statement), "runscript(\"%s\")", slashpath); snprintf(statement, sizeof(statement), "runscript(\"%s\")", slashpath);
PyRun_SimpleString(statement); PyRun_SimpleString(statement);
@ -248,7 +248,7 @@ void IDAPython_ScriptBox(void)
PyErr_Print(); PyErr_Print();
} }
} }
} }
bool idaapi IDAPython_Menu_Callback(void *ud) bool idaapi IDAPython_Menu_Callback(void *ud)
{ {
@ -256,7 +256,7 @@ bool idaapi IDAPython_Menu_Callback(void *ud)
return true; return true;
} }
/* Compile callback for Python external language evaluator */ /* Compile callback for Python external language evaluator */
bool idaapi IDAPython_extlang_compile(const char *name, bool idaapi IDAPython_extlang_compile(const char *name,
ea_t current_ea, ea_t current_ea,
const char *expr, const char *expr,
@ -267,7 +267,7 @@ bool idaapi IDAPython_extlang_compile(const char *name,
return false; return false;
} }
/* Run callback for Python external language evaluator */ /* Run callback for Python external language evaluator */
bool idaapi IDAPython_extlang_run(const char *name, bool idaapi IDAPython_extlang_run(const char *name,
int nargs, int nargs,
const idc_value_t args[], const idc_value_t args[],
@ -280,7 +280,7 @@ bool idaapi IDAPython_extlang_run(const char *name,
} }
/* Calculator callback for Python external language evaluator */ /* Calculator callback for Python external language evaluator */
bool idaapi IDAPython_extlang_calcexpr(ea_t current_ea, bool idaapi IDAPython_extlang_calcexpr(ea_t current_ea,
const char *expr, const char *expr,
idc_value_t *rv, idc_value_t *rv,
@ -357,7 +357,7 @@ bool idaapi IDAPython_extlang_calcexpr(ea_t current_ea,
return false; return false;
} }
extlang_t extlang_python = extlang_t extlang_python =
{ {
sizeof(extlang_t), sizeof(extlang_t),
0, 0,
@ -420,7 +420,7 @@ bool IDAPython_Init(void)
char tmp[MAXSTR+64]; char tmp[MAXSTR+64];
char *initpath; char *initpath;
bool result = 1; bool result = 1;
/* Already initialized? */ /* Already initialized? */
if (initialized == 1) if (initialized == 1)
{ {
@ -439,7 +439,7 @@ bool IDAPython_Init(void)
{ {
return false; return false;
} }
/* Start the interpreter */ /* Start the interpreter */
Py_Initialize(); Py_Initialize();
@ -491,35 +491,35 @@ bool IDAPython_Init(void)
/* Add menu items for all the functions */ /* Add menu items for all the functions */
/* Different paths are used for the GUI version */ /* Different paths are used for the GUI version */
result = add_menu_item("File/IDC command...", "P~y~thon command...", result = add_menu_item("File/IDC command...", "P~y~thon command...",
"Alt-8", SETMENU_APP, "Alt-8", SETMENU_APP,
(menu_item_callback_t *)IDAPython_Menu_Callback, (menu_item_callback_t *)IDAPython_Menu_Callback,
(void *)IDAPYTHON_RUNSTATEMENT); (void *)IDAPYTHON_RUNSTATEMENT);
result = add_menu_item("File/Load file/IDC file...", "P~y~thon file...", result = add_menu_item("File/Load file/IDC file...", "P~y~thon file...",
"Alt-9", SETMENU_APP, "Alt-9", SETMENU_APP,
(menu_item_callback_t *)IDAPython_Menu_Callback, (menu_item_callback_t *)IDAPython_Menu_Callback,
(void *)IDAPYTHON_RUNFILE); (void *)IDAPYTHON_RUNFILE);
if (!result) if (!result)
{ {
add_menu_item("File/IDC command...", "P~y~thon file...", add_menu_item("File/IDC command...", "P~y~thon file...",
"Alt-9", SETMENU_APP, "Alt-9", SETMENU_APP,
(menu_item_callback_t *)IDAPython_Menu_Callback, (menu_item_callback_t *)IDAPython_Menu_Callback,
(void *)IDAPYTHON_RUNFILE); (void *)IDAPYTHON_RUNFILE);
} }
result = add_menu_item("View/Open subviews/Show strings", "Python S~c~ripts", result = add_menu_item("View/Open subviews/Show strings", "Python S~c~ripts",
"Alt-7", SETMENU_APP, "Alt-7", SETMENU_APP,
(menu_item_callback_t *)IDAPython_Menu_Callback, (menu_item_callback_t *)IDAPython_Menu_Callback,
(void *)IDAPYTHON_SCRIPTBOX); (void *)IDAPYTHON_SCRIPTBOX);
if (!result) if (!result)
{ {
add_menu_item("View/Open subviews/Problems", "Python S~c~ripts", add_menu_item("View/Open subviews/Problems", "Python S~c~ripts",
"Alt-7", SETMENU_APP, "Alt-7", SETMENU_APP,
(menu_item_callback_t *)IDAPython_Menu_Callback, (menu_item_callback_t *)IDAPython_Menu_Callback,
(void *)IDAPYTHON_SCRIPTBOX); (void *)IDAPYTHON_SCRIPTBOX);
} }
/* Register a RunPythonStatement() function for IDC */ /* Register a RunPythonStatement() function for IDC */
@ -551,7 +551,7 @@ void IDAPython_Term(void)
/* Remove the extlang */ /* Remove the extlang */
register_extlang(NULL); register_extlang(NULL);
/* Shut the interpreter down */ /* Shut the interpreter down */
Py_Finalize(); Py_Finalize();