/*****************************************************************************1*2* Elmer, A Finite Element Software for Multiphysical Problems3*4* Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland5*6* This library is free software; you can redistribute it and/or7* modify it under the terms of the GNU Lesser General Public8* License as published by the Free Software Foundation; either9* version 2.1 of the License, or (at your option) any later version.10*11* This library is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU14* Lesser General Public License for more details.15*16* You should have received a copy of the GNU Lesser General Public17* License along with this library (in file ../LGPL-2.1); if not, write18* to the Free Software Foundation, Inc., 51 Franklin Street,19* Fifth Floor, Boston, MA 02110-1301 USA20*21*****************************************************************************/2223/*******************************************************************************24*25* Error/signal trapping for MATC.26*27*******************************************************************************28*29* Author: Juha Ruokolainen30*31* Address: CSC - IT Center for Science Ltd.32* Keilaranta 14, P.O. BOX 40533* 02101 Espoo, Finland34* Tel. +358 0 457 272335* Telefax: +358 0 457 230236* EMail: [email protected]37*38* Date: 30 May 199639*40* Modified by:41*42* Date of modification:43*44******************************************************************************/4546/*47* $Id: error.c,v 1.3 2007/06/08 08:12:17 jpr Exp $48*49* $Log: error.c,v $50* Revision 1.3 2007/06/08 08:12:17 jpr51* *** empty log message ***52*53* Revision 1.2 2005/05/27 12:26:19 vierinen54* changed header install location55*56* Revision 1.1.1.1 2005/04/14 13:29:14 vierinen57* initial matc automake package58*59* Revision 1.2 1998/08/01 12:34:34 jpr60*61* Added Id, started Log.62*63*64*/6566#include "elmer/matc.h"67#include "str.h"6869void sig_trap(int sig)70/*======================================================================71? Interrupt or floating point exception. Free all memory allocated72| after last call to doread, give an error message and73| longjump back to doread.74& longjmp, mem_free_all75~ doread76^=====================================================================*/77{78fprintf( math_out, "^C\n" );7980#if 081signal(SIGINT, sig_trap);82signal(SIGFPE, sig_trap);83#endif8485mem_free_all();8687longjmp(*jmpbuf, 2);88}8990void error_old(char *fmt,void *p1, void *p2)91/*======================================================================92? An error is detected by the program. Free all memory allocated93| after last call to doread, give an error message and94| longjump back to doread.95& longjmp, fprintf, mem_free_all96~ doread97^=====================================================================*/98{99PrintOut( "MATC ERROR: " );100PrintOut( fmt,p1,p2 );101102mem_free_all();103104longjmp(*jmpbuf, 2);105}106107108109