When transferring boolean data over the ABI, keep them as boolean types, not integer
Replace the type of all boolean variables around the ABI by NG_BOOL. NG_BOOL is typedefed to _Bool, when compiling shared ngspice. When sharedspice.h is use externally NG_BOOL is typdefed to bool
This commit is contained in:
parent
8f62dfbcf5
commit
9a2d968577
|
|
@ -87,7 +87,8 @@ ngspice.dll should never call exit() directly, but handle either the 'quit'
|
|||
request to the caller or an request for exiting upon error,
|
||||
done by callback function ngexit().
|
||||
|
||||
All boolean signals (NG_BOOL) are of type int.
|
||||
All boolean signals (NG_BOOL) are of type _Bool, if ngspice is compiled. They
|
||||
are of type bool if sharedspice.h is used externally.
|
||||
*/
|
||||
|
||||
#ifndef NGSPICE_PACKAGE_VERSION
|
||||
|
|
@ -134,8 +135,15 @@ struct ngcomplex {
|
|||
typedef struct ngcomplex ngcomplex_t;
|
||||
#endif
|
||||
|
||||
/* ngspice traditionally treats a boolean var as int */
|
||||
typedef int NG_BOOL;
|
||||
/* NG_BOOL is the boolean variable at the ngspice interface.
|
||||
When ompiling ngspice shared module, typedef to _BOOL, which is boolean in C,
|
||||
when used externally, keep it to be of type bool,
|
||||
as has been available in the past. */
|
||||
#ifndef SHARED_MODULE
|
||||
typedef bool NG_BOOL;
|
||||
#else
|
||||
typedef _Bool NG_BOOL;
|
||||
#endif
|
||||
|
||||
/* vector info obtained from any vector in ngspice.dll.
|
||||
Allows direct access to the ngspice internal vector structure,
|
||||
|
|
|
|||
|
|
@ -378,8 +378,8 @@ static bool nobgtrwanted = FALSE;
|
|||
static bool wantvdat = FALSE;
|
||||
static bool wantidat = FALSE;
|
||||
static bool wantsync = FALSE;
|
||||
static bool immediate = FALSE;
|
||||
static bool coquit = FALSE;
|
||||
static NG_BOOL immediate = FALSE;
|
||||
static NG_BOOL coquit = FALSE;
|
||||
static jmp_buf errbufm, errbufc;
|
||||
static int intermj = 1;
|
||||
#ifdef XSPICE
|
||||
|
|
@ -452,7 +452,7 @@ SIMinit(IFfrontEnd* frontEnd, IFsimulator** simulator)
|
|||
static threadId_t tid, printtid, tid2;
|
||||
|
||||
static bool fl_running = FALSE;
|
||||
static bool fl_exited = TRUE;
|
||||
static NG_BOOL fl_exited = TRUE;
|
||||
|
||||
static bool printstopp = FALSE;
|
||||
static bool ps_exited = TRUE;
|
||||
|
|
@ -776,7 +776,7 @@ read_initialisation_file(const char *dir, const char *name)
|
|||
|
||||
/* Checks if ngspice is running in the background */
|
||||
IMPEXP
|
||||
bool
|
||||
NG_BOOL
|
||||
ngSpice_running (void)
|
||||
{
|
||||
return (fl_running && !fl_exited);
|
||||
|
|
@ -1231,7 +1231,7 @@ static int bkpttmpsize = 0;
|
|||
|
||||
/* set a breakpoint in ngspice */
|
||||
IMPEXP
|
||||
bool ngSpice_SetBkpt(double time)
|
||||
NG_BOOL ngSpice_SetBkpt(double time)
|
||||
{
|
||||
int error;
|
||||
CKTcircuit *ckt = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue