/***************************************************************/
/* module   : fnct_genpat                                      */
/* date     : 28/03/92                                         */
/* auteurs  : RENAUD & VENOT & PITON                           */
/***************************************************************/

#include <stdio.h>

#include PAT_H
#include PHL_H
#include PPT_H

#include "libpat_l.h"

/*--------------------------------------------------------------*/
void SAV_GENPAT()
{

struct paiol *tmp_paiol;
struct paevt *tmp_paevt;
int i = 0;


   if (racine_pagrp != NULL)
       racine_pagrp = (struct pagrp*)reverse((void *)racine_pagrp);

   if (racine_papat == NULL)
       Erreur("not all inputs initialized \n");

   if ( racine_papat->PAEVT == NULL )
       Erreur("not all inputs initialized \n");
 
   for ( tmp_paiol  = racine_paiol ;tmp_paiol != NULL ;
	 tmp_paiol  = tmp_paiol->NEXT)
   {
	if (tmp_paiol->MODE == 'I')
	{
	  tmp_paevt = racine_papat->PAEVT;
	  while ( tmp_paevt != NULL )
	  {
	    if (tmp_paevt->INDEX == i) break;
	    tmp_paevt = tmp_paevt->NEXT;
	  }
	  if (tmp_paevt == NULL)
	    Erreur ("not all inputs initialized at pattern zero \n");
	}
	i++;
   }	



   racine_paseq->SUBSEQ = 1;
   racine_paseq->ENDFLG = 'Y';
   racine_paseq->ERRFLG = 0;

/*--------
pat_debug(racine_paseq,"paseq");
---------*/

   pat_savpaseq(racine_paseq->NAME,
		racine_paseq,
		MAX_LABEL);

   if (racine_pagrp != NULL)
       racine_pagrp = (struct pagrp*)reverse((void *)racine_pagrp);

}
