Example #1
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;
}
Example #2
0
void EchoIt(MLINK stdlink,MLINK ml,bool b) {
  bool inCompound = false;
  int i;
  double d;
  char * s = 0;
  char * t = 0;
  long m,n;
  switch(MLGetType(stdlink)) {
  case MLTKINT;
     MLGetInteger(stdlink,&i);
     MLPutInteger(ml,i);
     break;
  case MLTKSYMB;
     MLGetSymbol(stdlink,&s);
     t = new char[strlen(s)+4];
     strcpy(t,s);
     strcat(t,"MXS");
     MLPutSymbol(ml,t);
     delete [] t;
     MLDisownSymbol(stdlink,s);
     break;
  case MLTKSTR;
     MLGetString(stdlink,&s);
     MLPutString(ml,s);
     MLDisownString(stdlink,s);
     break;
  case MLTKINT;
     MLGetInteger(stdlink,&i);
     MLPutInteger(ml,i);
     break;
  case MLTKFUNC;
     MLGetFunction(stdlink,&s,m);
     strcpy(t,s);
     strcat(t,"MXS");
     if(strcmp(s,"CompoundExpression")==0 && b) {
       inCompound = true;
       MLPutFunction(ml,t,2*m);
     } else {
       MLPutFunction(ml,t,m);
     };
     delete [] t;
     for(long n=1;n<=m;++n) {
       if(inCompound) {
         MLPutFunction(ml,"Print",4L); 
         MLPutString(ml,"Function:");
         MLPutString(ml,s);
         MLPutString(ml," ");
         MLPutInteger(ml,s_number);
         ++s_number;
       };
       EchoIt(stdlink,ml,b);
     };
     inCompound = false;
     break;
  default:
     DBG();
     break;
  };
};
Example #3
0
int _EchoConvert(MLINK mlp) {
  long errno = 0L;
  MLINK ml = MLLoopbackOpen(stdenv,&errno);
  int n;
  MLGetInteger(stdlink,n);
  bool b = n!=0; 
  EchoIt(stdlink,ml,b);
  return 0;
};
Example #4
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;
}