PIPS
sc_error.c
Go to the documentation of this file.
1 /*
2 
3  $Id: sc_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 sc */
26 
27 #ifdef HAVE_CONFIG_H
28  #include "config.h"
29 #endif
30 
31 #include <stdio.h>
32 #include <stdarg.h>
33 #include <stdlib.h>
34 
35 /* void sc_error(va_dcl va_alist) should be called to terminate execution
36  * and to core dump when data structures are corrupted or when an undefined
37  * operation is requested (zero divide for instance).
38  * SC_ERROR should be called as:
39  *
40  * SC_ERROR(function_name, format, expression-list)
41  *
42  * where function_name is a string containing the name of the function
43  * calling SC_ERROR, and where format and expression-list are passed as
44  * arguments to vprintf. SC_ERROR terminates execution with abort.
45  */
46 void sc_error(char * name, char * fmt, ...)
47 {
48  va_list args;
49 
50  va_start(args, fmt);
51 
52  /* print name of function causing error */
53  (void) fprintf(stderr, "sc error in %s: ", name);
54 
55  /* print out remainder of message */
56  (void) vfprintf(stderr, fmt, args);
57  va_end(args);
58 
59  /* create a core file for debug */
60  (void) abort();
61 }
#define abort()
Definition: misc-local.h:53
void sc_error(char *name, char *fmt,...)
package sc
Definition: sc_error.c:46
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...