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

	SkpE()

	This function is called by SkpCmd to skip a command which starts
with an E.

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

#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	ExeNYI();	/* "not yet implemented" command */
extern	DEFAULT	SkpArg();	/* skip a command with a text argument */
extern	DEFAULT	SkpOne();	/* skip one command character */
extern	DEFAULT	SkpSkp();	/* skip nothing */

EXTERN	char	*CBfPtr;	/* pointer into command string */
EXTERN	char	*CStEnd;	/* pointer to last char of command string */
EXTERN	WORD	MStTop;		/* top of macro stack */


DEFAULT SkpE()			/* skip one of the E commands */
{
	LOCAL char	TmpChr;
	static DEFAULT (*FEAray[])() = {
/* A */ SkpSkp,    /* B */ SkpArg,    /* C */ SkpSkp,    /* D */ SkpSkp,
/* E */ 0L,        /* F */ SkpSkp,    /* G */ SkpSkp,    /* H */ SkpSkp,
/* I */ SkpArg,    /* J */ SkpSkp,    /* K */ SkpSkp,    /* L */ SkpArg,
/* M */ SkpSkp,    /* N */ SkpSkp,    /* O */ SkpSkp,    /* P */ SkpSkp,
/* Q */ SkpOne,    /* R */ SkpArg,    /* S */ SkpSkp,    /* T */ SkpSkp,
/* U */ SkpSkp,    /* V */ SkpSkp,    /* W */ SkpArg,    /* X */ SkpSkp,
/* Y */ SkpSkp,    /* Z */ SkpSkp
	};
	static char *ErrTxt = "x";

	if (CBfPtr == CStEnd)
		if (MStTop < 0)			/* if not in a macro */
			{
			ErrMsg(ERR_UTC);	/* unterminated command */
			return(FAILURE);
			}
		else
			return(SUCCESS);

	++CBfPtr;
	TmpChr = To_Upper(*CBfPtr);

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