/****************************************************************************/
/*                                                                          */
/*                      Chaine de CAO & VLSI   Alliance                     */
/*                                                                          */
/*    Produit :  Synthetiseur Logique                                       */
/*    Fichier :  gestionLst.c                                               */
/*                                                                          */
/*    (c) copyright 1991 Laboratoire MASI equipe CAO & VLSI                 */
/*    Tous droits reserves                                                  */
/*    Support : e-mail cao-vlsi@masi.ibp.fr                                 */
/*                                                                          */
/*    Auteur(s) :  L. Burgun                            le : 10/06/1992     */
/*                                                                          */
/*    Modifie par :                                     le : ../../....     */
/*    Modifie par :                                     le : ../../....     */
/*    Modifie par :                                     le : ../../....     */
/*                                                                          */
/****************************************************************************/

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include MUT_H
#include LOG_H
#include "../ablorder/sl_order.h"
#include "../param/sl_param.h"
#include "../behave/vh_btype.h"
#include "../synthe/sl_type.h"
#include "../synthe/sl_system.h"
#include "../synthe/sl_util.h"
#include "sl_corps.h"
#include "titres.h"


/*---------------------------------------------------------------------------

---------------------------------------------------------------------------*/

ptype_list *lstGestion (lst, message)
ptype_list *lst;
char *message;
{
ptype_list *lstCur;
int value;
char *chaine = (char *) mbkalloc( 4 * MaxString );
char *name = (char *) mbkalloc( 4 * MaxString );

do
   {
   RazEcran;
   printf("%s\n",message);
   lstCur = lst;
   while (lstCur)
      {
      printf("%s : %d\n", lst->DATA, lst->TYPE);
      lstCur = lstCur->NEXT;
      }
   printf("\n\n");
   printf("                 [A]dd, [D]elete or [R]eturn\n");
   printf("\n\n");
   gets( chaine );
   lstCur = lst;
   if (!strcmp(chaine,"A") || !strcmp(chaine,"a"))
      {
      printf("name : ");
      gets(name);
      printf("value : "); 
      get(value);
      while (lstCur)
         {
         if (!strcmp(name,lstCur->DATA))
            {
            lstCur->TYPE = value;
            break; 
            }
         lstCur = lstCur->NEXT;
         }
      if (!lstCur)
         {
         lst = addptype(lst,name,value); 
         }
      }
   if (!strcmp(chaine,"D") || !strcmp(chaine,"d"))
      {
      printf("name : ");
      gets(name);
      while (lstCur)
         {
         if (!strcmp(name,lstCur->DATA))
            {
            lstCur->TYPE = 0;
            }
         lstCur = lstCur->NEXT;
         }
      }
   }
while (!strcmp(chaine,"R") || !strcmp(chaine,"r"));
return(lst);
}
