Computational routine
eng


z_gen

File content


/* Modnumlib Scicos interfacing function
 * Copyright (C) 2009-2011 Alan Layec
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
 
/* z_buf Scicos discret memory block
 * Type 4 simulation function ver 1.0 - scilab-3.0
 * 17 janvier 2005 - IRCOM GROUP - Author : A.Layec
 */
 
/* REVISION HISTORY :
 * $Log$
 */
 
#include "scicos_block.h"

/* ipar[0] : taille du mot mémoire
 * z[0..ipar[0]-1] : mot mémoire
 * z[ipar[0]] : compteur
 */

void z_gen(scicos_block *block,int flag)
{
 int i,j;

 if(flag==1)
 {
  j = (int)block->z[block->ipar[0]];

  for(i=0;i<block->outsz[0];i++) {
    block->outptr[0][i]=block->z[j+i];
  }

  j += block->outsz[0];

  if(j>=block->ipar[0]) j=0;

  block->z[block->ipar[0]]=(double)j;
 }
}