PIPS
error.c
Go to the documentation of this file.
1 /*
2 
3  $Id: error.c 1641 2016-03-02 08:20:19Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25  /* package contrainte */
26 
27 /*LINTLIBRARY*/
28 
29 #ifdef HAVE_CONFIG_H
30  #include "config.h"
31 #endif
32 
33 #include <stdio.h>
34 #include <stdarg.h>
35 #include <stdlib.h>
36 
37 /* void contrainte_error(va_dcl va_alist) should be called to terminate
38  * execution and to core dump when data structures are corrupted or when
39  * an undefined operation is requested (zero divide for instance).
40  * CONTRAINTE_ERROR should be called as:
41  *
42  * CONTRAINTE_ERROR(function_name, format, expression-list)
43  *
44  * where function_name is a string containing the name of the function
45  * calling CONTRAINTE_ERROR, and where format and expression-list are passed as
46  * arguments to vprintf. CONTRAINTE_ERROR terminates execution with abort.
47  */
48 /*VARARGS0*/
49 void contrainte_error(char * name, char * fmt, ...)
50 {
51  va_list args;
52 
53  va_start(args, fmt);
54 
55  /* print name of function causing error */
56  (void) fprintf(stderr, "contrainte error in %s: ", name);
57 
58  /* print out remainder of message */
59  (void) vfprintf(stderr, fmt, args);
60  va_end(args);
61 
62  /* create a core file for debug */
63  (void) abort();
64 }
void contrainte_error(char *name, char *fmt,...)
package contrainte
Definition: error.c:49
#define abort()
Definition: misc-local.h:53
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...