Esempio n. 1
0
/*****************************************************************************
	SkpE()
*****************************************************************************/
static DEFAULT SkpE()			/* skip one of the E commands */
{
	unsigned char TmpChr;
	static DEFAULT (*FEAray[])(VVOID) = {
/* A */ SkpSkp,    /* B */ SkpArg,    /* C */ SkpSkp,    /* D */ SkpSkp,
/* E */ 0,         /* F */ SkpSkp,    /* G */ SkpArg,    /* 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
	};
	if (CBfPtr == CStEnd)
		if (MStTop < 0)			/* if not in a macro */
			{
			ErrUTC();		/* 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'))
		{
		ErrChr(ERR_IEC, *CBfPtr);
		return FAILURE;
		}
	return (*FEAray[TmpChr-'A'])();
}
Esempio n. 2
0
/*****************************************************************************
	SkpF()
*****************************************************************************/
static DEFAULT SkpF()			/* skip one of the F commands */
{
	if (CBfPtr == CStEnd)
		if (MStTop < 0)			/* if not in a macro */
			{
			ErrUTC();		/* unterminated command */
			return FAILURE;
			}
		else
			return SUCCESS;
	++CBfPtr;
	switch (To_Upper(*CBfPtr)) {
		case 'S':
		case 'N':
		case 'C':
		case '_':	return SkpDAr();
		case 'D':
		case 'R':
		case 'B':
		case 'K':	return SkpArg();
		case '>':
		case '<':
		case '\'':
		case '|':	return SkpSkp();
		default:
		  		ErrChr(ERR_IFC, *CBfPtr);
				return FAILURE;
	}
}
Esempio n. 3
0
/*****************************************************************************
	SkpCrt()
*****************************************************************************/
static DEFAULT SkpCrt()		/* skip a ^ (caret) command */
{
	static DEFAULT (*FCAray[])(VVOID) = {
/* ^A*/ SkpCtA,   /* ^B*/ SkpSkp,   /* ^C*/ SkpSkp,   /* ^D*/ SkpSkp,
/* ^E*/ SkpSkp,   /* ^F*/ SkpSkp,   /* ^G*/ SkpSkp,   /* ^H*/ SkpSkp,
/*TAB*/ SkpArg,   /* LF*/ ExeNul,   /* VT*/ SkpSkp,   /* FF*/ SkpSkp,
/* CR*/ ExeNul,   /* ^N*/ SkpSkp,   /* ^O*/ SkpSkp,   /* ^P*/ SkpSkp,
/* ^Q*/ SkpSkp,   /* ^R*/ SkpSkp,   /* ^S*/ SkpSkp,   /* ^T*/ SkpSkp,
/* ^U*/ SkpCtU,   /* ^V*/ SkpSkp,   /* ^W*/ SkpSkp,   /* ^X*/ SkpSkp,
/* ^Y*/ SkpSkp,   /* ^Z*/ SkpSkp,   /* ^[*/ SkpSkp,   /* ^\*/ SkpSkp,
/* ^]*/ SkpSkp,   /* ^^*/ SkpOne,   /* ^_*/ SkpSkp
	};
	WORD	CDummy;
	if (CBfPtr == CStEnd)			/* if end of command string */
		if (MStTop < 0)			/* if macro stack empty */
			{
			ErrUTC();		/* unterminated command */
			return FAILURE;
			}
		else
			return SUCCESS;
	++CBfPtr;
	if ((*CBfPtr >= 'A') && (*CBfPtr <= '_'))
		CDummy = *CBfPtr - 'A';
	else if (Is_Lower(*CBfPtr))
		CDummy = *CBfPtr - 'a';		/* convert to upper case */
	else {
		ErrMsg(ERR_IUC);		/* illegal char after ^ */
		return FAILURE;
	}
	return (*FCAray[CDummy])();
}
Esempio n. 4
0
static DEFAULT SkpCtU()		/* skip control-U command */
{
	BOOLEAN	TTrace;		/* temp: holds trace flag */

	if (CBfPtr == CStEnd)
		if (MStTop < 0)			/* if not in a macro */
			{
			ErrUTC();		/* unterminated command */
			return FAILURE;
			}
		else
			return SUCCESS;
	++CBfPtr;
	TTrace = TraceM;			/* save trace mode flag */
	TraceM = FALSE;				/* keep FindES from tracing */
	if (FindES(ESCAPE) == FAILURE)		/* find end of string */
		{
		TraceM = TTrace;		/* restore trace mode flag */
		return FAILURE;
		}

	TraceM = TTrace;			/* restore trace mode flag */
	CmdMod = '\0';				/* clear modifiers flags */
	return SUCCESS;
}
Esempio n. 5
0
static DEFAULT SkpOne()		/* skip one command character */
{
#if DEBUGGING
	static char *DbgFNm = "SkpOne";
	sprintf(DbgSBf,"*CBfPtr = '%c'", *CBfPtr);
	DbgFEn(3,DbgFNm,DbgSBf);
#endif
	if (CBfPtr == CStEnd) {
		if (MStTop < 0) {		/* if not in a macro */
			ErrUTC();		/* unterminated command */
			DBGFEX(3,DbgFNm,"FAILURE");
			return FAILURE;
		} else {
			DBGFEX(3,DbgFNm,"SUCCESS");
			return SUCCESS;
		}
	}

	++CBfPtr;

#if DEBUGGING
	sprintf(DbgSBf,"*CBfPtr = '%c'", *CBfPtr);
	DbgFEx(3,DbgFNm,DbgSBf);
#endif
	return SUCCESS;
}
Esempio n. 6
0
DEFAULT FlowEL()		/* flow to end of loop */
{
	WORD	TmpNst;		/* temporary loop nest count */

	DBGFEN(3,"FlowEL",NULL);

	TmpNst = 1;
	do {
		if (CBfPtr == CStEnd) {		/* if end of command string */
			ErrUTC();		/* unterminated command */
			DBGFEX(3,DbgFNm,"FAILURE");
			return FAILURE;
		}
		++CBfPtr;			/* move to next command */
		if (*CBfPtr == '<') {		/* if loop start character */
			++TmpNst;		/* increment nesting count */
		} else if (*CBfPtr == '>') {	/* else if loop end char */
			--TmpNst;		/* decrement nesting count */
		} else {
			if (SkpCmd() == FAILURE) {
				DBGFEX(3,DbgFNm,"FAILURE");
				return FAILURE;
			}
		}
	} while (TmpNst > 0);

	if (TraceM) {				/* if tracing is on */
		EchoIt(*CBfPtr);		/* echo the character */
	}
	--LStTop;				/* pop loop stack */

	DBGFEX(3,DbgFNm,"FlowEL");
	return SUCCESS;
}
Esempio n. 7
0
/*****************************************************************************
	IncCBp()
	This function increments the command buffer pointer CBfPtr.  It
checks whether incrementing the command buffer pointer will move the command
buffer pointer past the end of the command buffer.
*****************************************************************************/
#include "zport.h"		/* define portability identifiers */
#include "tecoc.h"		/* define general identifiers */
#include "defext.h"		/* define external global variables */
#include "deferr.h"		/* define identifiers for error messages */
DEFAULT IncCBP()
{
	if (CBfPtr == CStEnd) {			/* if end of command string */
		if (MStTop < 0) {		/* if not in a macro */
			ErrUTC();		/* unterminated command */
			return FAILURE;
		}
		return SUCCESS;
	}
	++CBfPtr;
	if (TraceM) {				/* if trace mode is on */
		EchoIt(*CBfPtr);		/* display the character */
	}
	return SUCCESS;
}
Esempio n. 8
0
static DEFAULT SkpDqu()		/* skip a " (double quote) command */
{
	DBGFEN(3,"SkpDqu",NULL);
	if (CBfPtr == CStEnd)			/* if end of command string */
		if (MStTop < 0)			/* if not in a macro */
			{
			ErrUTC();		/* unterminated command */
			return FAILURE;
			}
		else
			return SUCCESS;
	++CBfPtr;
	switch (To_Upper(*CBfPtr)) {
		case 'A':
		case 'C':
		case 'D':
		case 'E':
		case 'F':
		case 'U':
		case '=':
		case 'G':
		case '>':
		case 'L':
		case 'S':
		case 'T':
		case '<':
		case 'N':
		case 'R':
		case 'V':
		case 'W':
			break;

		default:
			ErrMsg(ERR_IQC);    /* ill. char. after " */
			DBGFEX(3,DbgFNm,"FAILURE");
			return FAILURE;
	}

	CmdMod = '\0';				/* clear modifiers flags */

	DBGFEX(3,DbgFNm,"SUCCESS");
	return SUCCESS;
}
Esempio n. 9
0
integer ExeI()			/* execute an I command */
{
	unsigned char InChar;

	DBGFEN(1,"ExeI",NULL);
	if (EStTop > EStBot) {			/* if numeric argument */
		if (GetNmA() == FAILURE) {	/* get numeric argument */
			DBGFEX(1,DbgFNm,"FAILURE, GetNmA() failed");
			return FAILURE;
		}

		if (CmdMod & ATSIGN) {		/* if it's n@I// */
			if (IncCBP() == FAILURE) {
				DBGFEX(1,DbgFNm,"FAILURE, 1st IncCBP() failed");
				return FAILURE;
			}
			if (IncCBP() == FAILURE) {
				DBGFEX(1,DbgFNm,"FAILURE, 2nd IncCBP() failed");
				return FAILURE;
			}
			if (*CBfPtr != *(CBfPtr-1)) {
				ErrMsg(ERR_IIA);     /* illegal insert arg */
				DBGFEX(1,DbgFNm,"FAILURE, illegal insert arg");
				return FAILURE;
			}
		} else {				/* else must be nI$ */
			if ((CBfPtr+1) == CStEnd) {
				if (MStTop < 0) {
					ErrUTC();
					DBGFEX(1,DbgFNm,"FAILURE, unterminated command");
					return FAILURE;
				} else {
					DBGFEX(1,DbgFNm,"SUCCESS");
					return SUCCESS;
				}
			}
			if (*(CBfPtr+1) != ESCAPE) {
				ErrMsg(ERR_IIA);     /* illegal insert arg */
				DBGFEX(1,DbgFNm,"FAILURE, illegal insert arg");
				return FAILURE;
			}
		}
		InChar = (char)NArgmt;
		if (InsStr(&InChar, (ptrdiff_t)1) == FAILURE) {
			DBGFEX(1,DbgFNm,"FAILURE, InsStr() failed");
			return FAILURE;
		}
	} else {				/* else no numeric argument */
		if (FindES(ESCAPE) == FAILURE) {
			DBGFEX(1,DbgFNm,"FAILURE, FindES() failed");
			return FAILURE;
		}
		if (InsStr(ArgPtr, CBfPtr-ArgPtr) == FAILURE) {
			DBGFEX(1,DbgFNm,"FAILURE, InsStr() failed");
			return FAILURE;
		}
	}

	CmdMod = '\0';				/* clear modifiers flags */

	DBGFEX(1,DbgFNm,"SUCCESS");
	return SUCCESS;
}