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

	ExeR()

	This function executes a R command.

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

#include "ZPort.h"		/* define portability identifiers */
#include "DefTeco.h"		/* define general identifiers */

extern	DEFAULT	DoCJR();	/* do C, J or R stuff */
extern	DEFAULT	GetNmA();	/* get numeric argument */
extern	VOID	UMinus();	/* handle unary minus */

EXTERN	WORD	EStBot;		/* expression stack bottom */
EXTERN	WORD	EStTop;		/* expression stack top */
EXTERN	LONG	NArgmt;		/* numeric argument */


DEFAULT ExeR()			/* execute a C command */
{
#if DEBUGGING
DbgInd+=2;if(DbgLvl>=1){DbgMsg();DbgDBf("ExeR: called.\015\012");DbgROf();}
#endif

	if (EStTop == EStBot)			/* if no numeric argument */
		NArgmt = 1L;			/* default is 1R */
	else
		{
		UMinus();			/* if it's -R, make it -1R */
		if (GetNmA() == FAILURE)
#if DEBUGGING
{if(DbgLvl>=1)
{DbgMsg();DbgDBf("ExeR: returning FAILURE.\015\012");DbgROf();}DbgInd-=2;
#endif
			return(FAILURE);
#if DEBUGGING
}
#endif
		}

#if DEBUGGING
if(DbgLvl>=1){DbgMsg();
DbgDBf("ExeR: returning DoCJR().\015\012");DbgROf();}DbgInd-=2;
#endif
	return(DoCJR(-NArgmt));
}
