/******************************************************************************
   
    menu.h - Prototypes for processing a menu.
             by Micromint Support <support@micromint.com>    May-2011

*******************************************************************************/
#ifndef __MENU_H__
#define __MENU_H__

/******************************************************************************

 Value returned if menu entry does not exsist

*******************************************************************************/

#define BAD_MENU_ENTRY           (-1)

/******************************************************************************

 Value returned if to many arguments are entered

*******************************************************************************/

#define TOO_MANY_ARGS_MENU   (-2)

/******************************************************************************

 Menu function callback type.

*******************************************************************************/

typedef int (*pfnMenuListing)(int argc, char *argv[]);

/******************************************************************************

 Structure for an entry in the menu table.

*******************************************************************************/

typedef struct
{
    /* Pointer to a string containing the name of the menu entry. */
    const char *pcMenu; 
    /* Pointer to a string of description for the menu entry. */
    const char *pcMenuDescription;
    /* Function pointer to the implementation of the menu. */
    pfnMenuListing pfnMenuEntrant;   
} tMenuEntry;

/******************************************************************************

  This is the Menu table that must be provided by the application.

*******************************************************************************/
extern tMenuEntry g_sMenu[];

/******************************************************************************

 Prototype

*******************************************************************************/
extern int MenuProcessor(char *pcMenuEntry);
#endif // __MENU_H__
