Пример #1
0
int sInst::runcode(const char *code, bool showerr, bool canfree)
{
  if (m_vm) 
  {
    m_pc.Set("");
    eel_preprocess_strings(this,m_pc,code);
    NSEEL_CODEHANDLE code = NSEEL_code_compile_ex(m_vm,m_pc.Get(),1,canfree ? 0 : NSEEL_CODE_COMPILE_FLAG_COMMONFUNCS);
    char *err;
    if (!code && (err=NSEEL_code_getcodeerror(m_vm)))
    {
      if (NSEEL_code_geterror_flag(m_vm)&1) return 1;
      if (showerr) fprintf(stderr,"NSEEL_code_compile: %s\n",err);
      return -1;
    }
    else
    {
      if (code)
      {
        NSEEL_VM_enumallvars(m_vm,varEnumProc, this);
        NSEEL_code_execute(code);
        if (canfree) NSEEL_code_free(code);
        else m_code_freelist.Add((void*)code);
      }
      return 0;
    }
  }
  return -1;
}
Пример #2
0
void AVS_EEL_IF_Execute(NSEEL_CODEHANDLE handle, char visdata[2][2][576])
{
  if (handle)
  {
    EnterCriticalSection(&g_eval_cs);
    g_evallib_visdata=(char*)visdata;
    NSEEL_code_execute((NSEEL_CODEHANDLE)handle);
    g_evallib_visdata=NULL;
    LeaveCriticalSection(&g_eval_cs);
  }
}
Пример #3
0
void IPlugEEL::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
{
  // Mutex is already locked for us.

  double* in1 = inputs[0];
  double* in2 = inputs[1];
  double* out1 = outputs[0];
  double* out2 = outputs[1];

  for (int s = 0; s < nFrames; ++s, ++in1, ++in2, ++out1, ++out2)
  {
    NSEEL_code_execute(codehandle);
    *out1 = *mVmOutput * mGain;
    *out2 = *out1;
  }
}
Пример #4
0
bool texmgr::RunInitCode(int iSlot, char *szInitCode)
{
	// warning: destroys contents of m_tex[iSlot].m_szExpr,
	//   so be sure to call RunInitCode before writing or
	//   compiling that string!

	FreeCode(iSlot);
	FreeVars(iSlot);
	RegisterBuiltInVariables(iSlot);

	strcpy(m_tex[iSlot].m_szExpr, szInitCode);
	bool ret = RecompileExpressions(iSlot);

	// set default values of output variables:
	// (by not setting these every frame, we allow the values to persist from frame-to-frame.)
	*(m_tex[iSlot].var_x)        = 0.5;
	*(m_tex[iSlot].var_y)        = 0.5;
	*(m_tex[iSlot].var_sx)       = 1.0;
	*(m_tex[iSlot].var_sy)       = 1.0;
	*(m_tex[iSlot].var_repeatx)  = 1.0;
	*(m_tex[iSlot].var_repeaty)  = 1.0;
	*(m_tex[iSlot].var_rot)      = 0.0;
	*(m_tex[iSlot].var_flipx)    = 0.0;
	*(m_tex[iSlot].var_flipy)    = 0.0;
	*(m_tex[iSlot].var_r)        = 1.0;
	*(m_tex[iSlot].var_g)        = 1.0;
	*(m_tex[iSlot].var_b)        = 1.0;
	*(m_tex[iSlot].var_a)        = 1.0;
	*(m_tex[iSlot].var_blendmode)= 0.0;
	*(m_tex[iSlot].var_done)     = 0.0;
	*(m_tex[iSlot].var_burn)     = 1.0;

	#ifndef _NO_EXPR_
		if (m_tex[iSlot].m_codehandle)
			NSEEL_code_execute(m_tex[iSlot].m_codehandle);
	#endif

	return ret;
}