重新构建的批检仪主板程序
This commit is contained in:
@@ -3,30 +3,30 @@
|
||||
#include "string.h"
|
||||
#include "QDebug"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
InterFace *interface;
|
||||
const char *name;
|
||||
} self_table_def;
|
||||
|
||||
static self_table_def g_self_table[] =
|
||||
{
|
||||
{.interface = 0, .name = "default"},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
InterFace *interFaceFind(const char *name)
|
||||
{
|
||||
int num = sizeof(g_self_table) / sizeof(g_self_table[0]);
|
||||
self_table_def *item = 0;
|
||||
for (int i = 0; i < num; i++)
|
||||
extern const int __start_ifdef;
|
||||
extern const int __stop_ifdef;
|
||||
if_def *start=(if_def *)&__start_ifdef;
|
||||
if_def *end=(if_def *)&__stop_ifdef;
|
||||
if_def *item = 0;
|
||||
for (item=start;item<end;item++)
|
||||
{
|
||||
item = &g_self_table[i];
|
||||
if (item != nullptr)
|
||||
{
|
||||
if (strcmp(name, item->name) == 0)
|
||||
return item->interface;
|
||||
return item->if_get_fun();
|
||||
}
|
||||
}
|
||||
qWarning("can not find interface named '%s'", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user