Ejemplo n.º 1
0
Archivo: exef.c Proyecto: rmblair/tecoc
DEFAULT ExeF()				/* execute one of the F commands */
{
	if (IncCBP() == FAILURE) {
		return FAILURE;
	}

	switch (To_Upper(*CBfPtr)) {
          case 'S':  return ExeFS();
	  case 'N':  return ExeFN();
	  case 'D':  return ExeFD();
	  case 'R':  return ExeFR();
	  case 'B':  return ExeFB();
	  case 'C':  return ExeFC();
	  case 'K':  return ExeFK();
	  case '_':  return ExeFUn();
	  case '>':  return ExeFGt();
	  case '<':  return ExeFLs();
	  case '\'': return ExeFSQ();
	  case '|':  return ExeFBr();
	  default:   ErrChr(ERR_IFC, *CBfPtr);
		     return FAILURE;
	}
}
Ejemplo n.º 2
0
integer ExeS()			/* execute an S command */
{
	DBGFEN(1, "ExeS", NULL);

/*
 * The command m,nS is illegal: the user should use m,nFB
 */
	if (CmdMod & MARGIS) {			/* if it's m,nS */
		ErrStr(ERR_ILL, "m,nS");	/* illegal command "m,nS" */
		DBGFEX(1,DbgFNm,"FAILURE");
		return FAILURE;
	}

/*
 * If it's ::Stext$,  it's a compare,  not a search.  The text argument is
 * compared to the characters immediately following the character pointer.
 * It returns -1 if the strings match, else 0.  A ::Stext$ command is
 * equivalent to a .,.+1:FBtext$ command,  so that's the way it's implemented.
 */

	if (CmdMod & DCOLON) {			/* if it's ::S */
		if (CmdMod & MARGIS) {		/* if it's m,n::S */
			ErrStr(ERR_ILL, "m,n::S");
			DBGFEX(1,DbgFNm,"FAILURE");
			return FAILURE;
		}
		if (EStTop > EStBot) {		/* if it's n::S */
			ErrStr(ERR_ILL, "n::S");
			DBGFEX(1,DbgFNm,"FAILURE");
			return FAILURE;
		}
		if (GapEnd == EBfEnd) {		/* if nothing to search */
			if (FindES(ESCAPE) == FAILURE) {
				DBGFEX(1,DbgFNm,"FAILURE");
				return FAILURE;
			}
			DBGFEX(1,DbgFNm,"PushEx(0)");
			return PushEx(0L,OPERAND);
		}
		CmdMod &= ~DCOLON;		/* clear double-colon bit */
		CmdMod |= COLON;		/* set colon bit */
		CmdMod |= MARGIS;		/* set m defined bit */
		MArgmt = GapBeg - EBfBeg;	/* set m */
		if (PushEx((long)((GapBeg-EBfBeg)+1),OPERAND) == FAILURE) {
			DBGFEX(1,DbgFNm,"FAILURE");
			return FAILURE;
		}
		DBGFEX(1,DbgFNm,"ExeFB()");
		return ExeFB();			/* execute FB command */
	}

	SrcTyp = S_SEARCH;

	if (Search(false) == FAILURE) {
		DBGFEX(1,DbgFNm,"FAILURE");
		return FAILURE;
	}

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

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