Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / mbkal / alc_pars_l.c
1 /*
2 * This file is part of the Alliance CAD System
3 * Copyright (C) Laboratoire LIP6 - Département ASIM
4 * Universite Pierre et Marie Curie
5 *
6 * Home page : http://www-asim.lip6.fr/alliance/
7 * E-mail support : mailto:alliance-support@asim.lip6.fr
8 *
9 * This library is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Library General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
13 *
14 * Alliance VLSI CAD System is distributed in the hope that it will be
15 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17 * Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with the GNU C Library; see the file COPYING. If not, write to the Free
21 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 /*******************************************************************************
25 * *
26 * Tool : Parser al *
27 * Author(s) : Gregoire AVOT *
28 * Updates : June, 12th 1998 *
29 * *
30 *******************************************************************************/
31 #include <ctype.h>
32 #include <string.h>
33 #include "generic_target.h"
34 #include MUT_H
35 #include MLO_H
36 #include MLU_H
37
38 #ident "@(#)Parser alliance logic v6 27 March 1999 by Gregoire AVOT"
39
40 #define TAILLE_CHAINE BUFSIZE
41
42 extern void alcloadlofig6 (lofig_list*, char*, char, FILE*, int );
43
44 /************************************************************************
45 * alc_directiondecode() *
46 ************************************************************************/
47 char alc_directiondecode(dir)
48 char * dir;
49 {
50 switch (dir[2])
51 {
52 case 'O' :
53 return 'B';
54 case 'K' :
55 return 'X';
56 case 'I' :
57 return 'Z';
58 case 'A' :
59 return 'T';
60 default :
61 return dir[0];
62 }
63 }
64
65 /************************************************************************
66 * alcloadlofig() *
67 ************************************************************************/
68
69 void alcloadlofig(pfig,fname,mode)
70 lofig_list * pfig;
71 char * fname;
72 char mode;
73 {
74 FILE *in;
75 char ligne[50];
76 char nomfic[TAILLE_CHAINE];
77 long i;
78
79 (void)sprintf(nomfic,"%s/%s.%s",WORK_LIB,fname,IN_LO);
80 if ((in=mbkfopen(fname, IN_LO ,READ_TEXT)) == NULL)
81 {
82 (void)fprintf(stderr,"\n*** mbk error *** Unable to open file : %s\n",nomfic);
83 EXIT(1);
84 }
85 if (TRACE_MODE == 'Y')
86 {
87 (void)printf("\n--- mbk --- parsing file : %s\n",nomfic);
88 }
89 (void)fgets(ligne,50,in);
90 (void)sscanf(ligne,"V ALLIANCE : %ld", &i);
91 if( i== 4 )
92 alcloadlofig6( pfig, fname, mode, in, 4 );
93 else
94 if( i == 5 )
95 alcloadlofig6( pfig, fname, mode, in, 5 );
96 else
97 if( i == 6 )
98 alcloadlofig6( pfig, fname, mode, in, 6 );
99 else
100 {
101 (void)fprintf(stderr,"\n*** mbk error *** unable to load file %s, too old version\n", fname);
102 EXIT(1);
103 }
104 if (fclose(in) != 0)
105 {
106 (void)fprintf(stderr,"\n*** mbk error *** can't close file : %s\n",nomfic);
107 EXIT(1);
108 }
109 }
110