📄 menu.c
字号:
#include "def.h"
#include "menu.h"
#include "debug.h"
extern NBOOT_MENU g_topMenu[];
NBOOT_MENU * g_pCurMenu;
static int _Menu_CheckType(char * pInstruction)
{
if(*pInstruction == 0 || pInstruction == 0)
return 0;
if(g_pCurMenu->iInputType == MENU_INPUT_CHAR)
{
if(pInstruction[1] != 0)
return 0;
}
return 1;
}
void Menu_Display(void)
{
NBOOT_MENU * pCurMenu;
pCurMenu = g_pCurMenu;
while(pCurMenu->iMatch)
{
DbgPutString(pCurMenu->pStr);
pCurMenu++;
}
DbgPutString("\r\nInput:");
}
int Menu_Process(char * pInstruction)
{
NBOOT_MENU * pCurMenu;
if(_Menu_CheckType(pInstruction) == 0)
return 0;
if(g_pCurMenu->iInputType == MENU_INPUT_CHAR)
{
pCurMenu = g_pCurMenu;
while(pCurMenu->iMatch)
{
if(pCurMenu->iMatch == (int)(*pInstruction))
{
//We found a match
if((pCurMenu->pMenuFunc))
{
if((*(pCurMenu->pMenuFunc))((int)(*pInstruction)) == 0)
{
//If the current function return false. We will not call the next menu
break;
}
}
if(pCurMenu->pNextMenu)
g_pCurMenu = pCurMenu->pNextMenu;
break;
}
pCurMenu++;
}
}
return 0;
}
int Menu_IsCurTop(void)
{
return (g_pCurMenu == g_topMenu);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -