Briefly analyze the relationship between History management mechanism and EntryNewScreen
1. Global variables related to the EntryNewScreen function:
CurrEntryFuncPtr,
CurrExitScrnID, currTopScrnID,
CurrExitFuncPtr
2. Partial procedures of the EntryNewScreen function:
Step 1: Save the new screen ID (the first parameter of the function) --> currTopScrnID;
Step 2: Call ExecuteCurrExitHandler;
Step 3: Save the new screen ID --> currExitScrnID;
Step 4: Call SetGenericExitHandler;
Step 5 :......
......
3. Analyze ExecuteCurrExitHandler
Function prototype: void ExecuteCurrExitHandler (void );
A. the main process of this function is to call ExecuteCurrExitHandler_Ext and ClearInputEventHandler in sequence.
B. Analyze the functions of the ExecuteCurrExitHandler_Ext Function
Function prototype: void ExecuteCurrExitHandler_Ext (void );
Function: This function is used for executes current exit func handler without clear keys;
Main functions (pseudo-code representation ):
Step 1: if (currEntryFuncPtr | currExitFuncPtr)
{
Clear all interrupt event handles;
}
Step 2: if (currEntryFuncPtr)
{
ExitMyAppMenu (EntryNewMenu, SCR_ID_MYAPP_NEW );
// Import the currExitScrnID and currEntryFuncPtr recorded in the last call of EntryNewScreen into the stack
}
Step 3: if (currExitFuncPtr)
{
Mmu_frm_execute_scrn_exit_handler = MMI_TURE;
(* CurrExitFuncPtr )();
Mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
}
Step 4: currEntryFuncPtr = currExitFuncPtr = NULL;
Step 5: exit the function from the DM screen template;
Step 6 :......
......
4. Analyze SetGenericExitHandler
Function prototype: void SetGenericExitHandler (2010scrnid, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr );
Function: currexitscrnid <-- scrnid;
Currexitfuncptr <-- exitfuncptr;
Currentryfuncptr <-- entryfuncptr;
Note: several parameters of entrynewscreen are passed to global variables, which will be called the next time entrynewscreen is called.
5. involved exit functions:
Static void exitmyappmenu (void * entry_screen_pfunc, 2010screen_id)
{
History currhistory;
S16 nhistory = 0;
Currhistory. scrnid = screen_id;
Currhistory. entryfuncptr = entry_screen_pfunc;
PfnUnicodeStrcpy (S8 *) currHistory. inputBuffer, (S8 *) & nHistory );
GetCategoryHistory (currHistory. guiBuffer );
AddHistory (currHistory );
}
6. Summary:
The EntryNewScreen function first records the currEntryFuncPt recorded during the last execution of EntryNewScreen. The currExitScrnID is recorded into the stack using the History structure as the carrier;
Then the exit function is executed. Finally, the scrnID, exitFuncPtr, and entryFuncPtr in this window are saved to global variables, which will be used for the next call of EntryNewScreen.