1
0
Fork 0

DBG+BRIDGE+GUI: added refsearch.count() and refsearch.addr() expression functions

This commit is contained in:
mrexodia 2017-04-21 02:11:21 +02:00
parent 271cba4f56
commit b24b7939df
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
6 changed files with 48 additions and 0 deletions

View File

@ -1228,6 +1228,11 @@ BRIDGE_IMPEXP int GuiReferenceGetRowCount()
return (int)(duint)_gui_sendmessage(GUI_REF_GETROWCOUNT, 0, 0);
}
BRIDGE_IMPEXP int GuiReferenceSearchGetRowCount()
{
return int(_gui_sendmessage(GUI_REF_SEARCH_GETROWCOUNT, 0, 0));
}
BRIDGE_IMPEXP void GuiReferenceDeleteAllColumns()
{
_gui_sendmessage(GUI_REF_DELETEALLCOLUMNS, 0, 0);
@ -1252,6 +1257,11 @@ BRIDGE_IMPEXP char* GuiReferenceGetCellContent(int row, int col)
return (char*)_gui_sendmessage(GUI_REF_GETCELLCONTENT, (void*)(duint)row, (void*)(duint)col);
}
BRIDGE_IMPEXP char* GuiReferenceSearchGetCellContent(int row, int col)
{
return (char*)_gui_sendmessage(GUI_REF_SEARCH_GETCELLCONTENT, (void*)row, (void*)col);
}
BRIDGE_IMPEXP void GuiReferenceReloadData()
{
_gui_sendmessage(GUI_REF_RELOADDATA, 0, 0);

View File

@ -1000,6 +1000,8 @@ typedef enum
GUI_MENU_SET_ENTRY_NAME, // param1=int hEntry, param2=const char* name
GUI_FLUSH_LOG, // param1=unused, param2=unused
GUI_MENU_SET_ENTRY_HOTKEY, // param1=int hEntry, param2=const char* hack
GUI_REF_SEARCH_GETROWCOUNT, // param1=unused, param2=unused
GUI_REF_SEARCH_GETCELLCONTENT, // param1=int row, param2=int col
} GUIMSG;
//GUI Typedefs
@ -1091,10 +1093,12 @@ BRIDGE_IMPEXP void GuiSymbolRefreshCurrent();
BRIDGE_IMPEXP void GuiReferenceAddColumn(int width, const char* title);
BRIDGE_IMPEXP void GuiReferenceSetRowCount(int count);
BRIDGE_IMPEXP int GuiReferenceGetRowCount();
BRIDGE_IMPEXP int GuiReferenceSearchGetRowCount();
BRIDGE_IMPEXP void GuiReferenceDeleteAllColumns();
BRIDGE_IMPEXP void GuiReferenceInitialize(const char* name);
BRIDGE_IMPEXP void GuiReferenceSetCellContent(int row, int col, const char* str);
BRIDGE_IMPEXP char* GuiReferenceGetCellContent(int row, int col);
BRIDGE_IMPEXP char* GuiReferenceSearchGetCellContent(int row, int col);
BRIDGE_IMPEXP void GuiReferenceReloadData();
BRIDGE_IMPEXP void GuiReferenceSetSingleSelection(int index, bool scroll);
BRIDGE_IMPEXP void GuiReferenceSetProgress(int progress);

View File

@ -121,6 +121,8 @@ void ExpressionFunctions::Init()
//References
RegisterEasy("ref.count", refcount);
RegisterEasy("ref.addr", refaddr);
RegisterEasy("refsearch.count", refsearchcount);
RegisterEasy("refsearch.addr", refsearchaddr);
//Arguments
RegisterEasy("arg.get,arg", argget);

View File

@ -327,6 +327,20 @@ namespace Exprfunc
return addr;
}
duint refsearchcount()
{
return GuiReferenceSearchGetRowCount();
}
duint refsearchaddr(duint row)
{
auto content = GuiReferenceSearchGetCellContent(int(row), 0);
duint addr = 0;
valfromstring(content, &addr, false);
BridgeFree(content);
return addr;
}
static String argExpr(duint index)
{
#ifdef _WIN64

View File

@ -60,6 +60,8 @@ namespace Exprfunc
duint refcount();
duint refaddr(duint row);
duint refsearchcount();
duint refsearchaddr(duint row);
duint argget(duint index);
duint argset(duint index, duint value);

View File

@ -224,6 +224,11 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
return (void*)referenceManager->currentReferenceView()->mList->getRowCount();
return 0;
case GUI_REF_SEARCH_GETROWCOUNT:
if(referenceManager->currentReferenceView())
return (void*)referenceManager->currentReferenceView()->mCurList->getRowCount();
return 0;
case GUI_REF_DELETEALLCOLUMNS:
GuiReferenceInitialize(tr("References").toUtf8().constData());
break;
@ -246,6 +251,17 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
return data;
}
case GUI_REF_SEARCH_GETCELLCONTENT:
{
QString content;
if(referenceManager->currentReferenceView())
content = referenceManager->currentReferenceView()->mCurList->getCellContent((int)param1, (int)param2);
auto bytes = content.toUtf8();
auto data = BridgeAlloc(bytes.size() + 1);
memcpy(data, bytes.constData(), bytes.size());
return data;
}
case GUI_REF_RELOADDATA:
emit referenceReloadData();
break;