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

	ExeDQu()

	This function executes a double-quote command.

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

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

extern	VOID	ErrMsg();	/* display an error message */
extern	DEFAULT	FlowEE();	/* flow to | or ' */
extern	DEFAULT	GetNmA();	/* get numeric argument */
extern	DEFAULT	IncCBP();	/* increment CBfPtr */
extern	char	ZChrIt();	/* type-convert a long to a char */

EXTERN	BYTE	CmdMod;		/* command modifiers flags for @, :, etc. */
EXTERN	char	*CBfPtr;	/* pointer into command string */
EXTERN	WORD	EStBot;		/* expression stack bottom */
EXTERN	WORD	EStTop;		/* expression stack top */
EXTERN	LONG	NArgmt;		/* numeric argument */


DEFAULT ExeDQu()		/* execute a " (double quote) command */
{
	char	RelExp;				/* relational expression */

#if DEBUGGING
DbgInd+=2;if(DbgLvl>=1){DbgMsg();DbgDBf("ExeDqu: called.\015\012");DbgROf();}
#endif
	if (EStTop == EStBot)			/* if no numeric argument */
		{
		ErrMsg(ERR_NAQ);		/* no argument before " */
#if DEBUGGING
if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
		return(FAILURE);
		}

	if (GetNmA() == FAILURE)
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
		return(FAILURE);
#if DEBUGGING
}
#endif
	if (IncCBP() == FAILURE)
		return(FAILURE);
	CmdMod = '\0';
	RelExp = ZChrIt(NArgmt);
	switch (To_Upper(*CBfPtr)) {
		case 'A':	if (Is_Alpha(RelExp))
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'C':	if (Is_SyCon(RelExp))
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'D':	if (Is_Digit(RelExp))
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'E':
		case 'F':
		case 'U':
		case '=':	if (NArgmt == 0L)
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'G':
		case '>':	if (NArgmt > 0L)
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'L':
		case 'S':
		case 'T':
		case '<':	if (NArgmt < 0L)
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'N':	if (NArgmt)
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'R':	if (Is_Alnum(RelExp))
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'V':	if (Is_Lower(RelExp))
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		case 'W':	if (Is_Upper(RelExp))
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
					return(SUCCESS);
#if DEBUGGING
}
#endif
				break;
		default:	ErrMsg(ERR_IQC);    /* ill. char. after " */
#if DEBUGGING
if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
				return(FAILURE);
	}
	if (FlowEE() == FAILURE)		/* flow to | or ' */
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
		return(FAILURE);
#if DEBUGGING
}
#endif
	CmdMod = '\0';				/* clear modifiers flags */
#if DEBUGGING
if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeDqu: returning SUCCESS.\015\012");DbgROf();}DbgInd-=2;
#endif
	return(SUCCESS);
}
