1 /*------------------------------------------------------------\
2 |                                                             |
3 | This file is part of the Alliance CAD System Copyright      |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 |                                                             |
6 | Home page      : http://www-asim.lip6.fr/alliance/          |
7 | E-mail         : mailto:alliance-users@asim.lip6.fr       |
8 |                                                             |
9 | This progam is  free software; you can redistribute it      |
10 | and/or modify it under the  terms of the GNU Library General|
11 | Public License as published by the Free Software Foundation |
12 | either version 2 of the License, or (at your option) any    |
13 | later version.                                              |
14 |                                                             |
15 | Alliance VLSI  CAD System  is distributed  in the hope that |
16 | it  will be useful, but WITHOUT  ANY WARRANTY;              |
17 | without even the  implied warranty of MERCHANTABILITY or    |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General       |
19 | Public License for more details.                            |
20 |                                                             |
21 | You should have received a copy  of the GNU General Public  |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc.,        |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                     |
25 |                                                             |
26 \------------------------------------------------------------*/
27 /*------------------------------------------------------------\
28 |                                                             |
29 | Tool    :                     Aut                           |
30 |                                                             |
31 | File    :                 Aut Errors                        |
32 |                                                             |
33 | Authors :                Jacomme Ludovic                    |
34 |                                                             |
35 | Date    :                   03.12.96                        |
36 |                                                             |
37 \------------------------------------------------------------*/
38 
39 /*------------------------------------------------------------\
40 |                                                             |
41 |                         Include Files                       |
42 |                                                             |
43 \------------------------------------------------------------*/
44 
45 # include <stdio.h>
46 # include <stdlib.h>
47 # include <string.h>
48 # include <signal.h>
49 
50 
51 # include <mut.h>
52 # include "aut.h"
53 
54 # include "auterror.h"
55 
56 /*------------------------------------------------------------\
57 |                                                             |
58 |                           Constants                         |
59 |                                                             |
60 \------------------------------------------------------------*/
61 /*------------------------------------------------------------\
62 |                                                             |
63 |                            Types                            |
64 |                                                             |
65 \------------------------------------------------------------*/
66 /*------------------------------------------------------------\
67 |                                                             |
68 |                          Variables                          |
69 |                                                             |
70 \------------------------------------------------------------*/
71 /*------------------------------------------------------------\
72 |                                                             |
73 |                          Functions                          |
74 |                                                             |
75 \------------------------------------------------------------*/
76 /*------------------------------------------------------------\
77 |                                                             |
78 |                         Aut Error Function                  |
79 |                                                             |
80 \------------------------------------------------------------*/
81 
aut_error(Error,Text,File,Line)82 void aut_error( Error, Text, File, Line )
83 
84   int   Error;
85   char *Text;
86   char *File;
87   long  Line;
88 {
89   char *Name;
90 
91   Name = mbkstrdup( File );
92   Name[ strlen( File ) - 1 ] = '\0';
93 
94   fprintf( stderr, "%s%ld ", Name, Line );
95 
96   switch( Error )
97   {
98     case AUT_ALLOC_ERROR :
99       fprintf( stderr, "alloc error, can't continue !\n");
100     break;
101 
102     case AUT_ALLOC_SIZE_ERROR :
103       fprintf( stderr, "null size alloc error, can't continue !\n");
104     break;
105 
106     case AUT_RESIZE_ERROR :
107       fprintf( stderr, "resize error, can't continue !\n");
108     break;
109 
110     case AUT_HASH_SIZE_ERROR :
111       fprintf( stderr, "hash table size %ld error !\n", (long)Text );
112     break;
113 
114     case AUT_HASH_KEY_ERROR :
115       fprintf( stderr, "hash key %lx error !\n", (long)Text );
116     break;
117 
118     case AUT_OPEN_FILE_ERROR :
119       fprintf( stderr, "open file %s error !\n", Text );
120     break;
121 
122     case AUT_CLOSE_FILE_ERROR :
123       fprintf( stderr, "close file %s error !\n", Text );
124     break;
125 
126     default :
127 
128       fprintf( stderr, "unknown internal error %d !\n", Error );
129   }
130 
131   autexit( 1 );
132 }
133 
134 /*------------------------------------------------------------\
135 |                                                             |
136 |                         Aut Warning Function                |
137 |                                                             |
138 \------------------------------------------------------------*/
139 
aut_warning(Warning,Text,File,Line)140 void aut_warning( Warning, Text, File, Line )
141 
142   int   Warning;
143   char *Text;
144   char *File;
145   long  Line;
146 {
147   char *Name;
148 
149   Name = mbkstrdup( File );
150   Name[ strlen( File ) - 1 ] = '\0';
151 
152   fprintf( stderr, "%s%ld ", Name, Line );
153 
154   switch( Warning )
155   {
156     case AUT_EXIT_CORE_WARNING :
157       fprintf( stderr, "warning: abnormal autexit generates a core file !\n" );
158     break;
159 
160     case AUT_ALLOC_DEBUG_WARNING :
161       fprintf( stderr, "warning: autalloc and autfree debug mode on !\n" );
162     break;
163 
164     case AUT_ABNORMAL_EXIT_WARNING :
165       fprintf( stderr, "warning: abnormal autexit %ld !\n", (long)Text );
166     break;
167 
168     default :
169 
170       fprintf( stderr, "unknown internal warning %d !\n", Warning );
171   }
172 }
173 
174