1 /*****************************************************************************
2 *
3 * Elmer, A Finite Element Software for Multiphysical Problems
4 *
5 * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library (in file ../LGPL-2.1); if not, write
19 * to the Free Software Foundation, Inc., 51 Franklin Street,
20 * Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 *****************************************************************************/
23
24 /*******************************************************************************
25 *
26 * Error/signal trapping for MATC.
27 *
28 *******************************************************************************
29 *
30 * Author: Juha Ruokolainen
31 *
32 * Address: CSC - IT Center for Science Ltd.
33 * Keilaranta 14, P.O. BOX 405
34 * 02101 Espoo, Finland
35 * Tel. +358 0 457 2723
36 * Telefax: +358 0 457 2302
37 * EMail: Juha.Ruokolainen@csc.fi
38 *
39 * Date: 30 May 1996
40 *
41 * Modified by:
42 *
43 * Date of modification:
44 *
45 ******************************************************************************/
46
47 /*
48 * $Id: error.c,v 1.3 2007/06/08 08:12:17 jpr Exp $
49 *
50 * $Log: error.c,v $
51 * Revision 1.3 2007/06/08 08:12:17 jpr
52 * *** empty log message ***
53 *
54 * Revision 1.2 2005/05/27 12:26:19 vierinen
55 * changed header install location
56 *
57 * Revision 1.1.1.1 2005/04/14 13:29:14 vierinen
58 * initial matc automake package
59 *
60 * Revision 1.2 1998/08/01 12:34:34 jpr
61 *
62 * Added Id, started Log.
63 *
64 *
65 */
66
67 #include "elmer/matc.h"
68 #include "str.h"
69
sig_trap(int sig)70 void sig_trap(int sig)
71 /*======================================================================
72 ? Interrupt or floating point exeption. Free all memory allocated
73 | after last call to doread, give an error message and
74 | longjump back to doread.
75 & longjmp, mem_free_all
76 ~ doread
77 ^=====================================================================*/
78 {
79 fprintf( math_out, "^C\n" );
80
81 #if 0
82 signal(SIGINT, sig_trap);
83 signal(SIGFPE, sig_trap);
84 #endif
85
86 mem_free_all();
87
88 longjmp(*jmpbuf, 2);
89 }
90
error_old(char * fmt,void * p1,void * p2)91 void error_old(char *fmt,void *p1, void *p2)
92 /*======================================================================
93 ? An error is detected by the program. Free all memory allocated
94 | after last call to doread, give an error message and
95 | longjump back to doread.
96 & longjmp, fprintf, mem_free_all
97 ~ doread
98 ^=====================================================================*/
99 {
100 PrintOut( "MATC ERROR: " );
101 PrintOut( fmt,p1,p2 );
102
103 mem_free_all();
104
105 longjmp(*jmpbuf, 2);
106 }
107
108