예제 #1
0
void forth_cdup()
{
	cell_t tmp = cpop();

	cpush( tmp );
	cpush( tmp );
}
예제 #2
0
void forth_crot()
{
	cell_t first = cpop();
	cell_t midle = cpop();
	cell_t last  = cpop();

	cpush( last  );
	cpush( midle );
	cpush( first );
}
예제 #3
0
void forth_cswap()
{
	if( ctrlstack.size < 2 )
	{
		fault( "ctrl stack too short" );
	}

	cell_t first = cpop();
	cell_t last  = cpop();

	cpush( first );
	cpush( last );
}
예제 #4
0
/* -------------------------------------------------------------------------------------
// _sdyALPush
//-------------------------------------------------------------------------------------
// Ensures that only up to "g_wMaxAudLines" sounds are playing
//------------------------------------------------------------------------------------- */
SDY_SOUND* SDYAPI _sdyALPush(SDY_SOUND* pSoundPush, sdyBool bLoop)
{
	assert(pSoundPush);
	assert(g_cAudLines);
	if(!pSoundPush || !g_cAudLines)
		return sdyFalse;
	
	/* Make a duplicate if the sound is already playing */ 
	if(sdyALIsPlaying(pSoundPush))
		pSoundPush = _sdyALDuplicate(pSoundPush);
	
	if(pSoundPush)
	{
		if(!pSoundPush->bStatic)
		{
			pSoundPush->dwStrmPlayed = 0;
			pSoundPush->bLoopStream = bLoop;
		}
		
		if(_sdyALPushMakeFree(pSoundPush))
		{
			if(sdyDrvPlay(pSoundPush->pBuffer, bLoop | !pSoundPush->bStatic))
			{
				cpush(g_cAudLines, pSoundPush);
				return pSoundPush;
			}
		}
	}
	
	return sdyNull;
}
예제 #5
0
void forth_data_to_ctrl()
{
	cpush( pop() );
}
예제 #6
-1
char* TSolver::convtopol()   //converts symbol-function string to polish record
{if (S==NULL || !strlen(S)) seterr(E_VOID);
 char* r;
 if (Err!=E_NO)
   {ERROR:
    if (r!=NULL) free(r);
    free(S);
    return S=NULL;
   }
 int i,j=0;
 int p;
 int SL=strlen(S);
 r=(char*)calloc(SL*2+2,sizeof(char));
 r[0]='\0';
 cst_clear;
 for (i=0;S[i]!='\0';i++)
   {if (isnumc(S[i]) || isconst(S[i]) || (S[i]=='-' && (minusE || minusN)))
      {r[j++]=S[i];
       continue;
      }
    if (S[i]=='!')
      {addspc();
       r[j++]=S[i];
       addspc();
       continue;
      }
    p=prior(S[i]);
      {if (S[i]==')')
	 {addspc();
	  while ((!cst_free) && cst_end!='(')
	    {r[j++]=cpop();
	     r[j++]=' ';
	    }
	  cpop();
	  if ((!cst_free) && isfn(cst_end))
	    {r[j++]=cpop();
	     r[j++]=' ';
	    }
	  continue;
	 }

       if (S[i]==']')
	 {addspc();
	  while ((!cst_free) && cst_end!='[')
	    {r[j++]=cpop();
	     r[j++]=' ';
	    }
	  cpop();
	  r[j++]=f_abs;
          r[j++]=' ';
	  continue;
	 }
       if ((((!cst_free) && (p>=prior(cst_end)) && (prior(cst_end)>0)&&cst_end!='_'&&S[i]!='_') || S[i]==','))
	   {addspc();
	    while ((!cst_free) && p>=prior(cst_end) && prior(cst_end)>0)
	      {r[j++]=cpop();
	       r[j++]=' ';
	      }
	    if (S[i]==',') continue;
	   }
       cpush(S[i]);
       if (j>0) addspc();
      }
   }
 if (Err!=E_NO) goto ERROR;
 if (r[j-1]!=' ') r[j++]=' ';
 while (!cst_free)
  {r[j++]=cpop();
   r[j++]=' ';
  }
 if (r[j-1]!=' ') r[j++]=' ';
 r[j]='\0';
 free(S);
 S=strdbl(r);
 free(r);
#ifdef debug
 printf("%s\n",S);
#endif
 poled=1;
 return S;
}