/*****************************************************************************

	ExeE()

	This function executes two-letter commands that start with "E".
It uses the character following the "E" to index into a table of functions.

*****************************************************************************/

#include "ZPort.h"		/* define portability identifiers */
#include "DefTeco.h"		/* define general identifiers */
#include "ChrMacs.h"		/* define character processing macros */
#include "DefError.h"		/* define identifiers for error messages */

extern	VOID	ErrMsg();	/* display an error message */
extern	DEFAULT	Execut();	/* execute a function */
extern	DEFAULT	ExeEA();	/* execute an EA command */
extern	DEFAULT	ExeEB();	/* execute an EB command */
extern	DEFAULT	ExeEC();	/* execute an EC command */
extern	DEFAULT	ExeED();	/* execute an ED command */
extern	DEFAULT	ExeEF();	/* execute an EF command */
extern	DEFAULT	ExeEH();	/* execute an EH command */
extern	DEFAULT	ExeEI();	/* execute an EI command */
extern	DEFAULT	ExeEK();	/* execute an EK command */
extern	DEFAULT	ExeEN();	/* execute an EN command */
extern	DEFAULT	ExeEO();	/* execute an EO command */
extern	DEFAULT	ExeEP();	/* execute an EP command */
extern	DEFAULT	ExeEPr();	/* execute an E% command */
extern	DEFAULT	ExeEQ();	/* execute an EQ command */
extern	DEFAULT	ExeER();	/* execute an ER command */
extern	DEFAULT	ExeES();	/* execute an ES command */
extern	DEFAULT	ExeET();	/* execute an ET command */
extern	DEFAULT	ExeEU();	/* execute an EU command */
extern	DEFAULT	ExeEUn();	/* execute an E_ command */
extern	DEFAULT	ExeEV();	/* execute an EV command */
extern	DEFAULT	ExeEW();	/* execute an EW command */
extern	DEFAULT	ExeEX();	/* execute an EX command */
extern	DEFAULT	ExeEY();	/* execute an EY command */
extern	DEFAULT	ExeNYI();	/* "not yet implemented" function */
extern	DEFAULT	IncCBP();	/* increment CBfPtr */
extern	DEFAULT	ZExeEG();	/* execute an EG command */

EXTERN	char	*CBfPtr;	/* pointer into command string */


DEFAULT	ExeE()			/* execute an E command */
{
	static	char	*ErrTxt = "x";
	LOCAL	char	TmpChr;
	static DEFAULT (*FEAray[])() = {
/* A */ ExeEA,    /* B */ ExeEB,    /* C */ ExeEC,    /* D */ ExeED,
/* E */ 0L,       /* F */ ExeEF,    /* G */ ZExeEG,   /* H */ ExeEH,
/* I */ ExeEI,    /* J */ ExeNYI,   /* K */ ExeEK,    /* L */ ExeNYI,
/* M */ ExeNYI,   /* N */ ExeEN,    /* O */ ExeEO,    /* P */ ExeEP, 
/* Q */ ExeEQ,   /* R */ ExeER,    /* S */ ExeES,    /* T */ ExeET,
/* U */ ExeEU,    /* V */ ExeEV,    /* W */ ExeEW,    /* X */ ExeEX,
/* Y */ ExeEY,    /* Z */ ExeNYI
	};

	if (IncCBP() == FAILURE)
		return(FAILURE);

	TmpChr = To_Upper(*CBfPtr);

	if (TmpChr == '%')
		return(ExeEPr());
	else if (TmpChr == '_')
		return(ExeEUn());
	else if (!Is_Upper(TmpChr) || (TmpChr == 'E'))
		{
		*ErrTxt = *CBfPtr;
		ErrMsg(ERR_IEC, ErrTxt);
		return(FAILURE);
		}
	return(Execut(FEAray[TmpChr-'A']));
}
