controlled_exit() instead of exit()

This commit is contained in:
h_vogt 2012-07-31 17:54:51 +02:00
parent c31fc334f6
commit b85f6bbc7d
8 changed files with 20 additions and 11 deletions

View File

@ -20,6 +20,8 @@
#include "ngspice/fftext.h"
#include "ngspice/wallace.h"
extern void controlled_exit(int status);
void f_alpha(int n_pts, int n_exp, double X[], double Q_d,
double alpha)
@ -134,7 +136,7 @@ trnoise_state_gen(struct trnoise_state *this, CKTcircuit *ckt)
if(this->top + 1 >= this->oneof_length) {
fprintf(stderr,"ouch, noise data exhausted\n");
exit(1);
controlled_exit(1);
}
ra1 += this->oneof[this->top] - this->oneof[0];

View File

@ -9,6 +9,8 @@ Copyright 1990 Regents of the University of California. All rights reserved.
#ifndef HAVE_LIBGC
extern void controlled_exit(int status);
/*saj For Tcl module locking*/
#ifdef TCL_MODULE
#include <tcl.h>
@ -42,7 +44,7 @@ tmalloc(size_t num)
#endif
if (!s){
fprintf(stderr,"malloc: Internal Error: can't allocate %ld bytes. \n",(long)num);
exit(EXIT_FAILURE);
controlled_exit(EXIT_FAILURE);
}
return(s);
}
@ -78,7 +80,7 @@ trealloc(void *ptr, size_t num)
}
if (!s) {
fprintf(stderr,"realloc: Internal Error: can't allocate %ld bytes.\n", (long)num);
exit(EXIT_FAILURE);
controlled_exit(EXIT_FAILURE);
}
return(s);
}

View File

@ -4,6 +4,7 @@ Modified: 2000 AlanFixes
**********/
#include "ngspice/ngspice.h"
#include "ngspice/fteext.h"
#include "ngspice/ifsim.h"
#include "ngspice/sperror.h"
#include "ngspice/spmatrix.h"
@ -222,7 +223,7 @@ int sens_sens(CKTcircuit *ckt, int restart)
output_values = NULL;
output_cvalues = NULL;
fprintf(stderr, "ERROR: restore is not implemented for cktsens\n");
exit(1);
controlled_exit(1);
}
#ifdef ASDEBUG

View File

@ -6,6 +6,7 @@ Author: 1992 Charles Hough
#include "ngspice/ngspice.h"
#include "ngspice/fteext.h"
#include "ngspice/cktdefs.h"
#include "txldefs.h"
#include "ngspice/sperror.h"
@ -53,7 +54,7 @@ TXLaccept(CKTcircuit *ckt, GENmodel *inModel)
else {
/* can't happen. */
printf("zero h detected\n");
exit(1);
controlled_exit(1);
}
}
}

View File

@ -6,6 +6,7 @@ Author: 1992 Charles Hough
#include "ngspice/ngspice.h"
#include "ngspice/fteext.h"
#include "ngspice/smpdefs.h"
#include "txldefs.h"
#include "ngspice/sperror.h"
@ -1157,7 +1158,7 @@ find_roots(double a1, double a2, double a3, double *x1, double *x2, double *x3)
t = a1 * a1 - 4.0 * a2;
if (t < 0) {
printf("***** Two Imaginary Roots in Characteristic Admittance.\n");
exit(EXIT_FAILURE);
controlled_exit(EXIT_FAILURE);
}
t *= 1.0e-18;

View File

@ -118,7 +118,7 @@ create_model( CKTcircuit* ckt, INPmodel* modtmp, INPtables* tab )
/* Check for various possible errors */
if ((errno == ERANGE && dval == HUGE_VAL) || errno != 0) {
perror("strtod");
exit(EXIT_FAILURE);
controlled_exit(EXIT_FAILURE);
}
if (endptr == parm) { /* it was no number - it is really a string */
temp = TMALLOC(char, 40 + strlen(parm));

View File

@ -11,6 +11,8 @@ Author: 1987 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "ngspice/inpptree.h"
#include "inp.h"
extern void controlled_exit(int status);
static INPparseNode *mkcon(double value);
static INPparseNode *mkb(int type, INPparseNode * left,
INPparseNode * right);
@ -857,7 +859,7 @@ static INPparseNode *prepare_PTF_PWL(INPparseNode *p)
if (p->funcnum != PTF_PWL) {
fprintf(stderr, "PWL-INFO: %s, very unexpected\n", __func__);
exit(1);
controlled_exit(1);
}
#ifdef TRACE
@ -1343,7 +1345,7 @@ void free_tree(INPparseNode *pt)
if(pt->usecnt) {
fprintf(stderr, "ERROR: fatal internal error, %s\n", __func__);
exit(1);
controlled_exit(1);
}
switch (pt->type) {

View File

@ -40,7 +40,7 @@ NON-STANDARD FEATURES
/* #include "prefix.h" */ /* jgroves */
#include "ngspice/ngspice.h"
#include <stdio.h>
//#include "util.h"
#include "ngspice/fteext.h"
#include "ngspice/ifsim.h"
#include "ngspice/inpdefs.h"
#include "ngspice/devdefs.h"
@ -587,7 +587,7 @@ static void MIFinit_inst(
break;
default:
printf("\nERROR - Impossible direction type in MIFinit_inst\n");
exit(1);
controlled_exit(1);
}
}