Computational routine
eng


delay4_i32

File content


#include "scicos_block4.h"

void delay4_i32(scicos_block *block,int flag)
{
  /* Copyright INRIA
   
     Scicos block simulator
     Ouputs nx*dt delayed input */

  SCSINT32_COP *y,*u,*oz;
  int nz,mz;
  int i;
  
  u=Getint32InPortPtrs(block,1);
  y=Getint32OutPortPtrs(block,1);
  oz=Getint32OzPtrs(block,1);
  nz=GetOzSize(block,1,2);
  mz=GetOzSize(block,1,1);

  if ((flag==1)||(flag==6)||(flag==4)){
    y[0]=oz[0];
  }else if (flag == 2){
    /*  shift buffer */
    for (i=0; i<=(mz*nz)-2; i++){
      oz[i]=oz[i+1];
    }
    /* add new point to the buffer */
    oz[(mz*nz)-1]=u[0];
  }
}