1 /****************************************************************************/
3 /* Chaine de CAO & VLSI Alliance */
5 /* Produit : GENIUS v1.00 */
6 /* Fichier : gen_verif_utils.c */
8 /* Auteur(s) : Francois DONNET le : 10/06/1999 */
10 /* (c) copyright 1999 Laboratoire MASI equipe CAO & VLSI */
11 /* Tous droits reserves */
12 /* Support : e-mail alliance-support@asim.lip6.fr */
15 /****************************************************************************/
23 #include "gen_verif_utils.h"
27 /***************************************************************************/
28 /* put ident at the end of the list, this element must be unique */
29 /* comparison is supposed to be on string */
30 /* if an elem has the same key, an error is dumped */
31 /***************************************************************************/
32 extern chain_list
*put_inlist(ident
,list
)
39 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 252);
40 // fprintf(stderr,"put_inlist: NULL pointer\n");
45 for (p
=list
;p
;p
=p
->NEXT
) {
47 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 253);
48 // fprintf(stderr,"put_inlist: NULL pointer\n");
51 if (getname(p
->DATA
)==name
) {
52 avt_errmsg(GNS_ERRMSG
, "163", AVT_ERROR
, FILE_NAME(ident
),LINE(ident
), name
, LINE((tree_list
*)p
->DATA
), FILE_NAME((tree_list
*)p
->DATA
));
53 /*fprintf(stderr,"%s:%d: '%s' used several times, primary use line %d in file %s\n",
54 FILE_NAME(ident),LINE(ident), name, LINE((tree_list*)p->DATA), FILE_NAME((tree_list*)p->DATA));*/
58 if (!p
->NEXT
) {p
->NEXT
=addchain(NULL
,ident
);return list
;}
60 return addchain(NULL
,ident
);
64 /***************************************************************************/
65 /* return the element of list wich DATA field equals DATA field of ident */
66 /* comparison is supposed to be on string */
67 /* if not found NULL is returned and an error is dumped */
68 /***************************************************************************/
69 extern tree_list
*fetch_inlist(ident
,list
)
76 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 254);
77 // fprintf(stderr,"fetch_inlist: NULL pointer\n");
82 for (p
=list
;p
;p
=p
->NEXT
) {
84 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 254);
85 // fprintf(stderr,"fetch_inlist: NULL pointer\n");
88 if (strcasecmp(getname(p
->DATA
),name
)==0) {
92 avt_errmsg(GNS_ERRMSG
, "164", AVT_ERROR
, FILE_NAME(ident
),LINE(ident
), name
);
93 // fprintf(stderr,"%s:%d: '%s' not defined\n",FILE_NAME(ident),LINE(ident), name);
99 /***************************************************************************/
100 /* put ident with a value at the TOP of the list, this element must unique */
101 /* comparison is supposed to be on string */
102 /* if an elem has the same key, an error is dumped */
103 /***************************************************************************/
104 extern ptype_list
*put_value(ident
,value
,list
)
112 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 255);
113 // fprintf(stderr,"put_value: NULL pointer\n");
118 for (p
=list
;p
;p
=p
->NEXT
) {
120 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 256);
121 // fprintf(stderr,"put_value: NULL pointer\n");
124 if (getname(p
->DATA
)==name
) {
125 fprintf(stderr
,"%s:%d: '%s' used several times, primary use line %d in file %s\n",
126 FILE_NAME(ident
),LINE(ident
), name
, LINE((tree_list
*)p
->DATA
), FILE_NAME((tree_list
*)p
->DATA
));
130 if (!p
->NEXT
) {return addptype(list
,value
,ident
);}
132 return addptype(NULL
,value
,ident
);
136 /***************************************************************************/
137 /* return the value of the element of list wich DATA field equals DATA */
139 /* comparison is supposed to be on string */
140 /* if not found NULL is returned and an error is dumped */
141 /***************************************************************************/
142 extern int fetch_value(ident
,list
)
149 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 257);
150 // fprintf(stderr,"fetch_value: NULL pointer\n");
155 for (p
=list
;p
;p
=p
->NEXT
) {
157 avt_errmsg(GNS_ERRMSG
, "004", AVT_FATAL
, 258);
158 // fprintf(stderr,"fetch_value: NULL pointer\n");
161 if (getname(p
->DATA
)==name
) {
165 avt_errmsg(GNS_ERRMSG
, "164", AVT_ERROR
, FILE_NAME(ident
),LINE(ident
), name
);
166 //fprintf(stderr,"%s:%d: '%s' not defined (v2)\n",FILE_NAME(ident),LINE(ident), name);