Browse Source

Add a code model function cm_exit(const int exitcode).

This function calls controlled_exit(exitcode) to shut
down gracefully.
pre-master-46
Holger Vogt 2 years ago
parent
commit
19ebfb1887
  1. 2
      src/include/ngspice/cmproto.h
  2. 1
      src/include/ngspice/dllitf.h
  3. 3
      src/xspice/cm/cmexport.c
  4. 9
      src/xspice/cm/cmutil.c
  5. 4
      src/xspice/icm/dlmain.c

2
src/include/ngspice/cmproto.h

@ -125,4 +125,6 @@ FILE *fopen_with_path(const char *path, const char *mode);
#define CM_IGNORE(x) (void) (x) #define CM_IGNORE(x) (void) (x)
void cm_cexit(const int);
#endif /* include guard */ #endif /* include guard */

1
src/include/ngspice/dllitf.h

@ -83,6 +83,7 @@ struct coreInfo_t {
void * ((*dllitf_tmalloc)(size_t)); void * ((*dllitf_tmalloc)(size_t));
void * ((*dllitf_trealloc)(const void *, size_t)); void * ((*dllitf_trealloc)(const void *, size_t));
void ((*dllitf_txfree)(const void *)); void ((*dllitf_txfree)(const void *));
void ((*dllitf_cexit)(const int));
#ifdef KLU #ifdef KLU
int ((*dllitf_MIFbindCSC) (GENmodel *, CKTcircuit *)) ; int ((*dllitf_MIFbindCSC) (GENmodel *, CKTcircuit *)) ;

3
src/xspice/cm/cmexport.c

@ -81,7 +81,8 @@ struct coreInfo_t coreInfo =
txfree, txfree,
tmalloc, tmalloc,
trealloc, trealloc,
txfree
txfree,
cm_cexit
#else #else
GC_malloc, GC_malloc,
tcalloc, tcalloc,

9
src/xspice/cm/cmutil.c

@ -36,7 +36,7 @@ INTERFACES
cm_complex_subtract() cm_complex_subtract()
cm_complex_multiply() cm_complex_multiply()
cm_complex_divide() cm_complex_divide()
cm_cexit()
REFERENCED FILES REFERENCED FILES
@ -51,6 +51,8 @@ NON-STANDARD FEATURES
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#include "ngspice/cm.h" #include "ngspice/cm.h"
extern void controlled_exit(const int);
/* Corner Smoothing Function ************************************ /* Corner Smoothing Function ************************************
* * * *
@ -525,4 +527,7 @@ Complex_t cm_complex_divide(Complex_t x, Complex_t y)
return(c); return(c);
} }
void cm_cexit(const int exitcode)
{
controlled_exit(exitcode);
}

4
src/xspice/icm/dlmain.c

@ -430,6 +430,10 @@ void txfree(const void *ptr) {
(coreitf->dllitf_txfree)(ptr); (coreitf->dllitf_txfree)(ptr);
} }
void cm_cexit(const int exitcode) {
(coreitf->dllitf_cexit)(exitcode);
}
#ifdef KLU #ifdef KLU
int MIFbindCSC (GENmodel *inModel, CKTcircuit *ckt) { int MIFbindCSC (GENmodel *inModel, CKTcircuit *ckt) {
return (coreitf->dllitf_MIFbindCSC) (inModel, ckt) ; return (coreitf->dllitf_MIFbindCSC) (inModel, ckt) ;

Loading…
Cancel
Save